Hi... :)

I have only 1 LABEL in my form. There is no text in Label1.

I want that when i run the project, the label has any word or number in it like '1'.
I want that when i run the project AGAIN, the word or number in the label should be changed to '0'.

Please post the codes regarding this question. The name of my label is Label1.

If you want MORE DETAIL, i can post it.

Thanks.

In the form_load event put label1.text = "0"

Actually,
put this in the form_load event
if labal1.text != "o" then
label.text = "0"
end if

In my main program, i have more than 1 form! i forgot to tell this.

Why would this matter? Explain again and be precise what you're trying to do.

Hi,

Is it each time your project is run you want a counter to display the number of times it has been run?

Actually, i am making a small, fake computer scanning program. I want when i click on the scan button, the text in the label should be '3 errors were found' or any thing.

When the user runs the software again and clicks on the scan button, i want the text in the label should be '0 errors were found'.

How can i do this? Please post the RIGHT code.

Actually,
put this in the form_load event
if labal1.text != "o" then
label.text = "0"
end if

Hmm...

you gave the wrong code.

What is '!' in vb??

When It Run The SoftWare Again Mean CLose All And Open Application Again or Only Form

' Paste This In First Form
Public A as Integer = 1

If you Close ONly Form U Just Declare something Like
This Is The Round Each Click

'I Don't Know Your Form Name You Could Change it to your Form Name
Form2.Show
'choose Current Round
Select Case A
Case 1
Form2.Label1 = "Your First Message"
Case 2 
Form2.Label1 = "Your Second Message"
Case 3
Form2.Label1 = "Your Third Message"
Form1.A += 1

Paste This On Your Button Click


If You Close Application You May Save Some Text file to Remeber It
Paste This Procedure To Your Button Click

Dim Path as STring = Application.StartUpPath & "/a.txt"
A = My.Computer.FileSystem.ReadAllText(Path)
Select Case A
Case 1
Form2.Label1 = "Your First Message"
Case 2 
Form2.Label1 = "Your Second Message"
Case 3
Form2.Label1 = "Your Third Message"
Form1.A += 1
My.Computer.FileSystem.WriteAllText(Path, A, False)

Place this On Form_load

sFileName = Application.StartUpPath & "/a.txt"
  Dim fFile As New FileInfo(sFileName)
If Not fFile.exists then
Dim Path as String = Application.StartUpPath & "/a.txt"
My.Computer.FileSystem.WriteAllText(Path, 1, False)
End If

Didn't Test Yet

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.