|
-
Nov 6th, 2005, 10:10 AM
#1
Thread Starter
Member
Keep focus on one text box
hi there
Im looking to keep focus in my first text box even after i have selected on different options.
basically i have 10 command buttons giving different info into the txtNamebox.Text
VB Code:
Private Sub cmdIcon_click(Index As Integer)
Select Case Index
Case 0
txtNamebox.Text = txtNamebox.Text + Format$("1")
Case 1
txtNamebox.Text = txtNamebox.Text + Format$("2")
But after selecting one of them command buttons , i have to manually select the first text box again to type into.
.Please help/
I have the first text box as tab index 0 and the rest disabled but that doesnt work
-
Nov 6th, 2005, 10:39 AM
#2
Re: Keep focus on one text box
VB Code:
Private Sub cmdIcon_click(Index As Integer)
Select Case Index
Case 0
txtNamebox.Text = txtNamebox.Text + Format$("1")
Case 1
txtNamebox.Text = txtNamebox.Text + Format$("2")
End Select
txtNamebox.SetFocus
End Sub
Keith
I've been programming with VB for 25 years. Started with VB4 16bit Pro, VB5 Pro, VB6 Pro/Enterprise and now VB3 Pro. But I'm no expert, I'm still learning.
-
Nov 6th, 2005, 10:47 AM
#3
Thread Starter
Member
Re: Keep focus on one text box
ahaha setFocus man you rock thanks
-
Nov 6th, 2005, 10:58 AM
#4
Thread Starter
Member
Re: Keep focus on one text box
that worked great how ever i need it to goto the end of the text box no matter what data is in there.
thanks
-
Nov 6th, 2005, 11:13 AM
#5
Re: Keep focus on one text box
VB Code:
Private Sub Text1_GotFocus()
Text1.SelStart = Len(Text1)
End Sub
-
Nov 6th, 2005, 11:19 AM
#6
Thread Starter
Member
Re: Keep focus on one text box
sorry maybe im not explaining this right,
After i select a command button i want i too automatically go back to Textbox 1 > and setfocus to the end of the Textbox1
-
Nov 6th, 2005, 11:24 AM
#7
Thread Starter
Member
Re: Keep focus on one text box
ahh yer i see what i needed to do now .
thanks alot
-
Nov 6th, 2005, 11:33 AM
#8
Re: Keep focus on one text box
VB Code:
Private Sub Command1_Click()
Text1.SelStart = Len(Text1.Text)
Text1.SetFocus
End Sub
Keith
I've been programming with VB for 25 years. Started with VB4 16bit Pro, VB5 Pro, VB6 Pro/Enterprise and now VB3 Pro. But I'm no expert, I'm still learning.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|