Solved

What is wrong with this if combobox selectedtext statement?

Posted on 2008-06-13
6
328 Views
Last Modified: 2010-04-21
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
Comment
Question by:Antonio King
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
6 Comments
 
LVL 11

Accepted Solution

by:
Babycorn-Starfish earned 500 total points
ID: 21778691
try .Text instead of SelectedText
0
 

Author Comment

by:Antonio King
ID: 21778780
Nope no difference.
0
 
LVL 16

Expert Comment

by:CuteBug
ID: 21778930
I think you are subscribing to the Leave event of the ComboBox.

Instead you should try to subscribe to the SelectedValueChanged event.
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:Antonio King
ID: 21779207
the content of the textboxes PanelAddTextBoxVAT and PanelAddTextBoxTotal need to change depending on the combobox value WHEN a textbox PanelAddTextBoxSubTotal is changed.
0
 

Author Closing Comment

by:Antonio King
ID: 31466920
Worked :)
0
 

Author Comment

by:Antonio King
ID: 21779259
Sorry Babycorn-Starfish, changing Selectedtext to Text DID work. Thanks
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Article by: Ivo
C# And Nullable Types Since 2.0 C# has Nullable(T) Generic Structure. The idea behind is to allow value type objects to have null values just like reference types have. This concerns scenarios where not all data sources have values (like a databa…
Performance in games development is paramount: every microsecond counts to be able to do everything in less than 33ms (aiming at 16ms). C# foreach statement is one of the worst performance killers, and here I explain why.
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…

749 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question