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




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




View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
Click Item In Listview Then Show That Item In Combo As Index = 0
Hi guys,

I have a listview (lvwUserPunchedOut) that is populated with records in a database (persons first name in one column and last name in the second column), what I am looking to do is if I select a persons name by clicking on it in the listview on frmMain, and then bring up frmSearchCriteria, i would like to show that selected name in the combobox as default (cboEmployee.ListIndex = 0) on frmSearchCriteria (the combobox is sorted = True and is also populated with first name and last name of the person)

How would this be done? Hope I make sense. Thanks in advance.

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?

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

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.

Get DragDrop Items.Index Or Item(Name) On ListView With Scrollbar?
Hiya's folks

Here's my bug
Code:
Private Sub lstView1_OLEDragDrop(Data As MSComctlLib.DataObject, Effect As Long, _
Button As Integer, Shift As Integer, X As Single, Y As Single)

    myIndexItem = lstView1.ListItems.Item(Int(Y / 17) + 1)

End Sub


I'm using this statement to get the item name, but when the V-scrollbar is scrolled down...
I can't get the good item since I'm using the Y parameter
Any idea how to get the index of the first item displayed in listview when
the scrollbar is scrolled?
Or is there a way to get the "visual" name of the item I drag on?

Thx!!

Scroll A Textbox With Selected Item In Listview
Hi all,

I have a listview control in a project I'm working on. I have added a textbox, for editing the content of the cell, that appears overtop of the selected item the way I want it to. Everything works great except that when the user scrolls the textbox stays where it originally appears and doesn't scroll with the selected item.

How can I get the textbox to scroll with the selected item. Any help would be greatly appreciated.

swifty1

Copy Selected Item In Listview To Textbox? *RESOLVED*
hi

