Public Class Form1
    Private Sub Button1_Click(ByVal sender As  _
                               System.Object, ByVal e As System.EventArgs)
        -
        Handles Button1.Click

        Button1.Text = "Hello World"
    End Sub

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

    End Sub
End Class

The name of the button isn't changing to Hello World... Anyone can correct this?

if you use vb6 then try it easily:

Private Sub Command1_Click()
Command1.Caption = "Hello World"
End Sub

Not working, I'm using Microsoft Visual Basic 2008 Express edition

Try to use Me:
Me.Button1.Text = "Hello World"

Your syntax is correct. You do not have the coding in the Form_Load event, you have it in the button click event, you must click the button before you should see the changes.

You said the buttons 'name' doesnt change, but you are assigning a value to its Text property. The Text property is the string shown on the button, but the buttons name is used to identify it within the application.

The code you have written will change the text on the button when you click it. Its name will still be Button1.

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.