When working with numbers in Visual Basic, you can use the 'IsNumeric' function to check if something is numeric. Such as 'IsNumeric(txtIncome.Text)', this is checking to see if the text in the txtIncome textbox is only numeric. It can be used in an 'If' statement to carry on with your intended program if it is only numbers or stop the program and warn the user if they have entered wrong text.
The 'Val' function is used before a variable or text box to turn the information in the text box into and integer. Such as 'Val(txtIncome.Text)'. This is turning the information in txtIncome into numbers.
While using Visual basic, it is sometime useful to edit out some lines of code to find problems or mistakes. You can do this by putting a ' before the line. E.g. 'iIncome = Val(txtIncome.Text). This line will then become green and will not be used in the code. You can also use this to write yourself notes about what is happening in your code, for example, 'Declaring Variables.
No comments:
Post a Comment