Home
Search
 
What's New
Index
Books
Links
Q & A
Newsletter
Banners
 
Feedback
Tip Jar
 
C# Helper...
 
XML RSS Feed
Follow VBHelper on Twitter
 
 
 
MSDN Visual Basic Community
 
 
 
 
 
TitleMake a cricket temperature calculator in Visual Basic 6
DescriptionThis example shows how to make a cricket temperature calculator in Visual Basic 6.
Keywordscricket, temperature, chirps, silly, game
CategoriesMiscellany, Algorithms, Puzzles and Games
 
This is a silly little temperature calculator based on the fact that a cricket's chirp rate depends on the temperature. The temperature in degrees Fahrenheit is approximately the number of chirps per 15 seconds plus 40.

When the user changes the chirps value, the program determines whether the new value looks like a number. If so, it calculates and displays the temperature. If the value doesn't look like a number, the program displays a blank string.

 
Private Sub txtChirps_Change()
Dim chirps As Integer

    If IsNumeric(txtChirps.Text) Then
        chirps = Val(txtChirps.Text)
        lblTemperature.Caption = Format$(chirps + 40, "0")
    Else
        lblTemperature.Caption = ""
    End If
End Sub
 
 
Copyright © 1997-2006 Rocky Mountain Computer Consulting, Inc.   All rights reserved.
  Updated