Using a Label instead of Msgbox

Hi team!

I have a dumb question, maybe.

I’m looking that I can’t change the text of a label inside the mainwindow when Im using For-Next.
Nevertheless If I display the value of For, it shows without problem.

When I use label, Eg. mainwindow.label = str(i)

It shows me that error: This method cannot accept an assigned value (it lacks an assign parameter)

And this is my Code:

For i As Integer = 1 to 20
Msgbox str(i) ///It Works, it shows Message from 1 up to 20

mainwindow.label = str(i) // Doesn’t Work
Next

What Am I doing wrong?

mainwindow.label.text = str(i)

Of course, thanks maybe I’m tired, I forgot to put text parameter LOL

Been there, done that :wink:

I test it, but only puts the last number of “i” for example, shows “20”

Instead of show 1, 2, 3,4,5,6,7,8,9 up to 20.

For i As Integer = 1 to 20
mainwindow.label1.text = str(i)
Next

I’m trying to do this, in order to make a progress status label,to display the folder loaded to my DB

[quote=206788:@Gerardo García]I test it, but only puts the last number of “i” for example, shows “20”

Instead of show 1, 2, 3,4,5,6,7,8,9 up to 20.

For i As Integer = 1 to 20
mainwindow.label1.text = str(i)
Next

I’m trying to do this, in order to make a progress status label,to display the folder loaded to my DB[/quote]
Solved!!

with label.refresh

[quote=206788:@Gerardo García]I test it, but only puts the last number of “i” for example, shows “20”

Instead of show 1, 2, 3,4,5,6,7,8,9 up to 20.

For i As Integer = 1 to 20
mainwindow.label1.text = str(i)
Next

I’m trying to do this, in order to make a progress status label,to display the folder loaded to my DB[/quote]

It’s replacing the text on each loop.

mainwindow.label1.text = mainwindow.label1.text + "," + str(i)

Version 1 - Only show the number of the loop.

For i As Integer = 1 to 20 mainwindow.label1.text = str(i) mainwindow.label1.Refresh Next
Version 2 - Show the incrementing numbers.

[code]mainwindowlabel1.Text = “”

For i As Integer = 1 to 20
mainwindow.label1.text = mainwindow.label1.Text + “,” + str(i)
mainwindow.label1.Refresh
Next[/code]