Using data from another form? - Programmers Heaven

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Using data from another form?

ReiderReider Posts: 36Member
How is it again that I can let a form use the data from another form, don't I have to make it public or something somehow???

For example I want a label on my second form to show whatever was entered into the textbox in my first form.

Cheers

Reider

Comments

  • GideonOmegaGideonOmega Posts: 617Member
    : How is it again that I can let a form use the data from another form, don't I have to make it public or something somehow???
    :
    : For example I want a label on my second form to show whatever was entered into the textbox in my first form.
    :
    : Cheers
    :
    : Reider
    :
    There are two ways to do this, one everytime you make a change to the text box, you would also use this:
    [code]
    frmSecondFormName.lablename.caption = sameValueAsTextBox
    [/code]

    you can always refference a control on another form by simply putting the name of the form before the control.

    now the second way to this is in a code module:
    [code]
    Public VarName as VarType
    [/code]
    that is a global variable, a global var is accessible to all forms, functions and subs in your project. So by setting the value of your global you can then use that var to set the value of your other form

    [code]
    'on the first form
    globalVarname = value

    'on second form
    label1.caption = globalVarName
    [/code]

    Hope this helps.
    [blue]
    C:Dos
    C:Dos Run
    Run Dos Run
    [/blue]

  • ReiderReider Posts: 36Member
    Helped a lot, thanks muchly!
  • GideonOmegaGideonOmega Posts: 617Member
    : Helped a lot, thanks muchly!
    :
    Glad I could help.
    [blue]
    C:Dos
    C:Dos Run
    Run Dos Run
    [/blue]

Sign In or Register to comment.