By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,101 Members | 1,387 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,101 IT Pros & Developers. It's quick & easy.

How to deactivate........

P: 22
Hai,,,, i forget d vb concepts... plz help me...n what my problem is i hav a 2 list boxes and hav some numbers on that list.. my need is i want to deactivate the number in the second list box which one is present in the first list box.... this wil be happen after i choosen the number in the first list box..... tel me...... plz...
Apr 2 '07 #1
Share this Question
Share on Google+
9 Replies


devonknows
100+
P: 137
Hai,,,, i forget d vb concepts... plz help me...n what my problem is i hav a 2 list boxes and hav some numbers on that list.. my need is i want to deactivate the number in the second list box which one is present in the first list box.... this wil be happen after i choosen the number in the first list box..... tel me...... plz...
Hmm you cant specifically deactivate specific items in a listbox well not without removing them but then you would have to renew the list afterwards something like this would be useful

Expand|Select|Wrap|Line Numbers
  1. Private Sub List1_Click()
  2.     If List1.Listindex = -1 Then Exit Sub 'Check To See If Anything Is Selected
  3.     List2.Enabled = True
  4.     Call List2_Click() 'Makes List2 Click on the selected item in case List1 item is changed
  5. End Sub
  6. Private Sub List2_Click()
  7.     If List2.ListIndex = -1 Then Exit Sub 'Check To See If Anything Is Selected
  8.     if List1.List(List1.ListIndex) = List2.List(List2.ListIndex) Then 
  9.         'If Both Selected items in List1 and List2 are the same then Exit the 
  10.         'Sub so that no other commands will run.
  11.         Exit Sub
  12.     Else
  13.         'Do you commands here
  14.         'other commands
  15.         'other commands
  16.     End If
  17. End Sub
  18.  
I believe something like that will help you with what you are looking, so basically it checks to see if there is anything selected if not stop the code, then it checks to see if list1 and list2 are the same then exit sub to stop the code from continuing else... well you put your commands there.

Kind Regards
Devon.
Apr 2 '07 #2

vijaydiwakar
100+
P: 579
Hai,,,, i forget d vb concepts... plz help me...n what my problem is i hav a 2 list boxes and hav some numbers on that list.. my need is i want to deactivate the number in the second list box which one is present in the first list box.... this wil be happen after i choosen the number in the first list box..... tel me...... plz...
u may use enable and /or locked property to do so
Apr 2 '07 #3

P: 22
Thank u
actually what is my need is i want to deactivate the number in the list2 box which one is selected by the user in list1 box....

i think """if List1.List(List1.ListIndex) = List2.List(List2.ListIndex) Then """ this one is help ful for me...... u gave it na.... k... after this, wht i want to give to deactivate the particular no in list2 box......
Apr 2 '07 #4

P: 22
Thank u

i knw i must want to use enable command..... but i studied vb 2 years back.... so slighly i forget the commands.... thats y i asked....
Apr 2 '07 #5

vijaydiwakar
100+
P: 579
Dear use replay button to let the person know
Apr 2 '07 #6

P: 22
sorry,,,, i have one doubt in your codings.....
u call list2_click() in list1_click(). And my need is after i select one number in list1 only same list 2 box no will go on to deactivate.... so please clarify my doubt.....
Apr 2 '07 #7

P: 22
sorry,,,,,, i m the new one to this... thats y..... k........
Dear use replay button to let the person know
Apr 2 '07 #8

vijaydiwakar
100+
P: 579
sorry,,,, i have one doubt in your codings.....
u call list2_click() in list1_click(). And my need is after i select one number in list1 only same list 2 box no will go on to deactivate.... so please clarify my doubt.....
see this is not my code but possibly might be
Apr 2 '07 #9

P: 22
see this is not my code but possibly might be
k thx.....
Apr 2 '07 #10

Post your reply

Sign in to post your reply or Sign up for a free account.