Windows Develop Bookmark and Share   
 index > Windows Forms General > how to changing text property of button at runtime?
 

how to changing text property of button at runtime?

hai all,
i want to change text property of buton at runtime. i want to rename it when i right click in context menu and select rename. when i select rename the input dialog appear and i can input new text of my button. how can i do that? please help me sample code, reference, or maybe you have different idea that i can implement!!!.
muhamad nizar iqbal  Saturday, September 26, 2009 3:21 AM
Add a ContextMenu with Rename item as use following code

 Private Sub RenameToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RenameToolStripMenuItem.Click
        Dim str As String = InputBox("Please enter new name for button")
        If str.Trim <> String.Empty Then
            Button1.Text = str.Trim
        End If
    End Sub

Gaurav Khanna
Khanna Gaurav  Saturday, September 26, 2009 5:27 AM
Add a ContextMenu with Rename item as use following code

 Private Sub RenameToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RenameToolStripMenuItem.Click
        Dim str As String = InputBox("Please enter new name for button")
        If str.Trim <> String.Empty Then
            Button1.Text = str.Trim
        End If
    End Sub

Gaurav Khanna
Khanna Gaurav  Saturday, September 26, 2009 5:27 AM
Thank you Gaurav Khanna. i have finish my problem.
muhamad nizar iqbal  Saturday, September 26, 2009 2:23 PM

You can use google to search for other answers

Custom Search

More Threads

• Flash Screen
• Transparent areas on window
• How to re-authenticate user?
• How to resize form?
• Selecting a Printer and Printing to a Fax Printer?
• How to detect if an event is already binded to a control ?
• Draw/Paint Program With Selection - Resources Needed
• TextBox in UserControls (2 levels), loop on Leave event and Focus instruction
• ListView with checkboxes in colums...
• Windows forms AutoScaling and user controls containing anchored child controls.