im wondering is it possible to copy the selected item in a listview to a text box (just the selected item's initial coloum)?

also, sorry about the number of posts (only 2, but might grow), im trying to get my head around a project and im running into problems

Listview Clink Item From Column1 And Post Value Of Column2 To Textbox
OK I hope some one can help me here-basically i have a listview with 2 colums-in which i call the favorites folder-in first column there is the link name-in the second column there is the full link-then i have add a combo box that when the link name is clicked i want the full url to to go-I am verey close to doing this i think but hwere i am stumped is when i click on the link name the link name goes in combo2 box when i want the full url that is in column 2?
ne ideas? do i just need to replace Item with?



 Code: Private Sub ListView1_ItemClick(ByVal Item As MSComctlLib.ListItem)
 
                 Combo2.Text = Item



Code: Option Explicit



Private Sub Command2_Click()
Form1.WebBrowser1.Navigate Combo2.Text
End Sub

Private Sub Form_Load()

   With ListView1
   
      .ColumnHeaders.Add 1, , "Link Name"
      .ColumnHeaders(1).Width = (ListView1.Width 2) - 200
      
      .ColumnHeaders.Add 2, , "URL"
      .ColumnHeaders(2).Width = (ListView1.Width 2) - 200
   
      .View = lvwReport
      
   End With
   
End Sub


Private Sub ListView1_ColumnClick(ByVal ColumnHeader As MSComctlLib.ColumnHeader)

  'toggle the sort order based on the column clicked
   ListView1.SortKey = ColumnHeader.Index - 1
   ListView1.SortOrder = Abs(ListView1.SortOrder = 0)
   ListView1.Sorted = True
   
End Sub


Private Function SearchForFiles(FP As FILE_PARAMS) As Double

  'local working variables
   Dim WFD As WIN32_FIND_DATA
   Dim hFile As Long
   Dim nSize As Long
   Dim sPath As String
   Dim sRoot As String
   Dim sTmp As String
      
   sRoot = QualifyPath(FP.sFileRoot)
   sPath = sRoot & "*.*"
   
  'obtain handle to the first match
   hFile = FindFirstFile(sPath, WFD)
   
  'if valid ...
   If hFile <> INVALID_HANDLE_VALUE Then
   
     'This is where the method obtains the file
     'list and data for the folder passed.
      Call GetFileInformation(FP)

      Do
      
        'if the returned item is a folder...
         If (WFD.dwFileAttributes And FILE_ATTRIBUTE_DIRECTORY) Then
            
           '..and the Recurse flag was specified
            If FP.bRecurse Then
            
              'remove trailing nulls
               sTmp = TrimNull(WFD.cFileName)
               
              'and if the folder is not the default
              'self and parent folders...
               If sTmp <> "." And sTmp <> ".." Then
               
                 '..then the item is a real folder, which
                 'may contain other sub folders, so assign
                 'the new folder name to FP.sFileRoot and
                 'recursively call this function again with
                 'the amended information.
                  FP.sFileRoot = sRoot & sTmp
                  Call SearchForFiles(FP)
                  
               End If
               
            End If
            
         End If
         
     'continue looping until FindNextFile returns
     '0 (no more matches)
      Loop While FindNextFile(hFile, WFD)
      
     'close the find handle
      hFile = FindClose(hFile)
   
   End If
   
End Function


Public Function TrimNull(startstr As String) As String

  'returns the string up to the first
  'null, if present, or the passed string
   Dim pos As Integer
   
   pos = InStr(startstr, Chr$(0))
   
   If pos Then
      TrimNull = Left$(startstr, pos - 1)
      Exit Function
   End If
  
   TrimNull = startstr
  
End Function


Private Function GetFileInformation(FP As FILE_PARAMS) As Long

  'local working variables
   Dim WFD As WIN32_FIND_DATA
   Dim hFile As Long
   Dim pos As Long
   Dim sPath As String
   Dim sRoot As String
   Dim sTmp As String
   Dim sURL As String
   Dim sShortcut As String
   Dim itmX As ListItem
      
  'FP.sFileRoot (assigned to sRoot) contains
  'the path to search.
  '
  'FP.sFileNameExt (assigned to sPath) contains
  'the full path and filespec.
   sRoot = QualifyPath(FP.sFileRoot)
   sPath = sRoot & FP.sFileNameExt
   
  'obtain handle to the first filespec match
   hFile = FindFirstFile(sPath, WFD)
   
  'if valid ...
   If hFile <> INVALID_HANDLE_VALUE Then

      Do
      
        'remove trailing nulls
         sTmp = TrimNull(WFD.cFileName)
         
        'Even though this routine uses filespecs,
        '*.* is still valid and will cause the search
        'to return folders as well as files, so a
        'check against folders is still required.
         If Not (WFD.dwFileAttributes And FILE_ATTRIBUTE_DIRECTORY) _
            = FILE_ATTRIBUTE_DIRECTORY Then
           
           'determine the link name by removing
           'the .url extension
            pos = InStr(sTmp, ".url")
            
            If pos > 0 Then
            
               sShortcut = Left$(sTmp, pos - 1)
           
              'extract the URL
               sURL = ProfileGetItem("InternetShortcut", "URL", "", sRoot & sTmp)
            
              'add to the listview
               Set itmX = ListView1.ListItems.Add(, , sShortcut)
               itmX.SubItems(1) = sURL
         
            End If
            
         End If
         
      Loop While FindNextFile(hFile, WFD)
      
     'close the handle
      hFile = FindClose(hFile)
   
   End If
   
End Function


Private Function QualifyPath(sPath As String) As String

  'assures that a passed path ends in a slash
   If Right$(sPath, 1) <> "" Then
         QualifyPath = sPath & ""
   Else: QualifyPath = sPath
   End If
      
End Function


Private Sub Command1_Click()

   Dim FP As FILE_PARAMS
   Dim favPath As String
   
  'retrieve the special folder path
  'to the internet Favourites
   favPath = GetFolderPath(CSIDL_FAVORITES)
   
   If Len(favPath) > 0 Then
   
     'set up the search UDT
      With FP
         .sFileRoot = favPath
         .sFileNameExt = "*.url"
         .bRecurse = True
      End With
      
     'get the files
      Call SearchForFiles(FP)

   End If
   
End Sub


Private Function GetFolderPath(CSIDL As Long) As String

   Dim sPath As String
   Dim sTmp As String
  
  'fill pidl with the specified folder item
   sPath = Space$(MAX_LENGTH)
   
   If SHGetFolderPath(Me.hWnd, CSIDL, 0&, SHGFP_TYPE_CURRENT, sPath) = S_OK Then
       sTmp = Left$(sPath, InStr(sPath, Chr$(0)) - 1)
   End If
   
   GetFolderPath = sTmp
   
End Function


Public Function ProfileGetItem(lpSectionName As String, _
                               lpKeyName As String, _
                               defaultValue As String, _
                               inifile As String) As String

  'Retrieves a value from an ini file corresponding
  'to the section and key name passed.
   Dim success As Long
   Dim nSize As Long
   Dim ret As String
  
  'call the API with the parameters passed.
  'The return value is the length of the string
  'in ret, including the terminating null. If a
  'default value was passed, and the section or
  'key name are not in the file, that value is
  'returned. If no default value was passed (""),
  'then success will = 0 if not found.

  'Pad a string large enough to hold the data.
   ret = Space$(2048)
   nSize = Len(ret)
   success = GetPrivateProfileString(lpSectionName, lpKeyName, _
                                     defaultValue, ret, nSize, inifile)
   
   If success Then
      ProfileGetItem = Left$(ret, success)
   End If
   
End Function
'--end block--'

Private Sub CancelButton_Click()
Unload Dialog
End Sub


Private Sub ListView1_ItemClick(ByVal Item As MSComctlLib.ListItem)
 
Combo2.Text = Item
End Sub

Get The Item Index
I have a UserControl that uses two classes the individual class and a collection class, how I can implement into the Individual class to get te Index number into the collection class ???

like ListItem and ListItems

Example:


Dim LstItem as ListItem

Set LstItem = ListView1.ListItems(1)

'I want this
Msgbox LstItem.Index

'This prints 1


Thanks !!

Tab Index To Get To Next Item
I have set up the tabindex on my form to go to the correct place when the tab button is pressed. I need it to select the text in the text box when the tab button is pressed. Right now it goes to the begining of the text box but does not select the information in the text box. Any ideas would be appreciated.

Making Textbox Text Bold During Runtime While Transfering To Datareport
I have text box in form and datareport and
my scenario is,
1.I have a textbox in a form and textbox in a datareport
2.I typed some text in the text box
3.When i click a command button the content of the text box moves to datareport textbox
4.In this, I want the particular word in the text should be bold while displaying in the datareport textbox, since the Bold word is the heading in the data report textbox.
5. Changing the datareport textbox font to bold during design time will result all the text in the textbox to bold.But i need only the particular word bold it may done only during runtime i think.

Cannot Get Index Of Item In Combo
i have added each printer on the system to a combo box:

for each prn in printers
cboPrinter.additem prn.devicename
next

then set the first item to be systems default printer:

cboPrinter.Text = Printer.DeviceName

When i click a button to get the index of the item in the dropdown box:
For i = 0 To cboPrinter.ListCount - 1
MsgBox cboPrinter.List(i) & cboPrinter.ListIndex
Next

it says the listindex for each item is -1. Shouldn't it be 1 to how many printers there are in the list ie:

printer 1 = index 1
printer 2 = index 2

etc?

Or is that method of setting the default printer wrong and interfering?

thanks for your time.

Recieving Item By Index
hi,

with this piece of code im trying to receive a certain record by stating the ID in the table.

i have a variable which stores the ID, intStaffID. but im not sure where to place it in the following code.

this is on the click event of an mshflexgrid. it stored the ID, then i want it to select the staff record with that ID...


Code:
If Not IsNull(myRecSet.Fields("shiftstartMon").Value) Then 'Validation for null value
strGetMonStart = myRecSet.Fields.Item("ShiftStartMon").Value 'Get data from field
txtShiftStartMon.Text = strGetMonStart 'Insert data to textbox
Else
txtShiftStartMon.Text = "No Shift" 'Insert "No Shift" If value = Null
End If

thanks,

sam

Index Of Selected Item
Anybody out there know a quick way for me to find out the index of a selected item within a listview?

I know I could loop through it easy enough to find the index but is there another way of doing it?

Api To Get The Index Of An Item In A ComboBox
Hi,

Is there any APi that give us the index of comboBox item? For instance, I would say the item as a tring and then the APi would tell me is index in the combo?

PS: I need this to get the index of a itemdata.

Thank you

Sergio Oliveira

How To Get The Item Index In Wmp.dll Control
hi, please if somebody can tell me how can i get the item index of a media item in a playlist in this control (wmpsdk 10 or 9)

i want to know the item index of the current media playing (maybe the same media is twice or more in a playlist in diferent position (index), so i can use isidentical)

thank you

Please Help - Error 457 - Index Already Associated With This Item.
Simple form used to input 2 strings (key & value), to be stored in Dictionary (dictLocations)which is instantiated in Module1. Works fine until user clicks yes in message box, then get Error 457 (duplicate key)???

Thanks for anyone's help!


private Sub cmdOK_Click()
Dim key as string, val as string
dictLocations.Add tbLocNo, tbLocDesc
If MsgBox("Add Another Location?", vbYesNo) = vbYes then

me.Hide
tbLocNo = ""
tbLocDesc = ""
me.Show

else

me.Hide
End If
Unload.me
End Sub

Getting The Index Of A Collection Item.
Is it possible to get the Index of a collection item if you know the key it was added under?

example:

dim Mycol as new collection
Mycol.Add "keyboard","bob"
Mycol.Add "monitor","peter"
Mycol.Add "desk","joe"

I want to know that "monitor" is the second item in the list by using the key "peter" can this be done?

Jean-Guy

Getting Item Data Index With Listbox Value
I'm trying to get the itemdata int value from a listbox using the listbox text value. For example:

populate the listbox using a query:
rst = select id, value from table

While (Not (rs.EOF))
lstbox.AddItem rst!value
lstbox.ItemData(lstbox.ListCount - 1) = rst![id]
rstSiteID.MoveNext
Wend

So what i want to do is get the "id" value from a selected
"value" in a listbox.

Any help would be appreciated.

&gt;&gt; How To Determinate The Index Of An Item In Array
Hi! I have 2 arrays called "id()" and "name()" and when I assign a string value to the name array, I assign also an id.
so... i want to get the index by specifing the item in the "name" array like this:

1st item= "a" index = 0
2nd item = "b" index = 1

and if i want a function that determinate the index of an item by specifing the text in this case


thanks


simons

Remove Item Index Number 1
Hello, I am making a list of people that connect to the chat room of there IP in a list called listPeople. But i want to remove the ip when they disconnect. I know the code is something like this, but can you help me get it right?

listPeople.removeitem(UserIP, [1])

UserIP being a String of thier remoteIP
and
1 being the index

also will the same code work with listpeople.additem?

Thanks in advance/.

Using The Index Number Of An Item In An Array
Another easy one (sorry!) :-)

