|
-
Apr 1st, 2004, 07:15 AM
#1
Thread Starter
Junior Member
listbox problems
hi there
i have three listboxes on my form
lstES, lstNES, lstGC
actually all the three listboxes are aligned one next to the other
The listboxes contains different subjects in each one of them
Actually when i am selecting an item in any one of the listboxes, i wish to have the selected index = -1 in the other two listboxes.
i have tried different codes, but i couldnt possibly make it out. Can anyone help me plz.
Thanks
-
Apr 1st, 2004, 07:47 AM
#2
Fanatic Member
write code in Validated event of all list boxes.
In 1st ListBox:
LB2.SelectedIndex =-1
LB3.SelectedIndex =-1
In 2nd ListBox:
LB1.SelectedIndex =-1
LB3.SelectedIndex =-1
In 3rd ListBox:
LB1.SelectedIndex =-1
LB2.SelectedIndex =-1
hope is helps
Regards
-
Apr 1st, 2004, 07:49 AM
#3
Thread Starter
Junior Member
in which event should i write them ? plz
thanks n regards
virusdude
-
Apr 1st, 2004, 07:51 AM
#4
Fanatic Member
i mentioned it. In "Validated" Event. Or maybe there's something like "IndexChanged"
-
Apr 1st, 2004, 11:53 PM
#5
Thread Starter
Junior Member
I tried it in almost all the events that i could possibly find as being a one that will make it work, but still i couldnt do it
Could anyone help plz.
i tried on validated, indexchanged, mousedown, mouseup but didnt work
Thanks
-
Apr 2nd, 2004, 01:52 AM
#6
Lively Member
halu,
i don't know if i understand the prob correctly but just as pvbangera mentioned, you have to specify for each event.
mousedown is working for this...
VB Code:
Private Sub ListBox1_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles ListBox1.MouseDown
ListBox2.SelectedIndex = -1
ListBox3.SelectedIndex = -1
TextBox1.Text = ListBox1.SelectedIndex
TextBox2.Text = ListBox2.SelectedIndex
TextBox3.Text = ListBox3.SelectedIndex
End Sub
Private Sub ListBox2_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles ListBox2.MouseDown
ListBox1.SelectedIndex = -1
ListBox3.SelectedIndex = -1
TextBox1.Text = ListBox1.SelectedIndex
TextBox2.Text = ListBox2.SelectedIndex
TextBox3.Text = ListBox3.SelectedIndex
End Sub
Private Sub ListBox3_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles ListBox3.MouseDown
ListBox1.SelectedIndex = -1
ListBox2.SelectedIndex = -1
TextBox1.Text = ListBox1.SelectedIndex
TextBox2.Text = ListBox2.SelectedIndex
TextBox3.Text = ListBox3.SelectedIndex
End Sub
i just put something like 3 textboxes to monitor their corresponding selected index values...
hope this helps... if not, sorry for bothers...
-
Apr 2nd, 2004, 03:43 AM
#7
Thread Starter
Junior Member
Thanks dude
it did work
THanks
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|