Advertisement
Advertisement
| 04.24.2008 at 09:06PM PDT, ID: 23352637 |
|
[x]
Attachment Details
|
||
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: 41: 42: 43: 44: 45: 46: 47: 48: 49: 50: 51: 52: |
Public Class frmMain
Private mItemNum As Integer = 1
Private Function ValidateData() As Boolean
If IsNumeric(txtWeight.Text) = False Then
MessageBox.Show("Weight must be numeric.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Information)
txtWeight.Focus()
Return False
End If
If CType(txtWeight.Text, Integer) = False Then
MessageBox.Show("Weight must be an integer.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Information)
txtWeight.Focus()
Return False
End If
If Integer.Parse(txtWeight.Text) < 0 Or _
Integer.Parse(txtWeight.Text) > 500 Then
MessageBox.Show("Weight must be > 0 but < 500.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Information)
txtWeight.Focus()
Return False
End If
Return True
End Function
Private Sub btnEnter_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnEnter.Click
If ValidateData() = False Then
Exit Sub
End If
txtWeight.Text = ""
btnAnalyze.Enabled = True
mItemNum = mItemNum + 1
lblItemNumber.Text = mItemNum.ToString
End Sub
Private Sub btnAnalyze_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnAnalyze.Click
End Sub
Private Sub btnExit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnExit.Click
Close()
End Sub
End Class
|