• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 336
  • Last Modified:

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_Leave(object sender, EventArgs e)
        {
            if (PanelAddTextBoxSubTotal.Text == "")
            {
            }
            else if(PanelAddComboBoxCurrency.SelectedText == "GBP")
            {
                double Subtotal = Convert.ToDouble(PanelAddTextBoxSubTotal.Text);
                double VAT = (Subtotal / 100 * 17.5);
                double Total = (Subtotal + VAT);

                PanelAddTextBoxVAT.Text = Convert.ToString(VAT);
                PanelAddTextBoxTotal.Text = Convert.ToString(Total);
            }
        }
0
Antonio King
Asked:
Antonio King
  • 4
1 Solution
 
Babycorn-StarfishCommented:
try .Text instead of SelectedText
0
 
Antonio KingIT ManagerAuthor Commented:
Nope no difference.
0
 
CuteBugCommented:
I think you are subscribing to the Leave event of the ComboBox.

Instead you should try to subscribe to the SelectedValueChanged event.
0
The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

 
Antonio KingIT ManagerAuthor Commented:
the content of the textboxes PanelAddTextBoxVAT and PanelAddTextBoxTotal need to change depending on the combobox value WHEN a textbox PanelAddTextBoxSubTotal is changed.
0
 
Antonio KingIT ManagerAuthor Commented:
Worked :)
0
 
Antonio KingIT ManagerAuthor Commented:
Sorry Babycorn-Starfish, changing Selectedtext to Text DID work. Thanks
0

Featured Post

The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

  • 4
Tackle projects and never again get stuck behind a technical roadblock.
Join Now