Solved

What is wrong with this if combobox selectedtext statement?

Posted on 2008-06-13
6
329 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
MS Dynamics Made Instantly Simpler

Make Your Microsoft Dynamics Investment Count  & Drastically Decrease Training Time by Providing Intuitive Step-By-Step WalkThru Tutorials.

 

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

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

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

Introduction Although it is an old technology, serial ports are still being used by many hardware manufacturers. If you develop applications in C#, Microsoft .NET framework has SerialPort class to communicate with the serial ports.  I needed to…
Introduction Hi all and welcome to my first article on Experts Exchange. A while ago, someone asked me if i could do some tutorials on object oriented programming. I decided to do them on C#. Now you may ask me, why's that? Well, one of the re…
This video Micro Tutorial shows how to password-protect PDF files with free software. Many software products can do this, such as Adobe Acrobat (but not Adobe Reader), Nuance PaperPort, and Nuance Power PDF, but they are not free products. This vide…
In this video we outline the Physical Segments view of NetCrunch network monitor. By following this brief how-to video, you will be able to learn how NetCrunch visualizes your network, how granular is the information collected, as well as where to f…

690 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