Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
 
  HOME    TRACKER    Visual Basic




How To Stop The Renew Index's For Listview ?


peace be with you

i make a small project used " listview "

i add a 3 items therefore the index's will be [ 1 - 2 - 3 ]

when i remove the index "2" the index's changes like this [ 1 - 2 ]

and number [2] is the index 3 before the removed

the question is :

how to set the index's not changes ??

thanks




View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
Tab Stop / Tab Index
Hi,

I have a form with seven option buttons and a bunch of text boxs. When I tab through the controls, I don't want the tab to stop on the option buttons. I have the tab stop property set to false on the option buttons, but it still assigns a tab index number. I'm setting the form up to automatically tab when the text box data entry has reached maxlength, but I don't want the tab to go to the option buttons at all. Does someone know how I can fix this?

Tracey

API To Renew DHCP Address
Hi All,
Is there an API to renew your DHCP IP address, or can you only renew the address through cmd or your router?

Thanks

Ipconfig /release Or /renew...
Hi,

What would the code be for a VB program that gives the user an option to run the command line code "ipconfig /release" and "ipconfig /renew"?

If you need clarification, please ask.

Thanks!

Ipconfig /release && Renew Call ..
would like to include a "Click" for ipconfig/renew and ipconfig/release....

Have looked around but not found anything that doesnt go off into all sorts of other stuff and makes the code a bit confusing to me...ie:dont need any output stuff etc

A simple one or two line suggestion would be great please

ListView Index
Sorry, wrong thread title

How do you get the index of a ListView? Is it like this...

Code:
If List1.ListIndex = 0 Then

Listview Index?
How would I get the current index of an item from the listview control that i've selected?

like for a listbox, i would do


Code:
msgbox list1.listindex



i've tried googling for the answers, but something like this is kinda hard to find

Listview And Index
Dear Friends,

I have a listview control. When i click on a record (full fow select) i need to know the index of the record i have selected.

With the same listview i have checkbox, when i click on command_1 (for exaple) i need to know the indexes of the checked records.

how can i resolv that problem?

Best regards,

Listview Index?
I'm new to listviews.

When I click on a row, how do I get the row index, if I have a multi-column list? By using code below, I can always get the index if I click on the first colum- however, clicking on any other column, returns the index of the last first-column I clicked?

This only works when clicking on the first column
MsgBox ListView1.SelectedItem.Index

What am i doing wrong?
Thanks in advance
Jay

Listview Index
Hi

The INDEX property on a Listview control is an Integer which restricts it to have only 32767 records. Is there a way around this or any other control available which will require minimum code change

Listview Index Question
I was recently informed that when a column sort is done on a listview, the listview indexes are changed. With that, is there a way to place the indexes back in their original order after the column sort?

Thanks,
hwatson

ListView Index Problem
Hello,

I've spent a couple days now trying to sort out a problem with inconsistant Indexes on a ListView. I haven't found any reports in MSDN regarding this. It seems that some people experience this problem and many don't. To fully explain the problem I've put together a little project. It can be downloaded at this link:ListConfusion.zip

To simply explain the problem:

ListView List should be ordered like this:

Index 1
Index 2
Index 3
Index 4
...etc

However, in my case the indexes are completly sparatic and inconsistant

If anyone can find a solution or work around to this I will be thrilled.
If you are experiencing this problem and are looking for a solution, feel free to leave me your email, and I will contact you and give you the link to the solution if I find one.

As well if you are experiencing this problem, can you leave a post letting me know so that I can give microsoft some idea of how many people I know of who are also experiencing the same problem (if I resort to contacting microsoft, that is).

Can anyone help me?....I'm desperate!!!

ListView Index? ARGH!
You know, the hard things I can puzzle out - for example, I figured out how to load a transparent bitmap into a picturebox this afternoon (And to my amazement, the same process was MUCH easier in DX, with surfaces...).

