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 IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How do I Set Focus on the first field of a dialog box?

Status
Not open for further replies.

pseudoman

Programmer
Jan 8, 2004
16
US
I would like my dialog box to function more like a inputbox, because with my current code I have to click the first field of the dialog box with the mouse in order to set the focus there... this is a problem because any mouse interaction slows the speed of the process that this dialog box is attached to... Thx in advance!

here is what my current code looks like :

Need (.Textbox1) to have the focus when this opens


'Dialogbox user input

Dim Acct As String
Dim DOS As String
Dim TIN As String

On Error Resume Next

Begin Dialog UserDialog 152,90, "Draft Automation Application"

OkButton 99, 28, 50, 14
CancelButton 99, 44, 50, 14
Text 6, 7, 90, 9, "Dates of Service:"
Text 6, 32, 90, 9, "Account #:"
Text 5, 58, 90, 9, "Tin #:"
TextBox 6, 19, 90, 12,.TextBox1
TextBox 6, 43, 90, 12,.TextBox2
TextBox 5, 70, 90, 12,.TextBox3
End Dialog

Dim mydialogbox As UserDialog
Dialog mydialogbox

If Err=102 then
Exit Sub
Else

DOS = mydialogbox.TextBox1
Acct = mydialogbox.TextBox2
TIN = mydialogbox.TextBox3
 
I thought adding this line would work but still no dice....

DlgFocus mydialogbox.TextBox1
 
Jess can't believe I over looked this all I need to do was move the buttons... so the text came first... I'm a meathead
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top