I am trying to use the number of the items in my array so that, say:

If ArrayOne (Item number is 1 or 2 of array) Then

Do this

If ArrayOne (Item number is 3 or 4 of array) Then

Do this

Etc...

Is it possible?
Thanks for reading, Chloe x

Calling An Item By Its Index In A Type
Let's say I have a Type like this:


VB Code:
Public Type userinfo()Name As StringPassword As StringEnd Type


Now, if I want to access the item "Name", I need to say

VB Code:
Dim i As userinfoMsgbox i.Name

Can't I access an item by its position or index like this:

VB Code:
Dim i As userinfoMsgbox i.Index(0)'The above code is not right but it gives you the idea.  

?

Locate Index Of Certain List Item?
Hi,

I have a list box with the text values of:

A
B
C

How can I quickly find the index number of B?

Thanks,

Dan

Index Of Selected List Item
I have a combo box, style 1, where users can enter items into the list by typing it then hitting enter. I want the user to be able to select one of the list items already entered and be able to delete it by pressing the delete key.
How can I delete the selected record?

Selecting An Item From A DataCombo Using The Index ID
Good morning all.  I have a DataCombo control (not to be confused with ComboBox) which is populated with data.  I am wondering how I can display the Description (ListField) text by referencing the Index ID (BoundColumn) i.e.

