Solved

What is wrong with this if combobox selectedtext statement?

Posted on 2008-06-13
6
324 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:Alan-Yeo
  • 4
6 Comments
 
LVL 11

Accepted Solution

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

Author Comment

by:Alan-Yeo
Comment Utility
Nope no difference.
0
 
LVL 16

Expert Comment

by:CuteBug
Comment Utility
I think you are subscribing to the Leave event of the ComboBox.

Instead you should try to subscribe to the SelectedValueChanged event.
0
Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

 

Author Comment

by:Alan-Yeo
Comment Utility
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:Alan-Yeo
Comment Utility
Worked :)
0
 

Author Comment

by:Alan-Yeo
Comment Utility
Sorry Babycorn-Starfish, changing Selectedtext to Text DID work. Thanks
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Extention Methods in C# 3.0 by Ivo Stoykov C# 3.0 offers extension methods. They allow extending existing classes without changing the class's source code or relying on inheritance. These are static methods invoked as instance method. This…
Introduction This article series is supposed to shed some light on the use of IDisposable and objects that inherit from it. In essence, a more apt title for this article would be: using (IDisposable) {}. I’m just not sure how many people would ge…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

772 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

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now