Home All Groups Group Topic Archive Search About

setting form properties during runtime

Author
15 Jan 2007 8:11 PM
Jim Madsen
OK--Beginner question--

I have a project with one form -- Form1.  To change the text, why can't
I use "Form1.Text = something"?  Instead I have to use
"Form1.ActiveForm.Text = Something".  As an exercise, I rewrote a timer
app that I wrote in VB 5.0.  You set the time, and when it runs, it
minimizes until the time is up, and then pops back up again and gives an
alerting sound.  In VB 5.0, I was able to write the time to the forms
text property, while the timer was counting down and the form was
minimized, so you could see how much time was left by looking in the
task bar.  Now, when I try to do this and the form minimizes, it throws
an exception when the time (ie form text) changes -- (I guess when the
form is minimized, it is no longer an active form).  I'm confused.

Jim

Author
16 Jan 2007 12:16 AM
Spam Catcher
Jim Madsen <jus***@nobody.com> wrote in news:uM7uWFOOHHA.448
@TK2MSFTNGP04.phx.gbl:

> I have a project with one form -- Form1.  To change the text, why can't
> I use "Form1.Text = something"?

Is form1 your instance name or your class name?

If it's your class name, you must refer to the current instance.

For example, if you displayed the new form as:

Dim _MyForm as new Form1

You can change the title by going _MyForm.Title = "SomeTitle"