Thanks for previewing my post. If someone can tell me how to restructure the following code so that it will work with 4.0, it would be great/
I have made the start of an application with VB.Net in visual studio 2012 express. Works great with windows 7, but I need it to work with xp. To do this, I installed the updates recommended by microsoft (this alone did not work) and then tried to compile the code in vb.net 4.0. It worked...almost.
For the section of code listed below, vb.net 4.0 does not functin correctly. My goad is to send the user an error message if incorrect information is entered into a text box...If characters are entered, notify. If negative numbers are entered...notify. This works with 4.5, but not 4.0. Can anyone tell me why????
*******Note: that the LAST if statement is the only code not unexciting. So either the ErrorProvider1.Clear() does not work in the 4.0 framework or I cannot use the condition in the if statement. I just don't know what to change and to what.
Thanks!
I have made the start of an application with VB.Net in visual studio 2012 express. Works great with windows 7, but I need it to work with xp. To do this, I installed the updates recommended by microsoft (this alone did not work) and then tried to compile the code in vb.net 4.0. It worked...almost.
For the section of code listed below, vb.net 4.0 does not functin correctly. My goad is to send the user an error message if incorrect information is entered into a text box...If characters are entered, notify. If negative numbers are entered...notify. This works with 4.5, but not 4.0. Can anyone tell me why????
Private Sub txtM1_Extend_TextChanged(sender As Object, e As EventArgs) Handles txtM1_Extend.TextChanged
'Goal - Notify user if entering bad information before pressing go button
If Not IsNumeric(Me.txtM1_Extend.Text) AndAlso Me.txtM1_Extend.Text IsNot "" Then 'If the user entered something other than a number, send error message via error provider
Me.ErrorProvider1.SetError(Me.txtM1_Extend, "Only enter integers!")
GlobalVariables.m1_ExtendStatus = 0
ElseIf 1 Then
Try
If (Convert.ToInt32(Me.txtM1_Extend.Text) < 0) Then 'If user entered negative number, inform via error provider
Me.ErrorProvider1.SetError(Me.txtM1_Extend, "Only enter positive values!")
GlobalVariables.m1_ExtendStatus = 0
Else
GlobalVariables.m1_ExtendStatus = 1 'Set flag so we know what what we can send to the micro when user presses "Go" button
End If
Catch ex As Exception
'Dont care, just do not interrupt program!
End Try
End If
If (Me.txtM1_Extend.Text Is "") Then
ErrorProvider1.Clear() 'Prevent error signal from staying on
GlobalVariables.m1_ExtendStatus = 0 'Ensure we know not to send micro blank info
End If
End Sub
*******Note: that the LAST if statement is the only code not unexciting. So either the ErrorProvider1.Clear() does not work in the 4.0 framework or I cannot use the condition in the if statement. I just don't know what to change and to what.
Thanks!
Last edited by a moderator: