473,324 Members | 2,246 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,324 software developers and data experts.

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 RenameToolStripMenuItem_Click(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles
RenameToolStripMenuItem.Click
Dim NewTxtBox As New TextBox
NewTxtBox.Location = ContextMenuStrip1.SourceControl.Location
Me.Controls.Add(NewTxtBox)
NewTxtBox.BringToFront()
NewTxtBox.Text = "Type and Hit Enter"
AddHandler NewTxtBox.KeyPress, AddressOf TextBox1_KeyPress
End Sub

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

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

Dec 2 '06 #1
1 884
Read from your other post.

--
--
Thiele Enterprises - The Power Is In Your Hands Now!
--
"Marc" <ma*********@hotmail.comwrote in message
news:11**********************@l12g2000cwl.googlegr oups.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 RenameToolStripMenuItem_Click(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles
RenameToolStripMenuItem.Click
Dim NewTxtBox As New TextBox
NewTxtBox.Location = ContextMenuStrip1.SourceControl.Location
Me.Controls.Add(NewTxtBox)
NewTxtBox.BringToFront()
NewTxtBox.Text = "Type and Hit Enter"
AddHandler NewTxtBox.KeyPress, AddressOf TextBox1_KeyPress
End Sub

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

Private Sub TextBox1_KeyPress(ByVal sender As Object, ByVal e As
System.Windows.Forms.KeyPressEventArgs)
If e.KeyChar = Chr(Keys.Enter) Then
MsgBox("test message")
End If
End Sub
Dec 2 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Saradhi | last post by:
Hi All, Here I am facing a performance problem with the TreeView Node renaming. I am displaying a hierarchy Data in a treeview in my Windows C# Application. My tree view represents an...
0
by: Pierre Mengal | last post by:
Active Up is pleased to announce the release of 3 new products. All these products are now part of the Web.Controls Suite . The products featured in the package are: Active Image ..NET...
0
by: MikeY | last post by:
Hopefully someone can help, I have a listview box where I display my desired files. I single click on the desired file to be renamed and I rename it with a new name. My problem arises when the...
0
by: John | last post by:
How to detect when a document changes from being the active window(C#)?(Is there an event handler to detect when an active window changes?) My application is supposed to detect change in the word...
5
by: Miyra | last post by:
Hi. I'm working with an app that uses exceptions for control flow. These are code blocks where exceptions are thrown/caught regularly. A couple hundred exceptions occur per hour and they're caught...
5
by: Homer J. Simpson | last post by:
Hi, Any idea to get the -REAL- number of active users -WITHOUT- this kind of code ? ---------------------------------------------------------------------------- --------- Sub Session_OnStart...
4
by: Volker Jobst | last post by:
Hi, Is there an event of windows.forms.form which informs me that the active control will be changed before it will be changed? Something like: Private Sub Form_Validating(ByVal sender As...
8
by: BillCo | last post by:
I'm updating a legacy app with table naming that makes baby jesus cry. It's a bit of a spider web though... no telling when and where the tables will be called by name. So I wrote this for renaming...
2
by: Johnny Jörgensen | last post by:
Is there any way of renaming the properties of standard controls. I want to create a TextBox control inherited from a normal textbox control, but I want to use the property for something else....
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.