Changing the label text property with code.
-
Hi all I am very new at programming anf I would like to do a very basic function, to change the label.text thru some code. The following code does not work but it will give you the basic idea of what I want done
For i = 1 To number Label(i).text = i Next
The reason is that my label will change in function of the day of the month Thank and keep up the good work. asp
-
Hi all I am very new at programming anf I would like to do a very basic function, to change the label.text thru some code. The following code does not work but it will give you the basic idea of what I want done
For i = 1 To number Label(i).text = i Next
The reason is that my label will change in function of the day of the month Thank and keep up the good work. asp
It works. The problem is that your code is running on the UI thread and blocks it so the WM_PAINT messages that are tacking up in your apps message queue don't get processed. That means that your label control is not receiving the Paint messages until after your code is done and your app is idle. That's when the label gets repainted. Also, what's with the
Label()
array?? Is this VB6 you're using?? If so, stop now and get VB.NET Express. It's free and you won't be teaching yourself some very bad habits forced on your by VB6.A guide to posting questions on CodeProject[^]
Dave Kreskowiak -
It works. The problem is that your code is running on the UI thread and blocks it so the WM_PAINT messages that are tacking up in your apps message queue don't get processed. That means that your label control is not receiving the Paint messages until after your code is done and your app is idle. That's when the label gets repainted. Also, what's with the
Label()
array?? Is this VB6 you're using?? If so, stop now and get VB.NET Express. It's free and you won't be teaching yourself some very bad habits forced on your by VB6.A guide to posting questions on CodeProject[^]
Dave Kreskowiak -
Yeah, but that's not the best way to do it.
A guide to posting questions on CodeProject[^]
Dave Kreskowiak -
It works. The problem is that your code is running on the UI thread and blocks it so the WM_PAINT messages that are tacking up in your apps message queue don't get processed. That means that your label control is not receiving the Paint messages until after your code is done and your app is idle. That's when the label gets repainted. Also, what's with the
Label()
array?? Is this VB6 you're using?? If so, stop now and get VB.NET Express. It's free and you won't be teaching yourself some very bad habits forced on your by VB6.A guide to posting questions on CodeProject[^]
Dave KreskowiakGood reply. Get VB.NET.......
-
Hi all I am very new at programming anf I would like to do a very basic function, to change the label.text thru some code. The following code does not work but it will give you the basic idea of what I want done
For i = 1 To number Label(i).text = i Next
The reason is that my label will change in function of the day of the month Thank and keep up the good work. asp
Give this video series a try. I am sure this will help you understand Visual Basic better. Channel 9 MSDN: Visual Basic For Beginers Video Series[^] I hope this helps. :)
-
Yeah, but that's not the best way to do it.
A guide to posting questions on CodeProject[^]
Dave KreskowiakThank you all for your help. I know it's probably not the best way to do it, by creating a dictionnary, but since my project is small, it does the job for now. When I get better at coding I will look at other ways to do it. PS I am using Visual Studio 2010 ultimate. I have another question but I will post another thread Again thanks
-
Thank you all for your help. I know it's probably not the best way to do it, by creating a dictionnary, but since my project is small, it does the job for now. When I get better at coding I will look at other ways to do it. PS I am using Visual Studio 2010 ultimate. I have another question but I will post another thread Again thanks
AlainStP wrote:
I know it's probably not the best way to do it, by creating a dictionnary
Thats not a dictionary. It's an array. The two are very different in their functionality and if you start using the incorrct terminology when referring to thi \sstuff in forums, you'll end up confusing people.
A guide to posting questions on CodeProject[^]
Dave Kreskowiak