Friday, November 19, 2010

How do you show a message box error in visual basic? vb programmers, help plz?

it needs to come up if the numbers entered in the previoustextbox.text and the currenttextbox.text aren't numbers or if the currenttextbox.text has a lower number than the previoustextbox.text..





something like if previous=';'; then messagebox.show blah blah blah...i dont know what goes in the quotations....plz helpHow do you show a message box error in visual basic? vb programmers, help plz?
MsgBox(';Bla Bla...';, MsgBoxStyle.Critical, ';Error!';)How do you show a message box error in visual basic? vb programmers, help plz?
Something like this (this is VB .net), but vb6 has IsNumeric() function as well.



This tells whether it is a number INT and SINGLE, DOUBLE and whether current is less than previous.



You must cast string ';'; as a number. Function checks clean to see if math function would cause an error. If they are numbers then proceed to math check.





Dim text As String = ';123.50';



Dim previous_text As String = ';123';



If IS_number(text) And IS_number(previous_text) Then



MsgBox(';number';)



If CSng(text) %26lt; CSng(previous_text) Then



MsgBox(';current is less than previous';)



Else



MsgBox(';current is NOT less than previous';)



End If



Else



MsgBox(';one or both is/are not number';)



End If



End Sub



Public Function IS_number(ByVal text As String) As Boolean



For Each character In text.ToCharArray



If Not IsNumeric(character) And character %26lt;%26gt; ';.'; Then



Return False



Exit Function



End If



Next



Return True



End Function





Good Luck.

No comments:

Post a Comment