Making all listboxes display diff. fields of the same record.

Hi everyone at EE,

I have 3 datalist boxes. Each listbox will display a different field of the same table, each sorted alphabetically.

What I want is that when any selection is made from either of the 3 lists, the other 2 lists' corresponding record values should automatically get selected.
In this way, my adodc component is always pointing to a particular record.
hag1Asked:
Who is Participating?

Improve company productivity with a Business Account.Sign Up

x
 
SethiConnect With a Mentor Commented:
Private Sub Listbox1_Click()
  Listbox2.ListIndex=Listbox1.ListIndex
  Listbox3.ListIndex=Listbox1.ListIndex
End Sub

Private Sub Listbox2_Click()
  Listbox1.ListIndex=Listbox2.ListIndex
  Listbox3.ListIndex=Listbox2.ListIndex
End Sub

Private Sub Listbox3_Click()
  Listbox1.ListIndex=Listbox3.ListIndex
  Listbox2.ListIndex=Listbox3.ListIndex
End Sub
0
 
hag1Author Commented:
I am using a datalist which has no listindex property.
So instead of listindex, which property should I use?
0
 
ramesh12Commented:
C this URL
http://support.microsoft.com/?kbid=189682
and this
http://www.devx.com/vb2themax/Tip/18430
It seems there is a boundcolumn property. Just check these urls
0
Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

 
SethiCommented:
Check the SelectedIndex property
0
 
hag1Author Commented:
I couldnt find any selected index property.

Anyway if you think the code in the first comment by sethi for a listbox will perform what I need, then I dont mind going for a listbox.

To connect a listbox, I tried:
datasource=adodc
datafield=column name
But, I couldnt even get the listbox to display the values.
Am I suppose to set any other property of the listbox to make it display the data?
0
 
hag1Author Commented:
Could anyone explain a bit in detail as to what the bound column property mean?
0
 
SethiCommented:
That was a Typing mistake...it is selecteditem property. Sorry for all the confusion.
0
 
hag1Author Commented:
Sethi,

I used the selecteditem property and got the following error as soon as a selection was made in the datalist.

Run-time error 424. Object required.

During debug(when I moved my mouse over the selected statement), the LHS expression displayed 1 and RHS 2
0
 
SethiCommented:
hag1...I dont have access to VB for a few days as I am on holiday at the moment. So I am not in a position to test this at my end. Did you try the solution provided by ramesh12
0
 
hag1Author Commented:
I have viewed all the links provided by ramesh12 and I am not sure as to how exactly to use them in my case.
0
 
SethiCommented:
OK...I will go though them and tell youu in a few minutes.
0
 
hag1Author Commented:
ok, if I change to listbox, then what other properties apart from recordsource and datafield do I need to set?
0
 
hag1Author Commented:
Thanks Sethi for going through them inspite of being on a vacation.
0
 
SethiCommented:
OK, sleep time here. See ya tmr. Hope things will work out well for you
0
 
hag1Author Commented:
hi,
 you may take your own time to answer this question. I too was busy & couldnt reply, sorry for that.
Instead of the datalists, I simply used a databound grid.

But anyway, I would like to know how can I use datalists the way I imagined?
0
 
SethiCommented:
hag1, I wont be a great help on that becuase I dont use bound control at all.
0
 
hag1Author Commented:
Anyway, my aim in using 3 such lists was to make the program as user-friendly as possible. The user could have selected a particular recordset using any field he/she knew.


I think I will close the thread.

A big thanks.

hag1
0
 
SethiCommented:
Thanks for the points
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.