Go Back  Xtreme Visual Basic Talk > Visual Basic .NET (2002/2003/2005/2008, including Express editions) > .NET General > Rainfall calculations


Reply
 
Thread Tools Display Modes
  #1  
Old 03-15-2010, 11:33 AM
michiganvb michiganvb is offline
Newcomer
 
Join Date: Mar 2010
Posts: 2
Default Rainfall calculations


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?

Last edited by michiganvb; 03-15-2010 at 11:41 AM.
Reply With Quote
  #2  
Old 03-15-2010, 02:04 PM
jpaugh78's Avatar
jpaugh78 jpaugh78 is offline
Senior Contributor
 
Join Date: Dec 2003
Location: Columbus, Ohio USA
Posts: 1,129
Default

Quote:
Originally Posted by michiganvb View Post
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.
Reply With Quote
  #3  
Old 03-15-2010, 07:29 PM
michiganvb michiganvb is offline
Newcomer
 
Join Date: Mar 2010
Posts: 2
Default

thank you very much, i will remember to consider all this when I am trying to write the code

and yes i always try to google.. sometimes i just cant find it or I just have a difficulty knowing how to search it
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
 
 
-->