Visual Basic - Rename Button Without Input Box, Just Click and Type
Go to solution
Solved by madknight3,
Looks like you're close. Here's the button/textbox code to help you out.
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click // When button is clicked make the textbox over the button visible and set it's focus TextBox1.Visible = True TextBox1.Focus() End Sub Private Sub TextBox1_KeyDown(sender As Object, e As KeyEventArgs) Handles TextBox1.KeyDown // Fired when a key is pressed. Check that the pressed key is the Enter key If e.KeyCode = Keys.Enter Then // Set the button text to what is in the textbox Button1.Text = TextBox1.Text // Hide the text box and clear it so it is ready for next time TextBox1.Visible = False TextBox1.Clear() End If End Sub
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now