Results 1 to 10 of 10

Thread: Help me on this simple exercise..

  1. #1

    Thread Starter
    Junior Member hunter2's Avatar
    Join Date
    Jun 2003
    Posts
    19

    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..

  2. #2
    Frenzied Member Memnoch1207's Avatar
    Join Date
    Feb 2002
    Location
    DUH, Guess...Hint: It's really hot!
    Posts
    1,861
    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

  3. #3
    Hyperactive Member RealNickyDude's Avatar
    Join Date
    Nov 2002
    Location
    Watching you through the hidden camera :o
    Posts
    435
    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.

    [vbcode]
    On Error GoTo Hell
    [/vbcode]:¬) Nicky : Why not try VBCodebook.NET.

  4. #4

    Thread Starter
    Junior Member hunter2's Avatar
    Join Date
    Jun 2003
    Posts
    19
    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..

  5. #5
    Hyperactive Member RealNickyDude's Avatar
    Join Date
    Nov 2002
    Location
    Watching you through the hidden camera :o
    Posts
    435
    Ok, but just this once
    VB Code:
    1. Private Sub TextBox1_GotFocus(ByVal sender As Object, ByVal e As System.EventArgs) Handles TextBox1.GotFocus
    2.         Label1.Text = "Textbox1 got focus"
    3.     End Sub
    [vbcode]
    On Error GoTo Hell
    [/vbcode]:¬) Nicky : Why not try VBCodebook.NET.

  6. #6

    Thread Starter
    Junior Member hunter2's Avatar
    Join Date
    Jun 2003
    Posts
    19
    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..

  7. #7
    Hyperactive Member RealNickyDude's Avatar
    Join Date
    Nov 2002
    Location
    Watching you through the hidden camera :o
    Posts
    435
    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
    [vbcode]
    On Error GoTo Hell
    [/vbcode]:¬) Nicky : Why not try VBCodebook.NET.

  8. #8

    Thread Starter
    Junior Member hunter2's Avatar
    Join Date
    Jun 2003
    Posts
    19
    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

  9. #9
    Sleep mode
    Join Date
    Aug 2002
    Location
    RUH
    Posts
    8,083
    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:
    1. Private Sub TextBox1_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles TextBox1.KeyPress
    2.         If Asc(e.KeyChar()) = 13 Then
    3.             TextBox2.Focus()
    4.         End If
    5.     End Sub

  10. #10

    Thread Starter
    Junior Member hunter2's Avatar
    Join Date
    Jun 2003
    Posts
    19
    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
  •  



Click Here to Expand Forum to Full Width