I tried using this code(below) to change the button text when i run the code from "Button1" to "Click" but when i run the code the name still remains "Button1" and if i click the button the name then changes to "Click". I want the code to show "Click" on the button when i run it not when i click it. Please, how do i do this? And would it work for other tools like label?

Public Class Form1

Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
    Button1.Text = "Click"

End Sub

End Class

It should work as written. For example, to toggle between two strings you could code

Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click

    If Button1.Text = "On" Then
        Button1.Text = "Off"
    Else
        Button1.Text = "On"
    End If

End Sub

or more concisely

Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click

    Button1.Text = IIf(Button1.Text = "On", "Off", "On")

End Sub
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.