problem in accessing combobox value

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • vikassawant
    New Member
    • Mar 2009
    • 27

    problem in accessing combobox value

    hi all,
    Please help me.

    I declare combo box in one file named as test.java i.e. cmb1 and I want to access value of that combobox in another file.
    In test.java I declare string str as public and assign combo box value as

    public String str;
    str = cmb1.getSelecte dItem();


    I wanna access str value in another java file.I write there code for access value is

    test tst = new test();
    String t1;
    t1 = tst.str;


    System.out.prin tln("value of Str is ....."+t1);

    but I never get the value of combo box...It gives 'null' output...

    Please help me to solve this problem.

    Thanks in advance.
    vikas
  • vikassawant
    New Member
    • Mar 2009
    • 27

    #2
    hi friends,
    I got the solution,I just declare that string as static instead of public.

    Thanks.

    Comment

    Working...