renaming active control from handler

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Marc

    #1

    renaming active control from handler

    Hi all,

    The code below works fine....however i am trying to find a way of
    renaming the active button control with the text entered in the
    'newtxtbox' ,instead of opening a message box! -see MsgBox("test
    message") when enter is clicked).

    any ideas?

    -----------------------------------------------------------------------------------

    Private Sub RenameToolStrip MenuItem_Click( ByVal sender As
    System.Object, ByVal e As System.EventArg s) Handles
    RenameToolStrip MenuItem.Click
    Dim NewTxtBox As New TextBox
    NewTxtBox.Locat ion = ContextMenuStri p1.SourceContro l.Location
    Me.Controls.Add (NewTxtBox)
    NewTxtBox.Bring ToFront()
    NewTxtBox.Text = "Type and Hit Enter"
    AddHandler NewTxtBox.KeyPr ess, AddressOf TextBox1_KeyPre ss
    End Sub

    ---------------------------------------------------------------------------------------------------------------------------------

    Private Sub TextBox1_KeyPre ss(ByVal sender As Object, ByVal e As
    System.Windows. Forms.KeyPressE ventArgs)
    If e.KeyChar = Chr(Keys.Enter) Then
    MsgBox("test message")
    End If
    End Sub

  • Ryan S. Thiele

    #2
    Re: renaming active control from handler

    Read from your other post.

    --
    --
    Thiele Enterprises - The Power Is In Your Hands Now!
    --
    "Marc" <marc_crosby@ho tmail.comwrote in message
    news:1165080113 .927815.245240@ l12g2000cwl.goo glegroups.com.. .
    Hi all,

    The code below works fine....however i am trying to find a way of
    renaming the active button control with the text entered in the
    'newtxtbox' ,instead of opening a message box! -see MsgBox("test
    message") when enter is clicked).

    any ideas?

    -----------------------------------------------------------------------------------

    Private Sub RenameToolStrip MenuItem_Click( ByVal sender As
    System.Object, ByVal e As System.EventArg s) Handles
    RenameToolStrip MenuItem.Click
    Dim NewTxtBox As New TextBox
    NewTxtBox.Locat ion = ContextMenuStri p1.SourceContro l.Location
    Me.Controls.Add (NewTxtBox)
    NewTxtBox.Bring ToFront()
    NewTxtBox.Text = "Type and Hit Enter"
    AddHandler NewTxtBox.KeyPr ess, AddressOf TextBox1_KeyPre ss
    End Sub

    ---------------------------------------------------------------------------------------------------------------------------------

    Private Sub TextBox1_KeyPre ss(ByVal sender As Object, ByVal e As
    System.Windows. Forms.KeyPressE ventArgs)
    If e.KeyChar = Chr(Keys.Enter) Then
    MsgBox("test message")
    End If
    End Sub


    Comment

    Working...