Hi - form problem

  • 12 years ago

    Hi, I'm writing an application and I have one main form which open another form, and now in second form I have a textbox which when I write that text must appear in title of form one how to connect this two forms.

     

    Thank you very much

  • 12 years ago
    in form2 have a declaration for a form

    dim mainForm as Form

    Then have a sub in form 2 that is run when the form is loaded or shown like so:

    sub linkToForm(byRef value as Form)
      me.mainForm=value
    end sub



    in form1 you would call this function like so:

    nameOfForm2.linkToForm(Me)


    Then you can use, in Form 2,  mainForm.text to read and write the title of the first form.(You will also be able to use any public properties and public methods from your first form).












  • 12 years ago

    me.form1.text = textbox1.text

    I think that should work.

  • 12 years ago

    Hi

    An approach could be to point out the owner of form2 as:

    In form1

    dim f as new Form2

    f.show(me)

     

    In form2

    me.owner.text = "the new text"

    /Olle Orm

Post a reply

Enter your message below

Sign in or Join us (it's free).

Contribute

Why not write for us? Or you could submit an event or a user group in your area. Alternatively just tell us what you think!

Our tools

We've got automatic conversion tools to convert C# to VB.NET, VB.NET to C#. Also you can compress javascript and compress css and generate sql connection strings.

“Perfection is achieved, not when there is nothing more to add, but when there is nothing left to take away.” - Antoine de Saint Exupéry