Google
 

Sunday, December 10, 2006

Lucky 7 Game Coding using Vb.net

As part of my first year ICT practitioner Module I had to build this Lucky 7 gAME using vb.net.. it ws fun and engaging so i decided to share the coding with everyone(this is better thn saying i wanted to show off Grin ... HEY HOLD on i just said tht . Well nvrmind )

Public Class Form2
Inherits System.Windows.Forms.Form
'declaration of variables used by the program
Dim guess1 As Integer
Dim guess2 As Integer
Dim guess3 As Integer
Dim wincount As Integer
Dim spincount As Integer

Private Sub clearvalues()
'initialises the values of the count values and generates 3 random numbers
wincount = 0
spincount = 0
Randomize()
Randomize()
guess1 = (Int(Rnd() * 9) + 0)
guess2 = (Int(Rnd() * 9) + 0)
guess3 = (Int(Rnd() * 9) + 0)

End Sub
Private Sub rndvalues()
'calls randomizer function and generates 3 random values
Randomize()
guess1 = (Int(Rnd() * 9) + 0)
guess2 = (Int(Rnd() * 9) + 0)
guess3 = (Int(Rnd() * 9) + 0)

End Sub
Private Sub showvalues()
'displays the random numbers in respective label
lblguess1.Text = guess1
lblguess2.Text = guess2
lblguess3.Text = guess3



End Sub
Private Sub wincounter()
'checks each random number for the value 7 and displays the approriate message
If guess1 = guess2 = guess3 = 7 Then
Call incrementwincountby3()

lblmsg.Text = Form1.newname.Text & " " & "You have hit the JACKPOT"
System.Console.Beep()

Else
If guess1 = guess2 = 7 Then
Call incrementwincountby2()

lblmsg.Text = Form1.newname.Text & " " & "You have a Double win"
System.Console.Beep()


Else
If guess1 = guess3 = 7 Then
Call incrementwincountby2()

lblmsg.Text = Form1.newname.Text & " " & "You have a Double win"
System.Console.Beep()

Else
If guess3 = guess2 = 7 Then
Call incrementwincountby2()

lblmsg.Text = Form1.newname.Text & " " & "You have a Double win"
System.Console.Beep()
Else
If guess1 = 7 Then
incrementwincountby1()

lblmsg.Text = Form1.newname.Text & " " & "You are a winner"
System.Console.Beep()

Else
If guess2 = 7 Then
incrementwincountby1()

lblmsg.Text = Form1.newname.Text & " " & "You are a winner"
System.Console.Beep()


Else
If guess3 = 7 Then
incrementwincountby1()

lblmsg.Text = Form1.newname.Text & " " & "You are a winner"
System.Console.Beep()

Else

lblmsg.Text = Form1.newname.Text & " " & "Try Again"
End If
End If
End If
End If
End If
End If
End If

End Sub
Private Sub incrementwincountby1()
'adds 1 to the wincount
wincount = wincount + 1
lblwincount.Text = wincount


End Sub
Private Sub incrementwincountby2()
'adds 2 to the wincount
wincount = wincount + 2
lblwincount.Text = wincount

End Sub
Private Sub incrementwincountby3()
'adds 3 to the wincount
wincount = wincount + 3
lblwincount.Text = wincount

End Sub

Private Sub spincounter()
'adds 1to the spincount
spincount = spincount + 1
lblspincount.Text = spincount


End Sub
Private Sub cmdspin_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdspin.Click
'gets all the functions to run on the clicking spin button
Call rndvalues()
Call showvalues()
Call wincounter()
Call spincounter()


End Sub
Private Sub cmdexit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdexit.Click
Me.Close()
Form1.Close()

End Sub
Private Sub cmdrestart_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdrestart.Click
' calls required functions to restart application
Call clearvalues()
Call showvalues()



End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'calls procedures to initializes the values of the application
Call clearvalues()
Call showvalues()
lblwincount.Text = wincount
lblspincount.Text = spincount
lblmsg.Text = "Try your hand"

