Results 1 to 11 of 11

Thread: HELP please, Passing Variables between forms

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Jun 2000
    Posts
    85

    Question

    I have two forms one is frmMain, it is the main form, the second is frmAdvanced, it is to set the advanced settings. What I'm trying to do is when the settings are changed on the advanced settings form, I want to see the changes on the main form. It is things like turning a toolbar or statusbar from visible to not visible. I can get it to work if I exit the enitre program and re-open the program. I'm saving all of the settings to a text file. But I want to see the changes with out exiting the program. This is the code from the frmAdvanced form to turn on or off the status bar if the the box is checked:

    Private Sub chkStatusbar_Click()
    If chkStatusbar.Value = 1 Then
    frmMergeMain.mnuViewStatusBar.Checked = True
    frmMergeMain.mnuViewStatusBar.Visible = True
    Else
    frmMergeMain.mnuViewStatusBar.Checked = False
    frmMergeMain.mnuViewStatusBar.Visible = False
    End If
    End Sub

    When I leave the advanced form and return to the main form the status bar is either still there, if it was there in the first place or not there if it was not there.

    HELP please.

  2. #2
    Lively Member
    Join Date
    May 2000
    Posts
    123
    i'm not sure exactly what you want to do, but are you making the variables global so they can be used by both forms?

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Jun 2000
    Posts
    85
    Do I have to make them global when I'm calling the form that they are part of and changing the information that way?? If I want to turn the toolbar off so that I don't see it, from an other form how would you do it??
    Using VB6 Still Pluging away

  4. #4
    _______ HeSaidJoe's Avatar
    Join Date
    Jun 1999
    Location
    Canada
    Posts
    3,946
    public myVar as boolean

    if checked then myVar = false

    if myVar = true then
    do whatever
    else
    whatever
    "A myth is not the succession of individual images,
    but an integerated meaningful entity,
    reflecting a distinct aspect of the real world."

    ___ Adolf Jensen

  5. #5

    Thread Starter
    Lively Member
    Join Date
    Jun 2000
    Posts
    85
    HeSaidJoe
    Where will this code go on the main form or the advanced form?? This could be where I'm going wrong, I might have the code on the wrong forms
    Using VB6 Still Pluging away

  6. #6
    _______ HeSaidJoe's Avatar
    Join Date
    Jun 1999
    Location
    Canada
    Posts
    3,946
    I add my public declares in a bas module

    then it's available everywhere

    in the form activateof main i would put

    if whatever is checked then myVar = false
    if myVar = ture then do
    bla bla
    else
    bla bla
    endif


    in the frmActivae of the advance
    if myVar = false do whatever
    else
    do
    something else
    endif

    in the check box
    if chkMe = chekced then myVar =

    gotta go...system crash...
    will check later on thei
    should have the idea from this

    later





    "A myth is not the succession of individual images,
    but an integerated meaningful entity,
    reflecting a distinct aspect of the real world."

    ___ Adolf Jensen

  7. #7

    Thread Starter
    Lively Member
    Join Date
    Jun 2000
    Posts
    85

    Smile

    HeSaidJoe, Thank you very much. I'll let you know how it goes.
    Using VB6 Still Pluging away

  8. #8
    _______ HeSaidJoe's Avatar
    Join Date
    Jun 1999
    Location
    Canada
    Posts
    3,946

    sorry

    ...I'm at work so I had to go...

    Basically, you want to set the value of myVar in your checked and unchecked states and that makes it available to both forms..then you want to check the value in both form activates and act on it at that point.

    "A myth is not the succession of individual images,
    but an integerated meaningful entity,
    reflecting a distinct aspect of the real world."

    ___ Adolf Jensen

  9. #9

    Thread Starter
    Lively Member
    Join Date
    Jun 2000
    Posts
    85
    Okay, I see what I'm doing wrong. I'm missing that myVar part. A bas module is just a basic module right?? Thank you ever so much for all of your help. One more question, ini files have you ever used them??

    I'm at work too so I understand. :-)
    Using VB6 Still Pluging away

  10. #10
    _______ HeSaidJoe's Avatar
    Join Date
    Jun 1999
    Location
    Canada
    Posts
    3,946

    over and out...

    yes..add module ..saves as .bas
    no..never played with them

    good luck

    "A myth is not the succession of individual images,
    but an integerated meaningful entity,
    reflecting a distinct aspect of the real world."

    ___ Adolf Jensen

  11. #11

    Thread Starter
    Lively Member
    Join Date
    Jun 2000
    Posts
    85
    Thanks again for all your help!!!!!!!!!!!
    Using VB6 Still Pluging away

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width