In my form, there is 1 Button and 1 Label.

There is no text in Label1 right now.

I have coded the button:

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Label1.Text = "1"
    End Sub
End Class

Now when i run the project, i click on Button1 and Label1 has text in it "1" as it is in the code.

I want when i again run the project, the text in the label should be changed once i click Button1.

Recommended Answers

All 7 Replies

what the silly question. on button click you are assign the value of label is 1 then how can you change it. tell me brief what you want? with some code.

I want when i again run the project, the text in the label should be changed once i click Button1.

To what should it change? You want to increase to 2?

u cannot change the text dynamically, coz u have value that is predefined in ur code... to change it dynamically u have to go for better coding that supports ur aim and objectives.....

Hi,
Basic programming 101

dim i as integer =0
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click  
        Label1.Text = i+1
End Sub

What do you mean change text dynamically?
In your code, it will result that every time you click the button your Label1.Text will change.

:'(

Ok, i am going to close this thread...and publish a new one with some detail.

To what should it change? You want to increase to 2?

It should DECREASE to 0.

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.