I specified that my preferred option was to clear the text at the form load event. To do this follow the next steps:
1) Copy and paste the small bit of code from the button click event
Note: Anything after a (') is a comment and is not code.
i.e. this: lbl1.Text = "" ' You are making sure the text in the label is empty
2) Go to the code window
3) From the left hand drop down list pick the form events as in the shot below:
4) From the right hand list pick the load event shown Below:
5) Once you pick the load event the event handler will pre-populate the code window with a new event handler as below.
6) put your line of code in the new event handler so that it looks like this:
7) Then run the application again. You will see the label has already been cleared when the form appears.
this is how to clear the label at runtime. it will still show its default text when you open it at design time.
Note: Don't worry about the empty button click event handler it won't do anything when you run the code.
No comments:
Post a Comment