Hi everyone I am fairly new to programming VB. Net I have a program I have written to calculate the totals of snowfall for an each month and make it a yearly total for snow fall. Here is the code I currently have.
Public Class Form1 Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click Dim a As Integer a = InputBox("Enter the snowfall totals month by month: ") ListBox1.Items.Add(a) End Sub Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click Dim Total As Integer For Each Str As String In ListBox1.Items Total = Total + CInt(Str) Next TextBox1.Text = Total End Sub End Class
I need for the program to check if the values are positive only and are not negative or non-numeric. Any help would be greatly appreciated. I know my syntax for variables isn't correct at the moment but I will be renaming variables once the program is fully functional.