Antonio King
asked on
What is wrong with this if combobox selectedtext statement?
The combobox "PanelAddComboBoxCurrency" is selected to GBP so it when typing numbers into it it should populate some other textboxes, doesnt seem to work though?
private void PanelAddTextBoxSubTotal_Le ave(object sender, EventArgs e)
{
if (PanelAddTextBoxSubTotal.T ext == "")
{
}
else if(PanelAddComboBoxCurrenc y.Selected Text == "GBP")
{
double Subtotal = Convert.ToDouble(PanelAddT extBoxSubT otal.Text) ;
double VAT = (Subtotal / 100 * 17.5);
double Total = (Subtotal + VAT);
PanelAddTextBoxVAT.Text = Convert.ToString(VAT);
PanelAddTextBoxTotal.Text = Convert.ToString(Total);
}
}
private void PanelAddTextBoxSubTotal_Le
{
if (PanelAddTextBoxSubTotal.T
{
}
else if(PanelAddComboBoxCurrenc
{
double Subtotal = Convert.ToDouble(PanelAddT
double VAT = (Subtotal / 100 * 17.5);
double Total = (Subtotal + VAT);
PanelAddTextBoxVAT.Text = Convert.ToString(VAT);
PanelAddTextBoxTotal.Text = Convert.ToString(Total);
}
}
ASKER CERTIFIED SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
I think you are subscribing to the Leave event of the ComboBox.
Instead you should try to subscribe to the SelectedValueChanged event.
Instead you should try to subscribe to the SelectedValueChanged event.
ASKER
the content of the textboxes PanelAddTextBoxVAT and PanelAddTextBoxTotal need to change depending on the combobox value WHEN a textbox PanelAddTextBoxSubTotal is changed.
ASKER
Worked :)
ASKER
Sorry Babycorn-Starfish, changing Selectedtext to Text DID work. Thanks
ASKER