|
code
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Text box cannot change color at runtimeDear all,
I have to set text box color to gray. I use this code : frmMain.txtDate.BackColor = &HC0C0C0 But the color of text box does not change at runtime. But when I set a breakpoint at the above code and run it, it does change color. What happened? I have delete the text box control and add a new textbox control. It still cannot change color when it runs. Please help. Thanks. "hon123456" <peterhon***@yahoo.com.hk> a écrit dans le message de news: cea2edc2-267b-4ba2-8a7d-93b834fed***@s28g2000vbp.googlegroups.com...> Dear all, Does it change if you add a DOEVENTS after that line?> > I have to set text box color to gray. I use this code : > > frmMain.txtDate.BackColor = &HC0C0C0 > > But the color of text box does not change at runtime. But when I set a > breakpoint at the above > code and run it, it does change color. What happened? I have delete > the text box control and > add a new textbox control. It still cannot change color when it runs. > Please help. Thanks. "Clive Lumb" <clumb2@gratuit_en_anglais.fr.invalid> wrote in message frmMain.txtDate.Refreshnews:OGpaMeD4JHA.5204@TK2MSFTNGP02.phx.gbl... > > "hon123456" <peterhon***@yahoo.com.hk> a écrit dans le message de news: > Does it change if you add a DOEVENTS after that line? > Or Which may be preferable to DoEvents as it won't let other things happen. Dave O.
Show quote
Hide quote
"hon123456" <peterhon***@yahoo.com.hk> wrote It matters where you put that code, and what follows after executing that line of code.> Dear all, > > I have to set text box color to gray. I use this code : > > frmMain.txtDate.BackColor = &HC0C0C0 > > But the color of text box does not change at runtime. But when I set a > breakpoint at the above > code and run it, it does change color. What happened? I have delete > the text box control and > add a new textbox control. It still cannot change color when it runs. > Please help. Thanks. For example if that code is in the Form_Unload event, you won't see a change..... One thing you can do to watch for the change is to add a watch for it. Right click in the code window and select Add Watch... then type in txtDate.BackColor and select Break when value changes. If it does change, the program will halt. If it doesn't change, then you may have put that code where it never gets to execute.... LFS |
|||||||||||||||||||||||