Results 1 to 2 of 2

Thread: RadioButton

  1. #1
    tiger100plus is offline Member
    Join Date
    Nov 2008
    Location
    Kuala Lumpur,Malaysia
    Posts
    16
    Rep Power
    0

    Default RadioButton

    hi......i wanted to know how to update value from radiobutton(java) into database (Microsoft Access)-which is in the form of combobox-Male or Female

    i was only able to retrieve the gender in java from database.....so i use this way
    String gender =rsMember.getString("Sex");//from database

    if(gender.charAt(0)=='M'){
    jrbMale.setSelected(true);//here can set but how to get
    }
    else if(gender.charAt(0)=='F'){
    jrbFemale.setSelected(true);
    }

    so,how to get the value(M or F) from radiobutton and pass it or update into the database...?
    char male=jrbMale.getSelected//this is not working
    char male=jrbMale.getSelectedObjects();//also not working

    if anyone got solution please correct it for me.....

    after getting the value.....how to update
    is it like this...
    pstmtUpdate.setString(4,sex);

  2. #2
    DarrylBurke's Avatar
    DarrylBurke is offline Forum Police
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,458
    Rep Power
    20

    Default

    > char male=jrbMale.getSelected//this is not working
    You can't just make up method names and expect them to exist. Read the API for JRadioButton and find out the correct method that returns a boolean that tells you whether the radio button is selected (hint, hint)

    db

Similar Threads

  1. radiobutton selection
    By newtojava7 in forum New To Java
    Replies: 1
    Last Post: 03-17-2008, 03:58 AM

Posting Permissions

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