Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ComboBox setting Focus after Mouse Click 1

Status
Not open for further replies.

MaxRaceSoftware

Programmer
Jun 10, 2002
36
US
how can i set Focus to a TextBox Control
after clicking on a selection in a ComboBox

MaxRace Software - Larry Meaux
ET_Analyst for DragRacers
Support Israel - Genesis 12:3
 
Private Sub Combo1_Click()
Text1.SetFocus
End Sub [/b][/i][/u][sub]*******************************************************
General remarks:
If this post contains any suggestions for the use or distribution of code, components or files of any sort, it is still your responsibility to assure that you have the proper license and distribution rights to do so!
 
CCLINT (Programmer) , thats the 1st thing i tried,


but , i get an Error message , when running that code

Private Sub Combo1_Click()
Text1.SetFocus
End Sub


"Invalid proceedure call or argument"


MaxRace Software - Larry Meaux
ET_Analyst for DragRacers
Support Israel - Genesis 12:3
 
CCLINT ;

this works with KeyDown , but i'm looking for a way to accomplish the same effect when the User uses a Mouse-Click on the ComboBox ...any other ideas or tips ??

Private Sub Combo1_KeyDown(Index As Integer, KeyCode As Integer, Shift As Integer)

Select Case KeyCode
Case vbKeyEscape
Select Case Index
Case 0
Text1(28).SetFocus
Case 1
Text1(6).SetFocus
Case 2
Text1(7).SetFocus
Case 3
Text1(10).SetFocus
End Select

Case vbKeyReturn
Select Case Index
Case 0
Text1(0).SetFocus
Case 1
Text1(7).SetFocus
Case 2
Text1(8).SetFocus
Case 3
Text1(11).SetFocus
End Select
End Select


End Sub MaxRace Software - Larry Meaux
ET_Analyst for DragRacers
Support Israel - Genesis 12:3
 
Private Sub Combo1_Click(Index As Integer)
Text1(0).SetFocus
End Sub

What combo contol are you actually using (VB ComboBox, VB DataCombo or FM20 ComboBox?
[/b][/i][/u][sub]*******************************************************
General remarks:
If this post contains any suggestions for the use or distribution of code, components or files of any sort, it is still your responsibility to assure that you have the proper license and distribution rights to do so!
 
CCLINT , thats what i tried too , but get an error message
and its a regular VB6.0 ComboBox control

heres the actual code along with your suggestion, but doesn't work



Private Sub Combo1_Click(Index As Integer)

Select Case Index
Case 0
Text1_HelpLine = "Select the Body Type that best matches your Race Car .... then tryout Entering 100.00 % PerCent Aerodynamic Efficiency as a Baseline"
Text1(0).SetFocus '<---Doesn't work ???????
Case 1
Text1_HelpLine = &quot;Valid Range= 1, 2, 4, 6, 8, 10, 12 Engine Cylinders&quot;
Case 2
Text1_HelpLine = &quot;Valid Range= 100, 200, 300, 400, 450, 600 Rpm/Second or Choose Steady-State , non-acceleration Dyno test&quot;
Case 3
If Combo1(3).ListIndex = 0 Then
Label1(23).Caption = &quot;Converter Stall RPM&quot;
Text1(17) = &quot;92.0&quot;
Else
Label1(23).Caption = &quot;Clutch LockUp RPM&quot;
Text1(17) = &quot;100.0&quot;
End If

Text1_HelpLine = &quot;Valid Range= Choose either an Automatic Transmission with Torque Converter or Manual Transmission with Clutch&quot;

Case 4
Select Case Combo1(4).ListIndex
Case 0
Text1(29) = ETA_SumRollOut
Case 1
Text1(29) = ETA_Sum330
Case 2
Text1(29) = ETA_Sum660
Case 3
Text1(29) = ETA_Sum1000
Case 4
Text1(29) = ETA_Sum1320
End Select
End Select

End Sub

MaxRace Software - Larry Meaux
ET_Analyst for DragRacers
Support Israel - Genesis 12:3
 

Are you still getting the same error?

&quot;Invalid proceedure call or argument&quot;

Or is the focus just not getting set?

You will get the error if the text box is not visible at the time of setting the focus.

Possible, the click event is being executed when the form is loaded, because you are setting some default value. I don't know.
So, try:

If text1(0).Visible and text1(0).Enabled then text1(0).SetFocus [/b][/i][/u][sub]*******************************************************
General remarks:
If this post contains any suggestions for the use or distribution of code, components or files of any sort, it is still your responsibility to assure that you have the proper license and distribution rights to do so!
 
If text1(0).Visible and text1(0).Enabled then text1(0).SetFocus
--------------------------------

Many thanks CCLINT !!!!!!!!!

That works and i gave you a Star !!

Thanks MaxRace Software - Larry Meaux
ET_Analyst for DragRacers
Support Israel - Genesis 12:3
 

You're welcome and thank you. [/b][/i][/u][sub]*******************************************************
General remarks:
If this post contains any suggestions for the use or distribution of code, components or files of any sort, it is still your responsibility to assure that you have the proper license and distribution rights to do so!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top