Metric-US Converter/Metric-US Converter/Form1.cs
/// <summary>
/// On the button click of Convert.  Get the value in the TxtBoxInput field and
/// the value in the cmbConversion drop down box and Convert them to the appropriate 
/// values
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
On the button click of Convert.  Get the value in the TxtBoxInput field and
the value in the cmbConversion drop down box and Convert them to the appropriate
values
On the button click of Convert . Get the value in the TxtBoxInput field and the value in the cmbConversion drop down box and Convert them to the appropriate values
private void button1_Click(object sender, EventArgs e)
        {
            double inputValue;
            int convertFromIndex;
            int convertToIndex;
            int conversionType;
            if (TxtBoxInput.Text == "")
            {
                MessageBox.Show("Value to Convert is a required field.");
                TxtBoxInput.Focus();
                return;
            }
            try
            {
                inputValue = double.Parse(TxtBoxInput.Text);
            }
            catch(FormatException)
            {
                MessageBox.Show("Value to Convert must be numeric.");
                TxtBoxInput.Focus();
                return;
            }
            convertFromIndex = cmboConvertFrom.SelectedIndex;
            convertToIndex = cmboConvertTo.SelectedIndex;
            conversionType = conversionTypeCmbBox.SelectedIndex;
            Converter myConverter = new Converter(inputValue, convertFromIndex, convertToIndex, conversionType);
            TxtBoxResult.Text = myConverter.Do_Conversion();
            TxtBoxInput.Focus();
        }
private void button1_Click ( object sender , EventArgs e ) { double inputValue ; int convertFromIndex ; int convertToIndex ; int conversionType ; if ( TxtBoxInput . Text == " " ) { MessageBox . Show ( " " ) ; TxtBoxInput . Focus ( ) ; return ; } try { inputValue = double . Parse ( TxtBoxInput . Text ) ; } catch ( FormatException ) { MessageBox . Show ( " " ) ; TxtBoxInput . Focus ( ) ; return ; } convertFromIndex = cmboConvertFrom . SelectedIndex ; convertToIndex = cmboConvertTo . SelectedIndex ; conversionType = conversionTypeCmbBox . SelectedIndex ; Converter myConverter = new Converter ( inputValue , convertFromIndex , convertToIndex , conversionType ) ; TxtBoxResult . Text = myConverter . Do_Conversion ( ) ; TxtBoxInput . Focus ( ) ; }
On the button click of Convert.
On the button click of Convert .
//check to see if input is numeric, if not throw exception //Instantiate Converter Class and call the do_conversion method to  //perform the conversion.
sender
object
None
e
EventArgs
None