I know im suppose to show code, but im stuck on how to make an integer, I kinda feel bad wasting a thread for a simple answer, but I cant figure it out, what im trying to do it make an integer values in the range of 10 to 1000. Could someone help me
Dim iMyCoolInteger As Integer = 99 '// your Integer.
If iMyCoolInteger >= 10 AndAlso iMyCoolInteger <= 1000 Then '// check if value is within your preset bounds.
MsgBox("Sucess: Integer is within bounds")
Else '// if not within bounds.
MsgBox("Fail: Integer is less than or greater than preset bounds", MsgBoxStyle.Critical)
im sorry I forgot to put an extra 0 at the end of 1000, but it probably doesnt matter, ill just make iMyCoolInterger <= 1000 to iMyCoolInterger <= 10000, but I do have a question, why do I need to Dim my integer to 99, is there a reason why? (im just curious)
>> ...but I do have a question, why do I need to Dim my integer to 99, is there a reason why? (im just curious)
You do not need it, it is there for testing purposes.
.If getting values from a TextBox, use If Cint(TextBox1.Text) >= 10 AndAlso Cint(TextBox1.Text)<= 1000 Then instead. Cint is to Convert to Integer since .Text is considered a String.
ok I understand now, but when I tested the code it came up as an error, the code doesnt have an error in particular, but if I start typing numbers in it, it thinks thats my final number before I finish, is there a way I could put all the numbers in and then click away from the textbox and if there is an error an error message will pop up, but if there isnt an error, nothing happens?