Get value from radio button

Submitted by:Andery Smith

Date added:25 August, 2012

Category:VB.NET

VB.Net code example to get value from radio button

Tags: get value

Code Snippet:

    Private Sub savebtn_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles savebtn.Click

Dim radioValue As String
If Offer1Radbtn.Checked = True Then
radioValue = "offer 1"
ElseIf Offer2Radbtn.Checked = True Then
radioValue = "offer 2"
Else
radioValue = "not selected"
End If

daCustomer.Fill(dsCustomer)
Dim Rows As DataRow = dsCustomer.CUSTOMER.NewRow

Try
Rows("Telno") = CInt(TelNoTextBox.Text)
Rows("Name") = NameTextBox.Text
Rows("Address") = AddTextBox.Text
Rows("Address") = radioValue '--------------------- contoh.

dsCustomer.CUSTOMER.Rows.Add(Rows)
daCustomer.Update(dsCustomer)

MessageBox.Show("Record succsesfully saved")
Catch ex As Exception
MessageBox.Show(ex.Message)
End Try
End Sub
 
 

Comments