locked
Selecting text in textboxes RRS feed

  • Question

  • Hey,

    I want to have the text selected when tab between them. I've tried the following but it doesn't work due to late binding.

    Private Sub OnEnterHandler(ByVal sender As Object, ByVal e As EventArgs) Handles textbox1.enter, textbox2.enter, textbox3.enter, textbox4.enter

    myTextbox = sender

    myTextbox.SelectAll()

    End Sub

     

    I know I've done this earlier but I can't figure out how I did. Please, can someone help me.

    Tuesday, September 12, 2006 10:14 AM

Answers

  • I found out the trick...

     

    Dim myTextbox As TextBox = CType(sender, TextBox)

    myTextbox.SelectAll()

    Tuesday, September 12, 2006 11:03 AM

All replies

  • dim myTextbox as TextBox = sender

    myTextbox.SelectAll()

    Tuesday, September 12, 2006 10:23 AM
  • No, it didn't work. Option strict on disallows the conversoin from texbox to object. More solutions?
    Tuesday, September 12, 2006 11:00 AM
  • I found out the trick...

     

    Dim myTextbox As TextBox = CType(sender, TextBox)

    myTextbox.SelectAll()

    Tuesday, September 12, 2006 11:03 AM