Adding data to a form before it is displayed on screen

I want to pass data to several checkboxes on a form before it is shown on the screen. I have a trend display with several traces on it. Everytime you want to hide a trace you have to go into a config page and set the linestyle to "none" - a bit of a pain. What I want to do is have a form (which is activated from a pushbutton) that will check the trend for how many traces there are, and select/deselect the relevant checkbox based on if the trace is present (the line style is not set to "none") - the trend is limited to only 8 traces, so if there are 6 traces on the trend, only the first 6 checkboxes will be "ticked".

After the form is shown, when a checkbox is then "unticked" the linestyle for the trace is set to none, thus not showing the trace on the trend.

I've created the form with checkboxes and labels, I can detect if a trend has been selected, I can get the number of traces on the trend and I can check what linestyle is, I just don't know how to populate the checkboxes on the form automatically.

Help Please - Caffreys.
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

'Have you tried:

Load Form2
Form2.Check1.Value = 1
Form2.Check2.Value = 1

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Shiju SasidharanAssoc Project ManagerCommented:

Also keep in mind that  the statement
   Check1.Value = 1

unlike Radio button this will invoke the Check1_Click() Event aswell


I would make a


dim m_grade as long
Public Sub InitializeForm(Grade as long)
m_grade = Grade
End Sub


dim Frm as new Form1
load frm
have a few global var to store the traces

private sub Form_load()
      ' code to tick the check boxes depending on the global var
end sub
caffreysAuthor Commented:
Thanks vinnyd79, that worked fine. The other suggestions may have worked as well, but yours was the first I tried and it worked for me.

It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.