|
-
Jun 17th, 2003, 03:22 PM
#1
Thread Starter
Junior Member
Help me on this simple exercise..
im a new of vb.net, so I still confusing alots about vb..could any one plz help me to write a sample code from this assisgment\
Here they r:
Create a form with 2 textbox control and a Label control. Place code on the Enter event of each TextBox that sets the Text Property of the label to state which control now has the focus.
Plz help me..Thanks a lots..
-
Jun 17th, 2003, 03:35 PM
#2
Frenzied Member
Is the school homework?
It's pretty self explainatory...shouldn't take more than 5 minutes to do. If doing this is that hard for you...maybe you should think about changing your school major or career.
Being educated does not make you intelligent.
Need a weekend getaway??? Come Visit
-
Jun 17th, 2003, 03:59 PM
#3
Hyperactive Member
Double-click on textbox no.1 to enter the Event part for that textbox, in there you want to change the text of the label to say you've clicked on textbox 1, same for textbox 2, i'm not going to give you it as it's for an assignment and you really shouldn't do anything unless you understand it. That's my philosophy anyway.
-
Jun 17th, 2003, 04:17 PM
#4
Thread Starter
Junior Member
I told you guys, im new at this, so i come to need help and learn more from you..indeed, I just want to understand what command do we use to write that..plz give me some advise and command to write that code..thanks..
-
Jun 17th, 2003, 04:30 PM
#5
Hyperactive Member
Ok, but just this once
VB Code:
Private Sub TextBox1_GotFocus(ByVal sender As Object, ByVal e As System.EventArgs) Handles TextBox1.GotFocus
Label1.Text = "Textbox1 got focus"
End Sub
-
Jun 17th, 2003, 04:50 PM
#6
Thread Starter
Junior Member
thank you so much, m8.
now i got it..
Private Sub TextBox1_GotFocus(ByVal sender As Object, ByVal e As System.EventArgs) Handles TextBox1.GotFocus
.GotFocus , in my testing i didn't put this command, I still keep TextChanged , so it doesn't work..thanks again..
I can handle lots about web script especially php, but for this vb.net, im still dump about it, so I will need more help from you..
Thanks again..
-
Jun 17th, 2003, 04:54 PM
#7
Hyperactive Member
in my testing i didn't put this command, I still keep TextChanged
Yeah, it catches a few people out 
Have you checked out my VBCodeBook.NET program yet? This could give you a few tips.
Good Luck
-
Jun 17th, 2003, 05:06 PM
#8
Thread Starter
Junior Member
i will take the book you post, and just 1 more question, if i want to put the enter key on the keyboard, then the focus from text1 will auto come to text2 likes we put the Tab key..could we do that ???
Thanks for yr help..
will learn little by little and step by step..thanks
-
Jun 17th, 2003, 08:30 PM
#9
Sleep mode
In the KeyPress Event of TextBox1 , put this code . Number 13 is the ascii code for Enter Key , in case you don't know it already .
VB Code:
Private Sub TextBox1_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles TextBox1.KeyPress
If Asc(e.KeyChar()) = 13 Then
TextBox2.Focus()
End If
End Sub
-
Jun 18th, 2003, 07:21 PM
#10
Thread Starter
Junior Member
Thank you, i got it...
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
|