Ah, but the simple things stare me down and laugh at me while I puzzle them constantly... this should be simple, but I've tried and tried and I just can't get it to work, and stoopid MSDN is no help, so I turn to... <drumroll please> the VB gurus at VBF. Said gurus will no doubt laugh at my ineptitude and then give me the obvious answer to my silly question.

Speaking of the question...
So, at a given point in my resource editor code, I need to know which item is currently selected in a ListView - preferably the index. What parameter of ListView gives me the index?

Surprisingly, ListView.index gives me an error - "This object is not an array." And ListView.listitems.index has similar errors. -_-*

Grrrr... >_<

Positioning To A Certain Index Of A Listview
Actually I think I'm on to something.
The FindItem Method of the ListView looks like it should do what I need.


I have a ListView that is being loaded from a database. I'm trying to give the user the option to input a value and the list will be positioned to that matching value or whatever value follows directly after the input value. I'm trying to decide if it would be a better idea to position the listview to the input value, or requery the file and reload the listview based on the results of the query. It would be easier for me to simply requery the file and reload the listview, but I'd rather cut down the file I/O and just postion the list if that is possible. I have to imagine it is, but I'm not sure how to do that yet. Any ideas on what to do or where to look?

Move To Next Index In Listview
in listbox control....... it was easy just

list1.listindex = list1.listindex + 1

How shall i do the same in ListView Control ??

Index Out Of Bounds On Listview
The first time i run the code below it is fine but the second time i run it the program comes up with an error of Index out of bounds.

the code below has been copied about 8 times for the same procedure for different items (in bold)

Dim a As Integer

frmMechLab.lstCurrMechLoc.ListItems.Clear
frmMechLab.lblLocation.Caption = "Left Arm:"
For a = 1 To frmBTechMain.lstWeapon.ListItems.Count Step 1
If frmBTechMain.lstWeapon.ListItems(a).SubItems(1) = "LA" Then
frmMechLab.lstCurrMechLoc.ListItems.Add = frmBTechMain.lstWeapon.ListItems(a)
frmMechLab.lstCurrMechLoc.ListItems(a).SubItems(1) = frmBTechMain.lstWeapon.ListItems(a).SubItems(2)
frmMechLab.lstCurrMechLoc.ListItems(a).SubItems(2) = frmBTechMain.lstWeapon.ListItems(a).SubItems(3)
End If
Next

if you need more info please let me know what more info you need!

Thanks

ListView Sorting Using Index
Does anyone know how to go about randomizing what I have in a listview? The catch is I want to be able to put the contents back in the original order later on. This is going to be a playlist for a media player that I am writing. Thank you for any help I can get

Listview Index Issue ...
I have a listview with a few hidden columns at the end.

when the user goes up or down the entries using the arrow keys I want to populate some labels with the entries in the hidden columns.

My problem is that I am using the controls Keydown event to do this, and I am trapping the selected item using "ListView.SelectedItem.Index", which always gives me the values relating to the row I am moving off of, and not the values from the row I am moving into, which are the ones I want.

Do I have to manipulate the index value based on the key they press (although thats gonna make Page Up and Page Down tricky !), or is there another way to get the values of the row I am moving into ?

I don't use listviews much, so hopefully this is going to be an easy question .......

Listview Selected Index
The default ListView.Selected.Index is 1.. But i try ListView1.SelectedItem.Index = 2 after I populate the items.. but I encounter this error message;

"Property is read-only"

What code is right for this to select the 2nd row in ListView?

Get The Index Of An Icon In Listview
Is there a way I can retrieve the index of an icon in listview?

I have a imagelist with 4 icons, I have no problem adding the icons to list view from the imagelist.

basically I need to be able to tell if the icon is an open or closed folder
my program really needs to check the icon type before I can process the Info in the listview.

can I retrieve the index or key of an icon in listview?

Thx for any help!

How Do I Set Listview/combo.index?
I want to set the selected items in listview and combo view