I have three entries in the DataCombo
0. Red
1. Green
2. Blue

I want to reference which is to be shown by the number, but I want the string to be displayed.

How I Could Get The Index Adding An Item To A List?
The solution could be this :
List1.AddItem ("" , Index)
but, it does not work!!!
First i have a compiler error (expected = )...
Num = List1.AddItem ("" , Index) Solves the problem, but if index is diferent than 0 this doesnot work.

I want to create a dinamic list of errors and capture his identification.
How i could do this?

Index Of Last Item Added To A Combo Box
I know there's a way to read the index of the last item added to a combo box. Does anyone remember?

thanx/good luck,
adam

Transfering Item From One Listbox To Anotehr Listbox On Click
Hi all i got 2 listbox . I want to be able to click on my first listbox items and once i click on them it transfers to the second listbox. Could any one tell me how that can be done.Thanks

How To Delete A LisBox Item Withou Use The Index?
Hi VB programers:

I'd like to know how to delete a listbox item without use the item index?

-------------------
Ex:

ExtSpa.RemoveItem (Var ?)

---------------------

Thank you.

Get Index Number Of Selected Item Combobox
I want to get the index value of the selected item in a combobox.

dim i as int
i = combo1.index (this doesn't work, duh)

i cant think of a way? (stupid )
ty

How Can We Know The Index Of An Item Data Value In A DropDownList Combo In VB6
I would like to receive help on the following described issue.

In my form I have a dropdown list combobox, which is populated with 'additem' and 'Itemdata' methods. during program execution, I know only a particular value stored in the itemdata. I dont know index and listed values.
I want to get the index corresponding to the Itemdata Value. How can i get that?

Thanking everybody,
sreeraj

Find An Item Index In A Collection Without Looping?
Is it possible to find the index of an item in a collection by its text without looping?

Finding The Index Of An Item In An Array (Resolved)
Hi,

Is it possible to select an item in an array by sending the index number to it. I am wondering if this can be to automatically without having to type the index number in?

TIA

Nightwalker

Finding The Index Of A Control Array Item
Hey im really new with VB,

I have a control array in my project and i need to find out which element in the array the user clicked on.

Just to clarify, say theres 5 elements in the array

option(1), option(2), option(3), option(4), option (5)

when the user clicks on any of these i need to assign the number in the index, (1,2,3,4 or 5) to a variable. Thanks a lot!

List Box Q, Remove An Item, By Value Not Index? *solved*
Is there an easy method to remove an item from a list box, if there is more then say, one item in the list for a particular Value etc?

Say i have a list:

Wayne
Joe
Fred
Bob
Fred


And my server sends the message to the client "Remove Fred", (I have this bit working ),
How can i remove both "Fred"'s without knowing their ListIndex's?

Tnx

Determine Item Index During A Mouseover In Listbox..
:hello, how do i get the item index of listbox where the mouse is pointing?

Get Handle On File Via Numeric (item) Index
Hi there,

First time poster...

I'm using VBA in Office 2003 Excel and am trying to get a handle on a file via a numeric index. Basically i have a folder containing some 527 files and need to loop thru them all and process them.

so I am trying to do something like this but it's not working - anyone know what i'm doing wrong?

Set fs = CreateObject("Scripting.FileSystemObject")

Set f4 = fs.getfolder(Path_str).files.Item(1) <== fails




I have previously tried a for...each loop without success - the loop exits unexpectedly after processing the 132nd item. Have attempted processing the item in question using a smaller set of data (ie when the folder only contained 5 items, the item in question was in the middle of the 5 files) and the macro was able to process and continue to the next item successfully. So believe that it's not related to the content of the file itself.

Is there some kind of limit to the number of items a variable can hold in VBA? When I step thru the code, the loop dies as soon as I try to step thru the "Next f3" statement.

Here's my code, if anyone can spot what might be causing the issue then please let me know:

    Dim fs, f, f1, f2, f3, fc, fd, fe As Object

    [...snip...]

    Set fs = CreateObject("Scripting.FileSystemObject")
    Set f = fs.getfolder(QARunEnvPath_str)
    Set fc = f.subfolders

    [...snip...]

    '
    ' Get a handle on Business Function subfolders and start loop
    '
    For Each f1 In fc

             '
             ' Create a copy of the Test Data Folder using the DIR suffix string
             '
             NewFldr_str = f1.Path & cDIR_SUFFIX
             fs.Copyfolder f1.Path, NewFldr_str

             '
             ' Get handle on files within new folder, then start looping thru those
             '
             Set f4 = fs.getfolder(NewFldr_str)
             Set fe = f4.Files
             
             For Each f3 In fe
                                        
                 [Do stuff....]

             Next f3 ' Next File


Thanks in advance

Selecting An Item In Treeview Control, Without Knowing Its Index.
How would you accomplish this?

I have a treeview control and a listview control.. I render files and folders from the harddrive, the problem is when I put the folders/subfolders in the listview control, and the user doubleclicks on it, I want the treeview control to automaticly select the folder/subfolder.

The best would be if you could set the selecteditem of the treeview control to a certain key value, instead of the index value.

A way to accomplish what I want would be to use a FOR-loop:
For i = 1 to treeview.nodes.count
if treeview.nodes.item(i).key = sKey then
set treeview.selecteditem = treeview.nodes.items(i)
next i

but wouldn´t this be very slow when there are maybee 5000 items in the treeview control?

Any suggestions?
Thanks.

Determining The Index Number Of A Selected Item In List Box
Hi! I would just like to ask how can I determine the index number of a selected item in a list box?

ex.

list box items

june
july <---how would I know its index no. in the listbox after I selected it?
august

Thanks in advance!

String Index/listbox Item Search [fixed]
hey...

I have a listbox with some items in it, where i have added (O) infront on some items.... what i want is, to remove (O) again from the item, i tryed coping it into a string, but then i forgot how i check the first 3 letters of the string...

can someone help plz ?

Take care and have fun

Garn

Right Click To Return Index And Select ListBox Item.
How can I make a right mouse click return the ListIndex and select a ListBox item?

Below code doesn't won't return the ListIndex.

Code:If Button = vbRightButton Then
        MsgBox "Item Index " & List1(Index).ListIndex & " " & "List Index " & Index
End If
Thanks!

ddutke

Moving A Listview Item And Its Subitems To A New Listview
Hey Guys,

Having a bit of trouble. I am attemping to move a selected item and its subitems from one listview to another. I have no problem getting the contents of the first column, but I can't seem to get the subitems over.

Example: I have this in the first listview:

Code:
|Item |Quanity|Price |PQ |
Bananas 2 $.50 $1.00

Then when I try to move that whole row to the other listview I can only seem to get this:

Code:
|Item |Quanity|Price |PQ |
Bananas

No subitems . Any links or help would be appreciated.

Regards,

Max_Power

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

How To Add Textbox With Index
I have one text box.. How I can do so that my textbox have equal with number of interval ?I have one textbox.. How I can add 2 text box to be equal with the number of my combo box "cboCB(0)."

Code:

Dim range As Double
Dim i, numClasses, numBreaks As Integer

If Trim(cboCB(0).Text) = vbNullString Then
cboCB(0).ListIndex = 0
End If

Set stats = recs.CalculateStatistics(cboCB(0).Text)
numClasses = cboCB(1).Text
numBreaks = numClasses - 1

If picCBlegend.Count > 1 Then
For i = (picCBlegend.Count - 1) To 1 Step -1
Unload picCBlegend(i)
Unload lblCBlegend(i)
Next
End If

Set cbr = New MapObjects2.ClassBreaksRenderer
cbr.Field = cboCB(0).Text

cbr.BreakCount = numBreaks
range = stats.Max - stats.Min
For i = 0 To numBreaks - 1
cbr.Break(i) = stats.Min + ((range / numClasses) * (i + 1))
Text1.Text = stats.Min + ((range / numClasses) * (i + 1))
Next

cbr.RampColors picCBramp(0).BackColor, picCBramp(1).BackColor

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