VB "CE" ComboBox question

On a Visual Basic "CE" form I have a ComboBox that contains some ID numbers.  What I want to happen is for the user to select an ID and have the other text boxes on the form be filled in.  But I can't figure out how to do this.  Currently the only way I can get the other text boxes to fill in, is to have the user click on one of the text boxes on the screen after selecting the ComboBox's ID.  I want to eliminate this second step.

The ComboBox's Click, Got_Focus and Lost_Focus events do not seem to be the appropriate events to incorporate the logic to fill in the rest of the text boxes.  (The ComboBox's ID field "ComboBox1.Text" does not seem to be resolved/filled in until after the Lost_Focus is done and another text box has the focus.)
eyoungAsked:
Who is Participating?
 
SiM99Connect With a Mentor Commented:
Thanx EYoung :)
no problem about the delay, just thought you might have given up though :|

"Currently the only way I can get the other text boxes to fill in, is to have the user click on one of the text boxes on the screen after selecting the ComboBox's ID.  I want to eliminate this second step."

Ok, so the user selects the item in the combo box, then you click on the textbox, giving it focus. This works, right ?

Why is this working ?
I assume you have the combobox and the text field on a form togethor, and that you have some code in either the textbox Click event or the GotFocus Event.
If this is so, then you can emulate the event in VB code...

Simply put this (or modify it 1st :) into the combo_click event:
(To emulate the Click event)
private sub Combo_Click(whatever is here)
    text1_click
end sub

(To emulate the GotFocus event)
private sub Combo_Click(whatever is here)
    text1.SetFocus
end sub

You say this will confuse the user ??
Why would that be ? They wont even notice the cursor going into the textbox (or is CE really slow ?)

SiM99
0
 
VbmasterCommented:
Why is the Click event not a "appropriate event"? Don't know about VB "CE" but in regular VB that would be a good place to add the code "textbox.Text = Combobox.Text" or "(textbox.Text = ComboBox.List(Combobox.Listindex))"..
0
 
eyoungAuthor Commented:
Vbmaster,

Good question.  I also would think the Click event would be the correct event to place the "textfield.text = ComboBox.text" code.

It appears that the ComboBox.text is null when the Click event is occuring.  At least in VB CE.

I have placed a MsgBox at the start of the Click event and at the end of the Click event to show the contents of the ComboBox.text and both times the ComboBox.text is null.

Because of that I have also tried using the Lost_Focus event and the same thing occurs.  

In regular VB, does the Click event contain the new value that has been clicked upon?

Any assistance would be appreciated.

Regards,
EYoung
0
The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

 
SiM99Commented:
You say that the user clicks on the textbox after selecting the list item, and the value updates.....

Why not just do this:

On the list_click event -
text1.text=list1.text
text1.setfocus
list1.setfocus
0
 
eyoungAuthor Commented:
SiM99,

The "List1.text" in the command "text1.text=list1.text" would result in List1.text containing a null.  Then setting focus to the text1 box then back to the list1 combobox I think would be confusing to the user.

What I want to have happen is when the user clicks on an item in the ComboBox, I want the text boxes on the form to be filled in.  I need the clicked value from the ComboBox in order to select the appropriate text box values.

I would appreciate any suggestions you may have.  

Thanks,
EYoung
0
 
SiM99Commented:
"Currently the only way I can get the other text boxes to fill in, is to have the user click on one of the text boxes on the screen after selecting the ComboBox's ID.  I want to eliminate this second step."

Ok, so the user selects the item in the combo box, then you click on the textbox, giving it focus. This works, right ?

Why is this working ?
I assume you have the combobox and the text field on a form togethor, and that you have some code in either the textbox Click event or the GotFocus Event.
If this is so, then you can emulate the event in VB code...

Simply put this (or modify it 1st :) into the combo_click event:
(To emulate the Click event)
private sub Combo_Click(whatever is here)
    text1_click
end sub

(To emulate the GotFocus event)
private sub Combo_Click(whatever is here)
    text1.SetFocus
end sub

You say this will confuse the user ??
Why would that be ? They wont even notice the cursor going into the textbox (or is CE really slow ?)

SiM99
0
 
eyoungAuthor Commented:
SiM99,

Sorry for the delay in getting back to you.  The project has been put on hold for a while so I will not be able to get an answer to your suggestions.

Please convert your comment to a proposed answer and I will accept the answer so you can get the points.

Happy Thanksgiving to you,
EYoung
0
All Courses

From novice to tech pro — start learning today.