hi, i cant do my codes on how a combo1(i) will do its command when clicked,

i have 10 combo box that have index from 1 to 10 on my form, when combo1(1) was clicked, it will do my command to that combo1(1) only not in combo1(2),combo1(3) ... to combo1(10)

example

when combo1(1) was clicked , it will show my age
when combo1(2) was clicked , it will show my name
when combo1(3) was clicked , it will show my address

Show the code for the event handler

you'll need to use if statements

on the click event put the following code:-

Private Sub Combo1_Click(Index As Integer)
If Index = 1 Then 
MsgBox "your age" 
Else If Index = 2 Then 
MsgBox "you name" 
Else If Index = 3 
Then MsgBox "you address" 
Else 
MsgBox "soemthing other"
End if
End Sub

i assume that you are familiar with combobox's events. And dont be confused in clicked , changed , gotfocus etc.
i also assume that you know when the chage event fires and when the click event fires.

if you wanna show age , name , sex by clicking only combobox not selecting their items from list then i think you'll have to write the to gotfocus() event otherwise write the code to click event.

hope this helps . . .

its ok now but my other problem was , when a combo1 text was change it will trigger to show the whole info in the label.

example

combo1 text = "" then become my name then
label 1 will become my name too

Without conditional code to decide when you want it to change, the change will always occur.

First off , not sure for what you asking .

but , if you change text by type to combobox then combo1_change() fires
just put

if index=1 Then
Label1.caption="show your age"
End if

further you can add more conditions using ElseIf.

if still having problems then try to define it in more clear way.

And finally , it will be very easy for us to provide any assistance if you provide what you did for that(i mean the code) ?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.