Board index » Visual Studio » Calculation Problem
|
ScndTim
|
Calculation Problem
Visual Studio226
I am having problems with the following: I have a text box for a user to enter data. I have a 'calculate' button. When a user clicks the calculate button, I need the following code to be processed: -verify that the user entered numbers of a specific range into that text box (1-100) -verify that the number is greater than 0 -verify that it was a number that was entered using the IsNumeric function -if all is true and good, then I need to pass the data the user entered to another variable called idb1OutOf1. How do I do this? txtoutof1 is the text box that the user has to enter data into. See below - very badly written because I don't quite know how to do this. Private Sub cmdCalculate_Click(Index As Integer) ' Added '&' symbol in front of Calculate to create a HotKey for 'C' ' Changed the 'Default' property on cmdCalculate button to TRUE to make it the default button ' Declare a variable for the numeric value range to test for Dim iNumvalue As Integer iNumvalue = 1 - 100 If frmMain.txtOutof1 =>0 And IsNumeric(iNumvalue) = True Then iNumvalue = idb1Outof1 Else: MsgBox "Mark information missing, please re-enter.", vbOKOnly + vbcritital, "User Error!" End If End Sub - |
