Note that there are some explanatory texts on larger screens.

plurals
  1. PORadio button and display
    primarykey
    data
    text
    <p>I have a <code>ListBox</code> , <code>Button</code> and <code>RadioButton</code>. When I click a <code>button</code>, different kind of drink will list out on the <code>ListBox</code>. </p> <p>I want let user select drinks size and show out the price. When user check <code>large radio button</code> large size price will show out. The price was link with the database. </p> <p>The problem is when I select the radio button, the price won't show until I click the drinks button again. I want the price show when then radio button was checked.</p> <p>Here is my coding</p> <pre><code>private void signatureMilkTeaButton_Click(object sender, EventArgs e) { listBox1.Items.Clear(); string constring = "datasource=localhost;port=3306;username=root;password=000"; string Query = "select* from database.drinks where drinks_Type ='M';"; MySqlConnection connectDatabase = new MySqlConnection(constring); MySqlCommand commandDataBase = new MySqlCommand(Query, connectDatabase); MySqlDataReader myReader; try { connectDatabase.Open(); myReader = commandDataBase.ExecuteReader(); while (myReader.Read()) { string sName = myReader.GetString("drinks_Name"); listBox1.Items.Add(sName); } { decimal MMPrice = myReader.GetDecimal("drinks_MPrice"); decimal MLPrice = myReader.GetDecimal("drinks_LPrice"); if (MediumButton.Checked == true ) { textBox1.Text = MMPrice.ToString(); } else if (largeButton.Checked == true) { textBox1.Text = MLPrice.ToString(); } }*/ } catch (Exception ex) { MessageBox.Show(ex.Message); } } </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload