Results 1 to 6 of 6

Thread: in vb.net windows application, i have two raddiobutton in a groupbox, if i select ra

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Nov 2008
    Posts
    103

    in vb.net windows application, i have two raddiobutton in a groupbox, if i select ra

    in vb.net windows application, i have two raddiobutton in a groupbox,

    if i select radiobutton1 then the value=1
    if select radiobutton2 then the value=2
    how can i do please help me

  2. #2
    eXtreme Programmer .paul.'s Avatar
    Join Date
    May 2007
    Location
    Chelmsford UK
    Posts
    26,422

    Re: in vb.net windows application, i have two raddiobutton in a groupbox, if i selec

    try this:

    vb Code:
    1. dim values() as integer = {1,2}
    2. msgbox(values(math.abs(cint(radiobutton2.checked))))

  3. #3
    Member
    Join Date
    Apr 2010
    Posts
    52

    Re: in vb.net windows application, i have two raddiobutton in a groupbox, if i selec

    Depends how you want to do it.

    If you only have the two radio buttons, then the checkchanged handle would probably be best.

    If you have a button, the you can get the 'checked' property, if true then value = x

  4. #4

    Thread Starter
    Lively Member
    Join Date
    Nov 2008
    Posts
    103

    Re: in vb.net windows application, i have two raddiobutton in a groupbox, if i selec

    i have more than five groupbx, each groupbox contain two radiobutton
    if i select radiobuton1 in groupbox1 value=1
    else
    i select radiobuton2 in groupbox1 value=1
    likewise followed in all groupbox
    and i need to insert this values in MS-Access

  5. #5
    eXtreme Programmer .paul.'s Avatar
    Join Date
    May 2007
    Location
    Chelmsford UK
    Posts
    26,422

    Re: in vb.net windows application, i have two raddiobutton in a groupbox, if i selec

    so whether you select radiobutton1 or radiobutton2 the value = 1???

    you need to clearly define your question

  6. #6

    Thread Starter
    Lively Member
    Join Date
    Nov 2008
    Posts
    103

    Re: in vb.net windows application, i have two raddiobutton in a groupbox, if i selec

    i am sorry


    i have more than five groupbx, each groupbox contain two radiobutton
    if i select radiobuton1 in groupbox1
    value=1
    else if
    i select radiobuton2 in groupbox1
    value=2
    likewise followed in all groupbox
    and i need to insert this values in MS-Access



    here is a sample code of nine









    Private Sub btnsave_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnsave.Click

    Dim a, b, c, d, f As String
    Dim p, q, r, s, t, z As Integer
    If Radiominoryes.Checked = True Then
    a = "Y"
    If Radiominorno.Checked = True Then
    a = "N"
    End If
    End If

    If Radiostaffyes.Checked = True Then
    b = "Y"
    If Radiostaffno.Checked = True Then
    b = "N"
    End If
    End If



    If Radioliterateyes.Checked = True Then
    p = 1
    If Radioliterateno.Checked = True Then
    p = 2
    End If
    End If


    If radioblindyes.Checked = True Then
    q = 1
    If radioblindno.Checked = True Then
    q = 2
    End If
    End If




    If Radionomineyes.Checked = True Then
    c = "Y"
    If Radionomineno.Checked = True Then
    c = "N"
    End If
    End If


    If radiosrcitizenyes.Checked = True Then
    d = "Y"
    If radiosrcitizenno.Checked = True Then
    d = "N"
    End If
    End If



    If Radiobasictypeyes.Checked = True Then
    r = 1
    If Radiobasictypeno.Checked = True Then
    r = 2
    End If
    End If


    If Radiouceffalloyes.Checked = True Then
    f = "Y"
    If Radiouceffallono.Checked = True Then
    f = "N"
    End If
    End If



    If Radiodrawpoweryes.Checked = True Then
    s = 1
    If Radiodrawpowerno.Checked = True Then
    s = 2
    End If
    End If

    If Radioaccountstatusnew.Checked = True Then
    t = 1
    If RadioRadioaccountstatusactive.Checked = True Then
    t = 2
    End If
    End If
    con.Open()
    cmd = con.CreateCommand
    cmd.CommandText = "INSERT INTO CCOD (salutationinteger,customername,shortname,dateofbirth,modeofoperation,gender,minorcharacter,staffcha racter,literatecharacter,religioncharacter,castecharacter,blindcharacter,nomineecharacter,seniorciti zen,proofofseniorcitizen,customerbasictype,customersubtype,residentialstatus,permanentaddress1,perma nentaddress2,permanentcity,permanentstate,pincode,schemecode,accountnumber,accountopendate,againstun cleareffects,sanctionlimit,drawingpower,legderbalance,clearbalance,unclearbalance,availablebalance,l iennumeric,lastinterestapplicationdate,lastminbalapplieddate,lastwithdrawalsapplieddate,lasttransact iondate,nextreviewdate,interestcode,drawingpowerderived,accountstatus,issuedchequebooks,subsidyamoun t,subsidyglaccountnumber) values ('" & lstsalutation.SelectedIndex.ToString() & "','" & txtcustomername.Text & "','" & txtcustomershortname.Text & "','" & Maskeddob.Text & "','" & lstmodeofoperation.SelectedIndex.ToString() & "','" & lstgender.SelectedIndex.ToString() & "','" & a.ToString() & "','" & b.ToString() & "','" & p & "','" & lstreligion.SelectedIndex.ToString() & "','" & lstcaste.SelectedIndex.ToString() & "','" & q & "','" & c.ToString() & "','" & d.ToString() & "','" & lstseniour.SelectedIndex.ToString() & "','" & r & "','" & lstcustomersubtype.SelectedIndex.ToString() & "','" & txtreaddress.Text & "','" & txtaddress1.Text & "','" & txtaddress2.Text & "','" & txtcity.Text & "','" & txtstate.Text & "','" & txtpincode.Text & "','" & txtschemecode.Text & "','" & txtaccountnumber.Text & "','" & Maskedaccopendate.Text & "','" & f.ToString() & "','" & txtscantionlimit.Text & "','" & txtdrawinpower.Text & "','" & txtledgerbalance.Text & "','" & txtclearbalance.Text & "','" & txtunclearbalance.Text & "','" & txtavailablebalance.Text & "','" & txtlinammount.Text & "','" & Maskedlastintappdate.Text & "','" & Maskedlastbalchargeappdate.Text & "','" & Maskedlastwithdrachardate.Text & "','" & Maskedtransdate.Text & "','" & Maskednextreviewdate.Text & "','" & txtinterestcode.Text & "','" & s & "','" & t & "','" & txtchequeissued.Text & "','" & txtsubsidyammount.Text & "','" & Textsubsidygl.Text & "')"
    check = cmd.ExecuteReader.RecordsAffected()
    If check > 0 Then
    Dim dlgRes As DialogResult
    dlgRes = MessageBox.Show(" Details Succesfully Added", "New customer ", MessageBoxButtons.OK, MessageBoxIcon.None)
    con.Close()

    Else
    MsgBox(" Details failed to added please enter Details ", MsgBoxStyle.OkOnly, "New customer ")
    End If

    End Sub

Posting Permissions

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



Click Here to Expand Forum to Full Width