I was very sloppy with the code, using all the default names and values for everything. Look for yourself -- it's [tt]if[/tt] programming.
- Code: Select all
Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
If ComboBox1.Text = "+" Then TextBox3.Text = Val(TextBox1.Text) + Val(TextBox2.Text)
If ComboBox1.Text = "-" Then TextBox3.Text = Val(TextBox1.Text) - Val(TextBox2.Text)
If ComboBox1.Text = "*" Then TextBox3.Text = Val(TextBox1.Text) * Val(TextBox2.Text)
If ComboBox1.Text = "/" Then TextBox3.Text = Val(TextBox1.Text) / Val(TextBox2.Text)
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
TextBox3.Text = ((Val(TextBox1.Text) + Val(TextBox2.Text)) / 2)
End Sub
End Class
All operations tested and working.
UserAgent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.0.1) Gecko/20060130 Donzilla/1.1PR1 (WML/1.3)




