Click here to Skip to main content
15,892,674 members
Please Sign up or sign in to vote.
1.00/5 (3 votes)
See more:
CODE PLEASE FOR SELECT MALE FEMALE IN GENDER BOX USE ING DROPDOWN SELECTION
Posted
Comments
Peter Leow 18-Feb-14 0:20am    
Why all capital?

Go in Properties of combobox in event selectionindexchanged write this code

SQL
Protected Sub DropDownList1_SelectedIndexChanged(sender As Object, e As System.EventArgs) Handles DropDownList1.SelectedIndexChanged
       Dim selectedItem As String
       Dim gender As String
       selectedItem = DropDownList1.SelectedItem.Text.ToString()
       If selectedItem = 'Male' Then
          gender='male'
       End If
   End Sub
 
Share this answer
 
dim gender  as string = ""

Protected Sub ddlGender_SelectedIndexChanged(sender As Object, e As System.EventArgs) Handles ddlGender.SelectedIndexChanged
      If ddlGender.SelectedItem.Text.ToString()= "Male" Then
          gender="male"
      else
          gender="female"
      End If
   End Sub
 
Share this answer
 
v3
Comments
Member 13847218 18-Jul-18 1:24am    
string a;
private void button1_Click(object sender, EventArgs e)
{
if (radiomal.Checked)
{
a = radiomal.Text;
}
else
{
a = radiofem.Text;
}


SqlConnection abc = new SqlConnection("Data Source=DESKTOP-8BEJFRN\\SQLEXPRESS;Initial Catalog=assignment1;Integrated Security=True");
abc.Open();
SqlCommand bcd = new SqlCommand("update cust set [Nic No]='" + txtnicn1.Text + "',Name='" + txtnam1.Text + "',Address='" + txtadd.Text + "',[Mobile no]='" + txtcon1.Text + "',gender='"+a+"' where [Custermer Id] ='" + txtcusid1.Text + "'", abc);
bcd.ExecuteNonQuery();
MessageBox.Show("your update ");
error update gender pls help

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900