ozone_buzzer

Well-known member
  • Aug 6, 2007
    2,898
    80
    48
    Colombo
    How to pass values between two opened form??

    I have Form1 and Form2.
    Both are opened, When I press a Button in Form1, now I have to passed a value from TextField in Form1 to the TextField of Form2 without creating a new object of that form.

    How can I do this.

    Appreciate your reply

    Thanking You
     

    Lalakajee

    Well-known member
  • Jun 20, 2007
    3,061
    296
    83
    In my own heart
    Why do you need to connect two forms together?:eek:
    if you are looking into passing data between the two, there are a few ways you can do this.:yes:
    First, is write the data to a file, and have the other forms read the file (FileAction Listener ekak wage;)). Just make sure that you re-read the file(XML wage hadapan, netbeans wala thiyenne!) before you do any options. This way you will be able to make sure that if a value is changed in another form the new form will reflect it.

    a second way you can do this is by passing the value when you instantiate the form. You can also make an update function in the class and call the update to change the value in the second form. Just make sure that the other forms are declared outside a method so they will be available throughout the class.

    Hope this helps:D:dull:




    PS:- Homework neweine!!!:rofl::P
     

    hspa3.5

    Well-known member
  • Sep 23, 2009
    4,539
    543
    113
    my world
    form 1 class 1k eathule public function 1k hadapan value 1k return katrana

    eta passe form 2 valin call karala value 1k variable 1k ta daganin

    mama vb.net vala ohoma kala vade goda
     

    ozone_buzzer

    Well-known member
  • Aug 6, 2007
    2,898
    80
    48
    Colombo
    Why do you need to connect two forms together?:eek:
    if you are looking into passing data between the two, there are a few ways you can do this.:yes:
    First, is write the data to a file, and have the other forms read the file (FileAction Listener ekak wage;)). Just make sure that you re-read the file(XML wage hadapan, netbeans wala thiyenne!) before you do any options. This way you will be able to make sure that if a value is changed in another form the new form will reflect it.

    a second way you can do this is by passing the value when you instantiate the form. You can also make an update function in the class and call the update to change the value in the second form. Just make sure that the other forms are declared outside a method so they will be available throughout the class.

    Hope this helps:D:dull:




    PS:- Homework neweine!!!:rofl::P


    Mata Example ekak danna puluvanda???