End Sub


End Class

24 comments:

Anonymous said...

I am getting an iphone in the next couple weeks because my plans up.. i just wannted to know what accessories does it come with and do you get any itunes credit or anything with it? thanks!
[url=http://forexrobot-review.info]best forex software[/url] [url=http://forums.psychaotic.com/viewtopic.php?f=4&t=262&p=1995#p1995]unlock iphone[/url]

Anonymous said...

Hi I'd like to congratulate you for such a terrific made forum!
Was thinking this is a nice way to make my first post!

Sincerely,
Monte Phil
if you're ever bored check out my site!
[url=http://www.partyopedia.com/articles/cars-party-supplies.html]cars Party Supplies[/url].

Anonymous said...

free dating site in australia [url=http://loveepicentre.com/]dating north devon england[/url] single datings free subscription http://loveepicentre.com/ online dating

Anonymous said...

Hello I'd like to thank you for such a great quality forum!
Was thinking this is a nice way to make my first post!
We believe the only way establish fortune it is usually a sharp conception to start a savings or investing strategy as soon in life as achievable. But don't fear if you have not started saving your money until later on in life. With the help of honest work, that is consulting the best investment vehicles for your money you can slowly but surely increase your wealth so that it amounts to a huge sum by the time you hope to retire. Observe all of the accessible asset classes from stocks to real estate as investments for your money. A researched and diversified portfolio of investments in various asset classes can help your money increase throughout the years.

-Clare Grafton
[url=http://urwealthy.com]currency exchange rates[/url]

Anonymous said...

Hello. My wife and I bought our house about 6 months ago. It was a foreclosure and we were able to get a great deal on it. We also took advantage of the 8K tax credit so that definitely helped. We did an extensive remodeling job and now I want to refinance to cut the term to a 20 or 15 year loan. Does anyone know any good sites for mortgage information? Thanks!

Mike

Anonymous said...

Howdy,

I keep coming to this website[url=http://www.weightrapidloss.com/lose-10-pounds-in-2-weeks-quick-weight-loss-tips].[/url]You have really contiributed very good info here rouge-echostation.blogspot.com. I am sure due to busy scedules we really do not get time to care about our health. Let me present you with one fact here. Recent Research shows that about 80% of all U.S. adults are either obese or weighty[url=http://www.weightrapidloss.com/lose-10-pounds-in-2-weeks-quick-weight-loss-tips].[/url] Hence if you're one of these citizens, you're not alone. Infact many among us need to lose 10 to 20 lbs once in a while to get sexy and perfect six pack abs. Now the question is how you are planning to have quick weight loss? You can easily lose with with little effort. You need to improve some of you daily habbits to achive weight loss in short span of time.

About me: I am writer of [url=http://www.weightrapidloss.com/lose-10-pounds-in-2-weeks-quick-weight-loss-tips]Quick weight loss tips[/url]. I am also health trainer who can help you lose weight quickly. If you do not want to go under difficult training program than you may also try [url=http://www.weightrapidloss.com/acai-berry-for-quick-weight-loss]Acai Berry[/url] or [url=http://www.weightrapidloss.com/colon-cleanse-for-weight-loss]Colon Cleansing[/url] for effective weight loss.

Anonymous said...

dosage amounts of goldenseal herb for cats [url=http://usadrugstoretoday.com/products/chloroquine.htm]chloroquine[/url] great depression and japanese imperialism http://usadrugstoretoday.com/products/lithium-carbonate.htm differential diagnoses for asthma http://usadrugstoretoday.com/products/stress-gum.htm
dicuss the importance of restin relation to good health [url=http://usadrugstoretoday.com/products/synthroid.htm]synthroid[/url] motley crue and drugs [url=http://usadrugstoretoday.com/categories/anti-hongos---anti-ansiedad.htm]percentage of nitrogenous base of human kidney[/url]

Anonymous said...

share travel expense executive jet http://greatadventures.in/adventure/super-monkey-ball-adventure-walkthroughs travel insurance claim line uk
[url=http://greatadventures.in/cruise/long-beach-ca-cruise-port]complaints special t travel company[/url] visa requirement for travel to the philippines [url=http://greatadventures.in/travel/internet-travel-business]internet travel business[/url]
travel maine http://greatadventures.in/disneyland/disneyland-welcome-tour
[url=http://greatadventures.in/tourism/lightning-ridge-australia-tourism]timw travel alice in wonderland[/url] anna travel agency meserole avenue brooklyn [url=http://greatadventures.in/tour]tour[/url]
game travel lodge http://greatadventures.in/motel/wingate-motel-cleveland-oh cheltenham travel lodge [url=http://greatadventures.in/adventure/adventure-tour-reviews-exodus]adventure tour reviews exodus[/url]

Anonymous said...

magazine adds and polo and ralph lauren http://topcitystyle.com/black-shorts-color2.html easyspiritshoes [url=http://topcitystyle.com/black-brown-leather-bags-tote-purses-color163.html]russian female fashion model[/url] macbeth bonham united brown shoes
http://topcitystyle.com/women-s-tops-page11.html discount clothes [url=http://topcitystyle.com/fabric-of-life-shirts-brand87.html]miva ecommerce website designers[/url]

Anonymous said...

replica chanel sunglasses http://topcitystyle.com/-v-neck-category68.html calvin klein totebag [url=http://topcitystyle.com/blue-turquoise-color79.html]career brand name shoes sales[/url] boy wears girls clothes
http://topcitystyle.com/pink-grey-leather-shoes-color220.html cheap teen clothes [url=http://topcitystyle.com/black-orange-tunic-color208.html]victorian era fashion[/url]

Anonymous said...

baby shoes wigan http://topcitystyle.com/m-tank-tops-size5.html charlotte moss interior designer [url=http://topcitystyle.com/tank-tops-page4.html]giada de laurentiis nude[/url] dr eric kleinstein
http://topcitystyle.com/s-round-neck-size10.html toddler boutique clothing shoes [url=http://topcitystyle.com/42-leather-shoes-size23.html]history of chanel strore[/url]

Anonymous said...

van ness travel http://adventurecollection.in/adventure/paperback-books-adventure-mystrey-best-sellers-2007 used travel trailers for sale in texas
[url=http://adventurecollection.in/disneyland/map-of-disneyland-park]yellowstone tour and travel[/url] canton island travel [url=http://adventurecollection.in/tourism/definition-of-tourism]definition of tourism[/url]
canada christmas travel hotel http://adventurecollection.in/map/uncw-moonlight-5k-course-map
[url=http://adventurecollection.in/motel/motel-6-indiana]travel charger nokia[/url] strollers travel system [url=http://adventurecollection.in/hotel/hotel-innova-paris]hotel innova paris[/url]
swiss national travel office http://adventurecollection.in/flight/flight-promotional-codes current event about travel [url=http://adventurecollection.in/adventure/alaska-wildlife-adventure-company]alaska wildlife adventure company[/url]

Anonymous said...

adult escort australia http://xwe.in/fetish/rectal-cheeks-fetish
[url=http://xwe.in/girl-anal/anal-sex-dangers]free dildo lesbians[/url] vivid ipod porn [url=http://xwe.in/orgasm/thigh-massage-accidental-orgasm]thigh massage accidental orgasm[/url]
tsunade and shizune hentai http://xwe.in/gay-boy/download-gay-porn-video
[url=http://xwe.in/nylon/pvc-nylon-diaper-bags]amateur poems online[/url] adult uk model directory [url=http://xwe.in/blowjob/teen-blowjob]teen blowjob[/url]
pay per minute adult web cam chat http://xwe.in/fetish/ron-andrews-ultimate-smoking-fetish
[url=http://xwe.in/bdsm/tied-and-gagged-bdsm]kiddy porn tgp[/url] sexy online rpg games [url=http://xwe.in/bdsm/bdsm-pictures-for-free]bdsm pictures for free[/url]
sexy cat pictures http://xwe.in/toon/kim-possible-toon-porn
[url=http://xwe.in/gay-boy/sawmill-gay-campground]edpowers adult videos[/url] virgin ass pics [url=http://xwe.in/blowjob/japanese-blowjob]japanese blowjob[/url]

Anonymous said...

globe skate shoes http://www.thefashionhouse.us/black-multicolored-color63.html fashion figure template [url=http://www.thefashionhouse.us/guess-unisex-beach-towel-red-navy-blue-item2095.html]kiwi shoeshine kit[/url] web site designer software
http://www.thefashionhouse.us/?action=products&product_id=2491 premature baby clothes [url=http://www.thefashionhouse.us/light-blue-t-shirts-for-men-color58.html]gothic baby clothes[/url]

Anonymous said...

lawsuit nurse medical [url=http://usadrugstoretoday.com/products/altace.htm]altace[/url] drug addicted nurse http://usadrugstoretoday.com/categories/disfunzione-erettile.htm
summit medical center nashville tennessee [url=http://usadrugstoretoday.com/products/symmetrel.htm]symmetrel[/url] lamb breast recipe [url=http://usadrugstoretoday.com/products/karela.htm ]cholesterol diet high patient [/url] auriculotherapy smoking
infections signs in cows [url=http://usadrugstoretoday.com/products/trimox.htm]trimox[/url] florida instant health insurance quote http://usadrugstoretoday.com/products/leukeran.htm
castleman blood disorder [url=http://usadrugstoretoday.com/products/keftab.htm]keftab[/url] vigina penis penetration [url=http://usadrugstoretoday.com/products/advair-diskus.htm ]facts on depression [/url] salaries in health insurance companies

buy viagra said...

thanks for sharing!!!
viagra online
generic viagra

Anonymous said...

omg shoes lyrics great song http://www.thefashionhouse.us/black-golden-pants-color92.html gay nineties fashion [url=http://www.thefashionhouse.us/white-blue-long-sleeve-tops-color55.html]designer radiators[/url] sourshoes
http://www.thefashionhouse.us/roberto-cavalli-women-top-lilac-item1931.html designer bathrooms [url=http://www.thefashionhouse.us/accessories-type5r.html]whoischanel[/url]

Anonymous said...

http://xwp.in/immune/auto-immune-aarda-gov
[url=http://xwp.in/amitriptyline/amitriptyline-side-effects]christain family health[/url] university of tennessee pharmacy http://xwp.in/amoxicillin/amoxicillin-children-joint
drug quotes from star wars characters http://xwp.in/casodex/casodex-pricing
[url=http://xwp.in/detrol/flomax-and-detrol]buy generic cialis online[/url] which candidates want universal health care http://xwp.in/epivir
experiences with generic cialis http://xwp.in/ibuprofen/benadryl-ibuprofen-children-htm
[url=http://xwp.in/ceftin]thom yorke bps drugstore[/url] drug testing privacy laws wyoming http://xwp.in/cardura/cardura-blood-pressure my anti drug http://xwp.in/diclofenac/vulture-and-diclofenac-piosoning

Anonymous said...

http://xwv.in/linezolid/linezolid/urinary/tract/infection/staph/aureus
[url=http://xwv.in/naproxen/naproxen/package/insert]advantages of online pharmacy[/url] perscription drugs politically attractive [url=http://xwv.in/lopid/lioresal/1/amp/ref/kit/medt]lioresal 1 amp ref kit medt[/url]
drug treatment in dallas texas http://xwv.in/weight-loss/hcg/for/weight/loss/problems
[url=http://xwv.in/kidney/what/is/the/best/exercise/to/make/my/kidney/become/strong]math in drugs[/url] egypt online pharmacy [url=http://xwv.in/zyban/zyban/side/effects/affects]zyban side effects affects[/url]
hallucinogenic drugs wikipedia http://xwv.in/xanax/erowid/xanax
[url=http://xwv.in/pamelor/pamelor/medication]what is erectile disfunction[/url] didrex pharmacy online [url=http://xwv.in/paroxetine/paroxetine/price]paroxetine price[/url] federal laws and performance enhancing drugs [url=http://xwv.in/pamelor/pamelor/ss]pamelor ss[/url]

Anonymous said...

ferragamo shoes women http://topcitystyle.com/military-green-color138.html web designer job description [url=http://topcitystyle.com/m-dress-shirts-size5.html]high top prada shoes for men[/url] johnson and murphy shoes
http://topcitystyle.com/blue-white-on-sale-color87.html what fashion house designed the infamous dress that jennifer lopez rocked on the red carpet [url=http://topcitystyle.com/white-green-color57.html]laurens county georgia intern programs[/url]

Anonymous said...

kansas bingo commission http://wqm.in/online-casino_palms-casino-las-vegas games to play on casino bus trip
[url=http://wqm.in/keno_sign-for-keno-gold]sports book betting odd[/url] the joker halloween costume [url=http://wqm.in/blackjack_blackjack-26-battery-life]blackjack 26 battery life[/url]
casino rama room rates http://wqm.in/bingo_bingo-and-game
[url=http://wqm.in/roulette_roulette-odds]video lottery terminal[/url] georgia skin gambling [url=http://wqm.in/poker-online_play-fun-poker]play fun poker[/url]
internet casinos play blackjack http://wqm.in/jackpot_hotels-in-jackpot-nv casino hotel mississippi [url=http://wqm.in/jokers_gypsy-jokers-portland-or-offical-web-site]gypsy jokers portland or offical web site[/url]

Anonymous said...

az mega bucks lottery http://lwv.in/slots/prehistoric-gaint-slots seven bingo
[url=http://lwv.in/joker/dc-the-joker]louisiana online casino[/url] gambling etiquette tipping office pool managers [url=http://lwv.in/slot/drifter-slot-download]drifter slot download[/url]
fake australian lottery http://lwv.in/online-casinos/black-hawk-colorado-casinos
[url=http://lwv.in/bingo/bingo-dog]casino copan[/url] online gambling awards [url=http://lwv.in/slot/express-slot-on-a-laptop]express slot on a laptop[/url]
play baccarat free online gambling http://lwv.in/blackjack/blackjack-hot-battery ohio lottery mega millions [url=http://lwv.in/lottery/nj-lottery-mega-results]nj lottery mega results[/url]

Anonymous said...

internet movie download [url=http://moviestrawberry.com/films/film_the_sleeping_dictionary/]the sleeping dictionary[/url] fight club movie http://moviestrawberry.com/films/film_the_believer/ rob zombie new movie
watch the gate movie online [url=http://moviestrawberry.com/films/film_clifford_s_really_big_movie/]clifford s really big movie[/url] heart of maryland 1927 movie http://moviestrawberry.com/films/film_federal_protection/ candy mason free movie
latina movie drive [url=http://moviestrawberry.com/films/film_obsessed/]obsessed[/url] bad manners movie
size of offical movie poster [url=http://moviestrawberry.com/films/film_return_to_sleepaway_camp/]return to sleepaway camp[/url] porn movie gallerys http://moviestrawberry.com/films/film_species_iii/ rent a movie online
free chinese sex movie [url=http://moviestrawberry.com/films/film_striking_range/]striking range[/url] shortbus movie http://moviestrawberry.com/films/film_east_side_story/ movie theateres 60634

Anonymous said...

top [url=http://www.001casino.com/]free casino bonus[/url] brake the latest [url=http://www.casinolasvegass.com/]free casino games[/url] manumitted no consign perk at the chief [url=http://www.baywatchcasino.com/]online casino
[/url].