for instance in a normal list i can set the selected item by list1.listindex = 12 but how do i do this with listview, i keep getting error 91, with object or variable not set (or something like that)

i tried all sorts, but this easy procedure is still evading me

please help,


thanks

mick

Select ListView Index Value From ListBox
Hi,
How do you select a value from a list box and then it selects the LIST VIEW?

BOTH HAVING THE SAME VALUES

Index Out Of Bound - Print Listview
I got "Index out of bounds" when I print a listview...

Only the picture, title and Column headers are printed...

Code in bold it's where VB stop...


VB Code:
Dim ii As Long    Printer.FontName = "arial"    Printer.Orientation = vbPRORLandscape        Printer.PaintPicture LogoDemtec.Picture, 0, 0        Printer.Print        Printer.Print        Printer.Print        Printer.Print        Printer.Print        Printer.Print    'Ligne de Titre        Printer.FontUnderline = True        Printer.FontSize = 14        Printer.FontBold = True        Printer.Print "Statistiques des Visites chez DEMTEC"        Printer.Print    'Entête des colonnes        Printer.FontUnderline = True        Printer.FontSize = 10        Printer.FontBold = True        Printer.Print "Items"; _            Tab(37); "Données"; _            Tab(74); "Résultats"; _            Tab(111); "Pourcentage"    'Liste des items        Printer.FontUnderline = False        Printer.FontSize = 10        Printer.FontBold = False            For ii = 1 To 10[b]                Printer.Print ListView1.ListItems(ii).ListSubItems(1); _                Tab(40); ListView1.ListItems(ii).ListSubItems(2); _                Tab(80); ListView1.ListItems(ii).ListSubItems(3); _                Tab(120); ListView1.ListItems(ii).ListSubItems(4)[/b]            Next        Printer.EndDoc


Thanks for your help !

Finding Listview Index By Text?
-The reason-
Okay, im making a program to query servers using winsock. I load a new winsock control for each connection (only 100 or so). Then, after the winsock sends/recieves i use the same winsock control to send a message and wait for a response from the server. After the first response, i add the address to my listview.

So, after that, i get my second query later on after it gets the first query from the original server. I want to add this item to the same row as the first item (they both have the same winsock.remotehost & port).

--Now to the question--
Is it possible to search for a key in the listview and get its index? so something like

lv1.findindex(server.remotehost & ":" & server.remoteport)

and it should return the index? Thanks

Retrive Index Of Item In Listview?
How the hell do i retrive the index of an Item in a listview control?!
Sometimes I just hate this cnotrol...its too complicated...

Anyone?

How Do I Update A Listview's Listitem At A Particular Index?
I have a listview populated with records. One of the listview headers is named 'status' and the default for that is 'not complete'. As the records are processed, I want to update the listview status field to 'Complete'. The header is index 10, but I'm stuck on how to find the row index.

Thanks.

ListView - Sorting: Does Index # Change
I have a ListView in my project which populates with with all zip files in a selected directory. The user can change the order (ascending/descending) on either column.
Q1...I wish to always have the first file in the list (when reordered) selected. I've tried:
lstMyListView.ListItems(0).Selected = True
but that doesn't work.
Q2...Even the item selected isn't always highlighted, why?

Change Index Of Selectitem In Listview
I have a listview in report mode with a number of items. Is there a way to dynamically change the index of the selectitem to a new index? Basically, I want to move an item up or down in the listview. For example, move the last item to the first position. Thanks

Listview Knowing The Selected Index(es)
I was using a listbox but due to the limit of the listbox. So I switched to ListView. However I can't find anything similar to what I was using for ListBox. There are two API calls that I used for ListBox that I want to use for ListView. I found one of the two API calls. Does anyone know the API call for the other one?

First API call I want is to know how many items were selected.
ListBox uses
numSelected = SendMessage(lstAll.hWnd, LB_GETSELCOUNT, 0&, ByVal 0&)

And the ListView uses
numSelected = SendMessage(ListView1.hWnd, LVM_GETSELECTEDCOUNT, 0&, ByVal 0&)

