Saturday, January 16, 2010

Needs help regarding Listview Control in VB.NET ... PLZ help Hurry ...?

I have a ListView control in my form ... which contains 4 columns and various no of rows ...


I've 4 textboxes on above of this list ... Now I have my list populated with some records and


I wants to add all 4 columns of one record in textboxes .. whenever I clicks the record in listview ...


Each time the record should be changed in the text box .. when I click the new record in ListView....





I've tried this .. but It is not working ....








txtZoneName.Text = lvZoneDetails.SelectedItems(0).SubItems(鈥?br>




txtZoneServerIP.Text = lvZoneDetails.SelectedItems(0).SubItems(鈥?br>




txtZoneServerPort.Text = lvZoneDetails.SelectedItems(0).SubItems(鈥?br>




txtClientPort.Text = lvZoneDetails.SelectedItems(0).SubItems(鈥?br>







using this code ... when i first click any record .. it gets populated ... but when I click another record .. It just gives error .. and form get closed ....





Plz help me to sort out this problem . ...


Thanks in advance ....Needs help regarding Listview Control in VB.NET ... PLZ help Hurry ...?
The ListView object is a container for ListViewItem objects.





When you need to read a specific item after the original list has been created you need to assign a given line in the list view to a listviewitem variable. This variable will then expose the properties of teh item such as text.





Here is an excerpt of some of my code where I wanted to log the items shown in a list view. The technique will be similar for you, where you can use the LVI to change the text then save the updated LVI to the Listview control








Dim lvi As ListViewItem





max = Me.ListView1.Items.Count





For idx = 0 To max - 1





lvi = Me.ListView1.Items.Item(idx)


str = lvi.Text 'extract string from list view item


fts.WriteLine(str)


Next

No comments:

Post a Comment