Problem saving txt box with enter key

M

Marc

Guys,

I have a text box. I simply want to save the text from the text box
(and popluate a buttons text) and remove the text box when a user hits
the enter button.

Can someone help?


Private Sub RenameToolStripMenuItem_Click(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles
RenameToolStripMenuItem.Click

Dim NewTxtBox As New TextBox
NewTxtBox.Location = ActiveControl.Location
Me.Controls.Add(NewTxtBox)


Dim KeyAscii As Keys
If KeyAscii = Keys.Enter Then
Me.Controls.Remove(NewTxtBox)
ActiveControl.Text = NewTxtBox.Text
End If
End Sub
 
S

Stephany Young

Marc. Examples that will help you find the answer to almost every question
you have asked in the past few days (in this newsgroup) can be found in the
VS2005 documentation which can be accessed by pressing F1 whilst in the
VS2005 IDE.

Have you actually bothered to look there?
 
M

Marc

Yes its not there

Stephany said:
Marc. Examples that will help you find the answer to almost every question
you have asked in the past few days (in this newsgroup) can be found in the
VS2005 documentation which can be accessed by pressing F1 whilst in the
VS2005 IDE.

Have you actually bothered to look there?
 
S

Stephany Young

What do you mean by 'Yes its not there'?

Do you mean that you have looked and you can't find it, or do you mean that
when you press F1, the help/documentation does not appear?

If it is the latter then install your copy of VS2005 correctly.

If it is the former then try a few searches on pertinent keywords.

In the index, typing keys.e brings up a entry named Keys.ControlKey
enumeration member which in turn provides an example of hooking up an event
that will handle the pressing of a key.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top