Now to know which items were selected.
ListBox uses
'dim an array large enough to hold the indexes of the selected items
ReDim sSelected(1 To numSelected) As Long
'pass the array so Sendmessage can fill it with the selected item indexes
Call SendMessage(lstAll.hWnd, LB_GETSELITEMS, numSelected, sSelected(1))
All you have to do is loop thru the sSelected array. A time saver.

I like to find the same one for ListView instead of looping thru the whole listview and testing if the ListView1.SelectedItem = True. The reason I can't loop thru it everytime is due to the number of items. There are over 40,000+ items. The user will scroll down the list and select them as they go. They can either double-click on the selected items or click on the Add to List command button. There is another listbox that displays the selected items. One listbox shows all the items while the other shows the selected ones. We don't expect the user to select over 32,000 items. But they still need to view the 40,000+ items and select them. It will eventually one day go beyond 100,000 items. (But I won't be around for that. )

Anyone know the API call for ListView selected items?

How To Get The Index Of Listview Columnheaders Dynamically
I have the AllowColumnReorder property set to true. So the user can reorder column headers. In that case how can I get the index value of a particular columnheader. It may not be in the same position everytime.

Thanks

Listview Problem: Index Out Of Bounds
I am trying to dynamically check/uncheck listview column headers through a menu bar. This is working only if go in a serial order. But if I do this in a random fashion, it pops up the message- index out of bounds. How can I take care of this? I need to use an array for the column headers. Also, the column headers must be in the same position when I check/uncheck them.

thanks
If mnuDate.Checked = true then
mnuDate.Checked = Not mnuDate.Checked
ListView1.ColumnHeaders.Remove 1
else
mnuDate.Checked = true
ListView1.ColumnHeaders.Add 1, , "date/time", 2400
End If

Stop Listview Selection
I am trying to stop the first row in a listview being selected when the form is first loaded.
I have tried using the

Code:
Listview1.SelectedItem = Nothing

in the Form_Activate and this doesn't work.
There is no other control on the form to set the focus to.

Any ideas or workarounds?

Stop Listview Flickering?
Hi folks,

I am having trouble in preventing flickering while adding items to a listview.

Please help!

Stop Drag In Listview
I found this code


Code:

' REQUIRES THE MSGHOOK.DLL LIBRARY

Const WM_NOTIFY = &H4E
Const LVN_FIRST = -100&
Const LVN_BEGINDRAG = (LVN_FIRST - 9)

Private Declare Sub CopyMemory Lib "kernel32" Alias "RtlMoveMemory" (dest As _
Any, source As Any, ByVal bytes As Long)

Private Type NMHDR
hwndFrom As Long
idFrom As Long
code As Long
End Type

Dim WithEvents FormHook As MsgHook

Private Sub Form_Load()
' start subclassing the current form
Set FormHook = New MsgHook
FormHook.StartSubclass Me

' fill the ListView1 control with data
' ... (omitted) ...
End Sub

' this event fires when the form is sent a message

Private Sub FormHook_BeforeMessage(uMsg As Long, wParam As Long, lParam As Long, _
retValue As Long, Cancel As Boolean)

' the ListView might be notifying something to its parent form
If uMsg = WM_NOTIFY Then
' copy the MNHDR structure pointed
' to by lParam to a local UDT
Dim nmh As NMHDR
CopyMemory nmh, ByVal lParam, Len(nmh)

' check whether the notification is from the ListView1 control
' and whether it's the beginning of a drag operation
If nmh.hwndFrom = ListView1.hWnd And nmh.code = LVN_BEGINDRAG Then
' yes, cancel this operation
retValue = 1
Cancel = True
End If
End If
End Sub




but I can't get it to work (I have a lisview on my form).

It craps out at:

Dim WithEvents FormHook As MsgHook

Any ideas?

Stop Listview Loading
Hi everyone!

I'm filling a listview with a lot of data. If the user gets tired, he can press a button "Cancel" which should stop the listview loading.

To do that, in the loading loop I put a flag which is continously read at every cycle, for example:

Code:
While count<MaxCount And GoOn

'fill listview
'...
count +=1
End while

' Routine for cancelling
Private sub OnBtnCancel_click (...)
    GoOn=False
end sub
 

However, while the listview is filling up, I cannot press any button because the UI is freezed. So the Cancel button is unuseful.
Usage of Listview.BeginUpdate and Listview.EndUpdate() is useless.

The only way I found to make this work is to have the listview filled by another thread... but this is of course illegal because one should have the UI thread which created the listview to handle it, and not another thread.

Does someone have an idea?

Thank you

Reorder Listview ColumnHeaders' Index At Runtime
How can I reorder the Listview ColumnHeaders by changing the index like Listbox does at runtime?

In the following example, I can have a set of companion buttons for listbox to move items up and down of the list by adding item and changing the item index.

Can I reposition the ColumnHeaders with the same approach as above? Having a set of companion buttons here is not really necessary as columnheaders can be reposition by drag and drop method.

'----------Sample code for listbox
Private Sub cmdUp_Click()
' only if the first item isn't the current one
If List1.ListIndex >= 0 Then
' add a duplicate item up in the listbox
List1.AddItem List1.Text, List1.ListIndex - 1
' make it the current item
List1.ListIndex = List1.ListIndex - 2
' delete the old occurrence of this item
List1.RemoveItem List1.ListIndex + 2
End If
End Sub

Private Sub cmdDown_Click()
' only if the last item isn't the current one
If List1.ListIndex <> -1 And List1.ListIndex < List1.ListCount - 1 Then
' add a duplicate item down in the listbox
List1.AddItem List1.Text, List1.ListIndex + 2
' make it the current item
List1.ListIndex = List1.ListIndex + 2
' delete the old occurrence of this item
List1.RemoveItem List1.ListIndex - 2
End If
End Sub


Private Sub List1_Click()
' enable/disable buttons when the current item changes
cmdUp.Enabled = (List1.ListIndex > 0)
cmdDown.Enabled = (List1.ListIndex <> -1 And List1.ListIndex < _
List1.ListCount - 1)
End Sub

Showing Array In Listview, Index Out Of Bound
here is the simple example of what I wanna do..

VB Code:
Private Sub Form_Load()Dim arrayhey() As StringReDim Preserve arrayhey(5)arrayhey(1) = "1"arrayhey(2) = "2"arrayhey(3) = "3"arrayhey(4) = "4"arrayhey(5) = "5" Dim RawBytes As StringDim xx As IntegerDim ii As IntegerDim i As Integer xx = 1ii = 1 ListView1.ListItems.Add , , "Number"For i = 0 To 1     For ii = ii To ii + 2            RawBytes = arrayhey(ii)        ListView1.ListItems(xx).ListSubItems.Add , , RawBytes    Next iixx = xx + 1Next i End Sub


actually the output i want is look like this:

Number | 1 | 2 | 3 |
Number | 4 | 5 | |

in a list view. But I got an run time error "356000" index out of bound.
I cant find out what is wrong with my code..
anybody please help ......

***RESOLVED***Index Out Of Bounds - ListView Control
I don't understand why the following returns an Out of Bounds error. I am using the ListView as a report and I don't see any properties of the control that I need to change. Searched the forum and didn't find anything that helps.
Code:
Public Sub ListView()

Dim j As MSComctlLib.ListItem
Dim Title As MSComctlLib.ColumnHeader

'Initialize ListView Control
For i = 1 To 8
ListView1.ColumnHeaders.Item(i).Width = ListView1.Width * (1 / 8)
Next i
End Sub
Thanks.

Setting Listview Item To An Index Number
Ive been using the following to set the selected item in my listview:


VB Code:
MatchFiles.SelectedItem = MatchFiles.ListItems(OldName)


which sets the current item equal to that contained in 'OldName'.

Is there a command similar to set the selected item to an index number? So i could set row 7 to selected? Thanks

Detecting Index Of Row When Right Clicking On ListView (RESOLVED)
How do i force the item to highlight when i right click on it? At present it is ot highlighting and the index i get returned isnt the row i clciked on. Thanks

Stop Movement Of Listview Icon
hello friends,

I add items (as Icons) and set the view to Icons. When I select and move
one of the items within the listview control, it appears to drag outside the
boundaries of the listview control and the vscroll and hscroll bars appear.
The problem is I want the items to remain aligned, not randomly spread
around. Also, this is a problem because my list view control is about 2
inches square. Can I keep the icon within the white space of the control
and can I keep everything aligned?

Stop ListView Column Header
Hi Everyone,

I am using an example from VBnet about subclassing and responding to notifications from the ListView Header.

http://vbnet.mvps.org/index.html?cod...ifications.htm

The question I am trying to figure out is this. How can I get a column header to stop resizing once it has gotten to a location to a certain location. For example, stop column 1 from resizing any smaller when pt.X = 20. I would appreciate any help.

Thanks.

Stop ListView Selection When Not Wanted
Wow... that's a tough topic. It's easier to explain than what it means in the subject.

I have a TreeView-ListView interfase. The problem I'm having is when I right-click over the ListView, e.g., show it's corresponding popupmenu, and select an option which would not open any new menu or something. E.g., change some values to variables, or change the apearance of the app. What happens is that the mouse (I don't know how to explain it) "keeps" on selection status, and would select all the items you hover the mouse over after this. Of course, this would end if you click anywhere or sth. But I want to avoid this "autoselection status". Does anybody know how to do it??

How To Stop First Colume Edit In A Listview
How do you stop first colume edit?

ListView - Stop Icons Moving
Hi,
I'm using a listview control in the Icon mode, to display a control panel for my application. The only problem is that when a user clicks an icon, when you move the mouse it moves the icon as well.

Is there any way to stop the user moving the icon?

Stop And Start A Service From A ListView
Hi

I want to be able to stop and start a service that is selected from a ListView, I've tried searching but cant find anything, does anyone have any ideas?

Thanks



LIVERPOOL FOOTBALL CLUB - 5 times Champions of Europe!! 1977, 1978, 1981, 1984, 2005

FA Cup Winners - 2006

Edited by - johneast on 3/15/2006 6:31:40 AM

Problem Transfering Listview Item To Textbox With Index
Hi all i got a listbox called listbox2 and it has some url on it. I want to transfer listbox item to a textbox once i click on listbox item .But when i try the follwoing with a textbox that it index property set to 0 i get error :


VB Code:
compile error: Invalid use of property


code:

VB Code:
Private Sub Command1_Click() txtURL2 = List2.Text ' put the value of listbox to textbox txturl End Sub



I tried the same method with textbox that its index property is empty and it worked fine but it does not work with textbox that its index property set to 0. I be happy if some one help me here.Thanks

Find Listview Subitem's Index By Clicking On The Column
Just wanna know if we can track or select a listview subitem's index by clicking the corresponding subitem in the list view

ex:

Name Age Sex Place

Andy 12 m LA
Brad 32 m NY
Kein 12 m TX
Andy 12 m TX

Suppose i clic on the second row , 3rd subitem = "NY", it should written the subitem index as 3.

Replies appreciated,
Thnx.

Index Of Newly Added Item In Sorted Listview
I need to find the index number of the item last added to a listview.
I can use listcount, except if the user clicks on the column header
and sorts the list, then the next item added could be listed in the
middle of the items already in the list. So .ListCount would not work
in that situation. So if I have a listview with items #1,#2,#3, and
I add an item which is placed in between #1 and #2, how can I find out it's spot in the list????

Any ideas or direction would be very helpful.

Copyright © 2005-08 www.BigResource.com, All rights reserved