Click here to Skip to main content
15,915,702 members
Home / Discussions / C#
   

C#

 
AnswerRe: Using an Array inside a Class Pin
Pete O'Hanlon29-Aug-12 22:47
mvePete O'Hanlon29-Aug-12 22:47 
AnswerRe: Using an Array inside a Class Pin
harold aptroot30-Aug-12 2:39
harold aptroot30-Aug-12 2:39 
QuestionHow to get the properties of more than one display monitor attached to my computer Pin
Nathaniel Lim29-Aug-12 10:09
Nathaniel Lim29-Aug-12 10:09 
AnswerRe: How to get the properties of more than one display monitor attached to my computer Pin
Dave Kreskowiak29-Aug-12 13:04
mveDave Kreskowiak29-Aug-12 13:04 
QuestionRecruitment Pin
boys-esan29-Aug-12 10:09
boys-esan29-Aug-12 10:09 
QuestionGet Error when connect to DB2 on server Pin
kathytran29-Aug-12 7:07
kathytran29-Aug-12 7:07 
AnswerRe: Get Error when connect to DB2 on server Pin
Dave Kreskowiak29-Aug-12 12:58
mveDave Kreskowiak29-Aug-12 12:58 
QuestiontextBoxes Calculation issue Pin
haroon198029-Aug-12 6:30
haroon198029-Aug-12 6:30 
Hello,

When i use below code - App launches and when entering values it loops two times through my if(tb != null) function - Any idea please?
And then somehow my total text box same value twice.




C#
public Form()
        {
            InitializeComponent();
            TextBox[] tbs = new TextBox[] { monTxtBox, tuesTxtBox, wedTxtBox, thurTxtBox, frdtxtBox };
            foreach (var c in tbs)
            c.TextChanged += new EventHandler(textBoxes_TextChanged); //create a common event for all textBoxes
        }
        
        private void textBoxes_TextChanged(object sender, EventArgs e)
        {
            TextBox tb = sender as TextBox;
            if(tb != null)
            {
                decimal temp =0;
                if(decimal.TryParse(tb.Text,out temp))
                {
                    if(temp < 1)
               //     totalTimetxtBox.Text = Convert.ToDecimal(tb.Text.Replace(",",".").ToString())+temp;
                     totalTimetxtBox.Text = tb.Text+temp;
            else
                MessageBox.Show("Please enter the number between 0 and 1.");
                }
        else
            MessageBox.Show("Please enter a decimal value only!");
            }
        }

AnswerRe: textBoxes Calculation issue Pin
Wes Aday29-Aug-12 6:46
professionalWes Aday29-Aug-12 6:46 
GeneralRe: textBoxes Calculation issue Pin
haroon198029-Aug-12 6:51
haroon198029-Aug-12 6:51 
GeneralRe: textBoxes Calculation issue Pin
Wes Aday29-Aug-12 6:54
professionalWes Aday29-Aug-12 6:54 
GeneralRe: textBoxes Calculation issue Pin
haroon198029-Aug-12 10:58
haroon198029-Aug-12 10:58 
GeneralRe: textBoxes Calculation issue Pin
Dave Kreskowiak29-Aug-12 12:52
mveDave Kreskowiak29-Aug-12 12:52 
GeneralRe: textBoxes Calculation issue Pin
haroon198029-Aug-12 23:49
haroon198029-Aug-12 23:49 
GeneralRe: textBoxes Calculation issue Pin
Dave Kreskowiak30-Aug-12 1:41
mveDave Kreskowiak30-Aug-12 1:41 
QuestionBlank lines in a rich text box from a Serial Device, am I getting rid of them correctly..... Pin
glennPattonWork329-Aug-12 4:21
professionalglennPattonWork329-Aug-12 4:21 
AnswerRe: Blank lines in a rich text box from a Serial Device, am I getting rid of them correctly..... Pin
Pete O'Hanlon29-Aug-12 4:30
mvePete O'Hanlon29-Aug-12 4:30 
GeneralRe: Blank lines in a rich text box from a Serial Device, am I getting rid of them correctly..... Pin
glennPattonWork329-Aug-12 5:00
professionalglennPattonWork329-Aug-12 5:00 
GeneralRe: Blank lines in a rich text box from a Serial Device, am I getting rid of them correctly..... Pin
Pete O'Hanlon29-Aug-12 5:13
mvePete O'Hanlon29-Aug-12 5:13 
GeneralRe: Blank lines in a rich text box from a Serial Device, am I getting rid of them correctly..... Pin
glennPattonWork329-Aug-12 5:37
professionalglennPattonWork329-Aug-12 5:37 
GeneralRe: Blank lines in a rich text box from a Serial Device, am I getting rid of them correctly..... Pin
PIEBALDconsult29-Aug-12 6:05
mvePIEBALDconsult29-Aug-12 6:05 
GeneralRe: Blank lines in a rich text box from a Serial Device, am I getting rid of them correctly..... Pin
glennPattonWork329-Aug-12 6:15
professionalglennPattonWork329-Aug-12 6:15 
GeneralRe: Blank lines in a rich text box from a Serial Device, am I getting rid of them correctly..... Pin
PIEBALDconsult29-Aug-12 5:37
mvePIEBALDconsult29-Aug-12 5:37 
GeneralRe: Blank lines in a rich text box from a Serial Device, am I getting rid of them correctly..... Pin
glennPattonWork329-Aug-12 5:42
professionalglennPattonWork329-Aug-12 5:42 
GeneralRe: Blank lines in a rich text box from a Serial Device, am I getting rid of them correctly..... Pin
glennPattonWork329-Aug-12 6:14
professionalglennPattonWork329-Aug-12 6:14 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.