So, I'm new to VB.NET. I got a basic app in mind which pretty much does comparison factors, for example, 4 or 5 textboxes in which we only type numbers.
textbox1
wants the number range from 50 up to 100, If it's more than 100 or less than 50, it will send a msgbox "out of range".
The same thing applies to all other 3 textboxes they are in a certain range or bigger than or smaller than certain number, but all of them must be in a specific range if they are all good, then it will send a msgbox "correct" or whatsoever.
For example, my number must NOT be smaller than 1000 and NOT bigger than 1500, but any number in between is good to go.
I'm trying my best to explain my point, haha, but it's really hard.
At the same time, is it possible to make VB.NET read Excel column which has a wide range of different numbers and if that number is not in that column, then it won't work?
For example, let's say that I do have in Excel:
100
150
200
250
etc...
I do have textbox and a button so I add in the textbox let's say "50", then I click on the button, after that, it searches in the Excel column file for "50" since it's not there, it will pop-up msgbox "error" or anything like that.
Is it possible to apply it in this way using "
And
" because I want relations between all 4 textboxes?
If value1 >= 1400 And value2 >= 3 _
And value3 >= 2 And etc..... Then
Label17.Text = "VALID"
Label17.ForeColor = Color.Green
Else
Label17.Text = "INVALID"
Label17.ForeColor = Color.Red
End If
What I have tried:
Private Sub Button1_Click(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles Button1.Click
Dim value1 As Double
Double.TryParse(TextBox4.Text, value1)
Dim value2 As Double
Double.TryParse(TextBox2.Text, value2)
Dim value3 As Double
Double.TryParse(TextBox3.Text, value3)
Dim value4 As Double
Double.TryParse(TextBox1.Text, value4)
Dim count As Integer = (Form4.ListBox1.Items.Count - 1)
Dim zip As String
If value1 >= 800 Then
Label18.Text = "VALID"
Label18.ForeColor = Color.Green
Else
Label18.Text = "INVALID"
Label18.ForeColor = Color.Red
End If
If value1 = 1150 Or value1 < 3500 Then
Label19.Text = "VALID"
Label19.ForeColor = Color.Green
Else
Label19.Text = "INVALID"
Label19.ForeColor = Color.Red
End If
If value1 >= 900 Then
Label20.Text = "VALID"
Label20.ForeColor = Color.Green
Else
Label20.Text = "INVALID"
Label20.ForeColor = Color.Red
End If
If value1 = 1000 Or value1 < 2500 Then
Label21.Text = "VALID"
Label21.ForeColor = Color.Green
Else
Label21.Text = "INVALID"
Label21.ForeColor = Color.Red
End If
If value1 >= 900 Then
Label23.Text = "VALID"
Label23.ForeColor = Color.Green
Else
Label23.Text = "INVALID"
Label23.ForeColor = Color.Red
End If
If value1 >= 1100 Then
Label22.Text = "VALID"
Label22.ForeColor = Color.Green
Else
Label22.Text = "INVALID"
Label22.ForeColor = Color.Red
End If
If value1 >= 1000 Then
Label24.Text = "VALID (Only FL)"
Label24.ForeColor = Color.Green
Else
Label24.Text = "INVALID"
Label24.ForeColor = Color.Red
End If
If value1 = 1000 Then
Label25.Text = "VALID"
Label25.ForeColor = Color.Green
Else
Label25.Text = "INVALID"
Label25.ForeColor = Color.Red
End If
If value1 >= 1000 Then
Label26.Text = "VALID"
Label26.ForeColor = Color.Green
Else
Label26.Text = "INVALID"
Label26.ForeColor = Color.Red
End If
If value1 >= 1400 And value2 >= 3 And value3 >= 2 Then
Label17.Text = "VALID"
Label17.ForeColor = Color.Green
Else
Label17.Text = "INVALID"
Label17.ForeColor = Color.Red
End If
End Sub