Simple addition of two texboxes.

By James J

Addtion of two texboxes value...

<Window x:Class="WpfApplication1.MainWindow"
         
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
         
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
         
Title="MainWindow" Height="350" Width="525">
    
<Grid>
        
<Button Content="Add" Height="23" HorizontalAlignment="Left" Margin="12,78,0,0" Name="button1" VerticalAlignment="Top" Width="120" Click="button1_Click" />
        
<TextBox Height="23" HorizontalAlignment="Left" Margin="12,12,0,0" Name="textBox1" VerticalAlignment="Top" Width="120" />
        
<TextBox Height="23" HorizontalAlignment="Left" Margin="12,41,0,0" Name="textBox2" VerticalAlignment="Top" Width="120" />
    
</Grid>
</Window>


private void button1_Click(object sender, RoutedEventArgs e)
{
             MessageBox.
Show(Convert.ToString(Convert.ToDouble(textBox1.Text) + Convert.ToDouble(textBox2.Text)), "Addition", MessageBoxButton.OK, MessageBoxImage.Information);
}

Simple addition of two texboxes.  (518 Views)