Solved

Adding data to a form before it is displayed on screen

Posted on 2004-10-26
147 Views
Last Modified: 2010-05-02
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.
0
Question by:caffreys
    5 Comments
     
    LVL 28

    Accepted Solution

    by:
    'Have you tried:

    Load Form2
    Form2.Check1.Value = 1
    Form2.Check2.Value = 1
    Form2.Show
    0
     
    LVL 14

    Expert Comment

    by:Shiju Sasidharan
    Hi

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

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

    ;-)
    Shiju

    0
     
    LVL 48

    Expert Comment

    by:Mikal613
    I would make a

    form1

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


    Form2

    dim Frm as new Form1
    frm.InitializeForm(34)
    load frm
    0
     
    LVL 1

    Expert Comment

    by:atheekurrahman
    have a few global var to store the traces

    private sub Form_load()
          me.show
          ' code to tick the check boxes depending on the global var
    end sub
    0
     

    Author Comment

    by:caffreys
    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.

    Caffreys
    0

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    IT, Stop Being Called Into Every Meeting

    Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

    Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
    This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
    Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
    Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

    933 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    17 Experts available now in Live!

    Get 1:1 Help Now