
08-01-2010, 05:59 AM
|
|
Newcomer
|
|
Join Date: Aug 2010
Posts: 2
|
|
simple question about IF CONDITIONS.
|
Hi ,
I have a question about if conditions - I have this code:
Code:
Private Sub ComboBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ComboBox1.SelectedIndexChanged
If TextBox1.Text = "" Then
MessageBox.Show("יש להכניס גובה מבנה-קודקוד הגג")
End If
If IsNumeric(TextBox1.Text) Then
If TextBox1.Text > 200 Then
MessageBox.Show("לפי התקן ניתן לתכנן רק מבנים הנמוכים מ-200 מ")
End If
End If
If ComboBox1.SelectedItem IsNot Nothing Then
Dim ans As Double
ans = ComboBox1.SelectedItem
Select Case ans
Case -1
MessageBox.Show("יש לבחור את דרגת החספוס")
Case 0
TextBox3.Text = 0.153
TextBox4.Text = 0.003
TextBox5.Text = 1.0
Case 1
TextBox3.Text = 0.17
TextBox4.Text = 0.01
TextBox5.Text = 1.0
Case 2
TextBox3.Text = 0.19
TextBox4.Text = 0.05
TextBox5.Text = 2.0
Case 3
TextBox3.Text = 0.215
TextBox4.Text = 0.3
TextBox5.Text = 5.0
Case 4
TextBox3.Text = 0.234
TextBox4.Text = 1.0
TextBox5.Text = 10.0
End Select
End If
Dim a As Double
Dim b As Double
Dim c As Double
a = TextBox3.Text * Math.Log(TextBox1.Text / TextBox4.Text)
TextBox7.Text = a
b = 1 / (1 * Math.Log(TextBox1.Text / TextBox4.Text))
TextBox8.Text = b
c = a ^ 2 * 1 ^ 2 * (1 + 2 * 3.5 * b)
TextBox6.Text = c
End Sub
It means that I have a combobox and a text box.
If I type a value in the textbox and after that choose a value from the combobox it works just fine, the problem is when I leave this textbox blank -it gives the massgae  "יש להכניס גובה מבנה-קודקוד הגג") , and gives an error , I want the code to give me the option to type a value in the textbox and only then to calculate.
I'm sure I was wrong with the position of the condition.
thank for the helpers
|
|