I need to run an If Statement that will check a few conditions.
Basically I want to get it to check a value held in a variable "Temperature"
and if the value is within "1" eaither way i.e. +-1 of the value held within
the variable to then to output a text string to Label200.Text Else if the
condition is not met then out put another text string to Label200.Text.
Say if Temperature value held in the variable Temperature is 8.5
the if statement checks to see if the DewPoint value is "between" +-1 of the
temperature value. i.e. 7.5 to 9.5 as well as the value in
Humidity is equal to or greater than 90 and Pressure is Less than or Equal
to 1013.25 then the conditon is met, else the conditon is not met.
I hope the above makes sence.
I have put some code together below in NotePad++ to see if what I am trying to
do is the correct way to go about it (please note I have not yet tried this code
in VB.NET as I don't have it at work).
Could someone pass comment on the code and if it is wrong explain what I should
do to get it to work.
Dim DewPoint as Single Dim Temperature as Single Dim Humidity as Single Dim Pressure as Single DewPoint = Label5.Text Temperature = Label3.Text Humidity = Label4.Text Pressure = Label11.Text If DewpPoint = Temperature -1 Or DewPoint = Temperature +1 And Humidity >=90 And Pressure <= 1013.25 then Label200.Text = "Precipitation Possible" Else Label200.Text = "No Precipitation likely" End If
I am not sure that the code: Temperature -1 Or DewPoint = Temperature +1 will check for
the values inbetween minus 1 of the Temperature value up to plus 1 of the Temperature Value.
i.e. 7.5, 7.6, 7.7, 7.8 ........ 9.1, 9.2, 9.3, 9.4, 9.5
Any help would be appriciated.
Thanks in advance.