Home All Groups Group Topic Archive Search About

Problem saving txt box with enter key

Author
25 Nov 2006 10:32 PM
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

Author
25 Nov 2006 11:05 PM
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?


Show quoteHide quote
"Marc" <marc_cro***@hotmail.com> wrote in message
news:1164493942.207224.270310@45g2000cws.googlegroups.com...
> 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
>
Author
26 Nov 2006 9:04 AM
Marc
Yes its not there

Stephany Young wrote:
Show quoteHide quote
> 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?
>
>
> "Marc" <marc_cro***@hotmail.com> wrote in message
> news:1164493942.207224.270310@45g2000cws.googlegroups.com...
> > 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
> >
Author
26 Nov 2006 9:58 AM
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.


Show quoteHide quote
"Marc" <marc_cro***@hotmail.com> wrote in message
news:1164531891.059041.315510@n67g2000cwd.googlegroups.com...
> Yes its not there
>
> Stephany Young wrote:
>> 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?
>>
>>
>> "Marc" <marc_cro***@hotmail.com> wrote in message
>> news:1164493942.207224.270310@45g2000cws.googlegroups.com...
>> > 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
>> >
>