
03-15-2010, 02:04 PM
|
 |
Senior Contributor
|
|
Join Date: Dec 2003
Location: Columbus, Ohio USA
Posts: 1,129
|
|
Quote:
Originally Posted by michiganvb
Im trying to programme a form to calculate rainfall total,average,maximum, and minimum.
how do I create the input box that opens to input the info I cant seem to find it in the tool box. Am i Missing something, and how do I set a array to calculate?
|
There isn't a control for an input box, so just use a button. When the user clicks on the button:
Code:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim iRainfall As Single
iRainfall = InputBox("Insert Rainfall", "Rainfall Calculations")
End Sub
This is just an example of course, you can put whatever you want for your text and variable names.
For saving all the data, I like using a collection, so you can save as much data as you want without having to redim it every time you add something new.
Code:
Public Class Form1
Dim iRainfall As New Collection
Dim iInput As Single
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
iInput = InputBox("Insert Rainfall", "Rainfall Calculations")
iRainfall.Add(iInput)
End Sub
End Class
So now, every time you add something via that input box, it will add it to your collection.
|
__________________
Did you Google your question before posting it here? Remember, Google is your friend. ;)
Last edited by jpaugh78; 03-15-2010 at 02:19 PM.
|