Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Nov 30th, 2004, 5:30 AM   #1
masanovic
Newbie
 
Join Date: Nov 2004
Posts: 6
Rep Power: 0 masanovic is on a distinguished road
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
masanovic is offline   Reply With Quote
Old Nov 30th, 2004, 9:22 AM   #2
Infinite Recursion
Programming Guru
 
Infinite Recursion's Avatar
 
Join Date: Jul 2004
Location: United States
Posts: 3,467
Rep Power: 8 Infinite Recursion is on a distinguished road
Send a message via MSN to Infinite Recursion Send a message via Yahoo to Infinite Recursion
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."
Infinite Recursion is offline   Reply With Quote
Old Nov 30th, 2004, 9:28 AM   #3
masanovic
Newbie
 
Join Date: Nov 2004
Posts: 6
Rep Power: 0 masanovic is on a distinguished road
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.
masanovic is offline   Reply With Quote
Old Nov 30th, 2004, 12:46 PM   #4
Ooble
I eat cake for breakfast.
 
Ooble's Avatar
 
Join Date: Jul 2004
Location: In my box.
Posts: 4,434
Rep Power: 9 Ooble is on a distinguished road
I did know... In VB6, I think you just had to change the ListIndex. Not sure about .NET though.
__________________
Me :: You :: Them
Ooble is offline   Reply With Quote
Old Dec 13th, 2004, 1:47 AM   #5
Xyler
Newbie
 
Join Date: Sep 2004
Location: South Africa, Eastern Cape
Posts: 28
Rep Power: 0 Xyler is on a distinguished road
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.
Xyler is offline   Reply With Quote
Old Dec 16th, 2004, 5:07 AM   #6
bunker
Newbie
 
Join Date: Dec 2004
Location: Serbia
Posts: 4
Rep Power: 0 bunker is on a distinguished road
Send a message via ICQ to bunker
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
bunker is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 7:14 PM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC