![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Newbie
Join Date: Nov 2004
Posts: 6
Rep Power: 0
![]() |
Hi, what I would like to do is select a row across 5 listbox's that I have in order to delete it. I know how to select one entry in a listbox and delete that using:
If listbox1.SelectedIndex <> -1 Then listbox1.Items.RemoveAt(listbox1.SelectedIndex) End If I need it now to recognise what the index of the selected item is and then select the same index number in all listbox's so that the row is highlighted. Then I can delete it. Any help would be appreciated greatly |
|
|
|
|
|
#2 |
|
Programming Guru
![]() ![]() ![]() |
Could you assign the index of your first list box into an integer and then loop through your other list boxes and remove the same element at that position? Or will the values be in different positions in each list?
__________________
http://jasonpowers.net "There are a thousand hacking at the branches of evil to one who is striking at the root." |
|
|
|
|
|
#3 |
|
Newbie
Join Date: Nov 2004
Posts: 6
Rep Power: 0
![]() |
lol, yeh thats exactly what I have done. I used a variable as an integer and I can now select each item in the row 1 by 1 and delete it. My only problem is as soon I select one of the items in the row, I need all that row to highlight. Not have to select each item in turn.
I don't know what the code is to select (highlight) something in a listbox. I have been playing about with 'Select' but can't get anything to happen. If you or anyone knows then please put me out of my misery. |
|
|
|
|
|
#4 |
|
I eat cake for breakfast.
![]() ![]() ![]() ![]() Join Date: Jul 2004
Location: In my box.
Posts: 4,434
Rep Power: 8
![]() |
I did know... In VB6, I think you just had to change the ListIndex. Not sure about .NET though.
|
|
|
|
|
|
#5 |
|
Newbie
Join Date: Sep 2004
Location: South Africa, Eastern Cape
Posts: 28
Rep Power: 0
![]() |
What I did was create a listitem or something like that and assigned it to the item at index X. Where list.item(X) is the item you want. You then add this item to the selectedItems. Simple as that. Will go home and check the exact code for you if you need. Otherwise that is basically what you do.
__________________
Be vewwy vewwy quiet. I'm hunting wuntime ewwors. |
|
|
|
|
|
#6 |
|
Newbie
|
private sub listBox_selectedIndexChanged(sender as Object, evt as blahblah) handles listBox1.selectedIndexChanged, listBox2.selectedIndexChanged...
me.SelectIndeces(ctype(sender, ListBox).SelectedIndex) end sub private sub SelectIndeces(index as Integer) listBox2.selectedIndex = idx listBox3.selectedIndex = idx ... end sub easy, isn't it
__________________
Try ProjectTracking.NET tool, complete online project tracking solution. ProjectTracking.NET is designed to simplify development and management of small and medium sized projects for dislocated teams. Read more about Project Tracking here: http://www.ilumnis.com/Products/ProjectTracking.aspx |
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|