+ Reply to Thread
Results 1 to 3 of 3

Thread: Lets Learn Lotto Making in VB!

  1. #1
    frznmnky's Avatar
    frznmnky is offline x10 Sophmore frznmnky is an unknown quantity at this point
    Join Date
    Apr 2006
    Posts
    163

    Lets Learn Lotto Making in VB!

    Lets Learn Lotto Making in VB!

    Open ur VB

    Open New Project

    then drag

    1 PictureBoxes
    1 Button

    now rename the button as:

    Choose

    Now cum to the coding part, in between d Form1 and End Class, type:

    Dim DrawBrush As Brush
    Dim DrawBitmap As Bitmap
    Dim DrawGraphics As Graphics
    Dim MyFont As New System.Drawing.Font("Arial", 12, FontStyle.Regular, GraphicsUnit.Point)

    Dim arrNumber(0 To 5) As Integer
    Dim intNumber As Integer
    ' Selects Numbers
    Private Sub ChooseNumbers()
    Dim x, y As Integer
    For x = 0 To 5
    Start:
    Randomize()
    intNumber = Int((49 * Rnd()) + 1) ' Random number 1 to 49
    For y = 0 To 5
    ' If number already been selected select another one
    If intNumber = arrNumber(y) Then
    GoTo Start
    End If
    Next y
    arrNumber(x) = intNumber
    Next x
    End Sub

    ' Determines what colour the ball should be based on the Value
    Private Function BallColour(ByVal Value As Integer) As Brush
    If Value > 0 And Value < 10 Then
    DrawBrush = Brushes.White
    ElseIf Value > 10 And Value < 20 Then
    DrawBrush = Brushes.SkyBlue
    ElseIf Value > 20 And Value < 30 Then
    DrawBrush = Brushes.Magenta
    ElseIf Value > 30 And Value < 40 Then
    DrawBrush = Brushes.LawnGreen
    ElseIf Value > 40 And Value < 50 Then
    DrawBrush = Brushes.Yellow
    End If
    Return DrawBrush
    End Function

    ' Draws a Ball with a colour and value
    Private Sub DrawBall(ByVal Number As String, ByVal Left As Integer)
    Dim pos As Integer
    If Number.Length = 2 Then pos = 9 Else pos = 13 ' Postion for Single or Double Digit
    DrawGraphics.SmoothingMode = Drawing2D.SmoothingMode.HighQuality ' Smooth Drawing
    DrawGraphics.FillEllipse(BallColour(CInt(Number)), Left, 1, 40, 40) ' Draw Ball
    DrawGraphics.DrawString(Number, MyFont, Brushes.Black, Left + pos, 13) ' Draw Number
    End Sub

    ' Outputs all Balls to the PictureBox
    Private Sub RenderBalls()
    Dim i As Integer
    Dim intLeft As Integer
    intLeft = 1
    DrawBitmap = New Bitmap(PictureBox1.Width, PictureBox1.Height)
    DrawGraphics = Graphics.FromImage(DrawBitmap)
    For i = 0 To 5
    DrawBall(arrNumber(i), intLeft)
    intLeft = intLeft + 45
    Next
    PictureBox1.Image = DrawBitmap
    End Sub




    Now double click Choose and Type:

    ChooseNumbers()
    RenderBalls()


    Now Press f5 and Test ur Lotto!

    Well you made ur Lotto!

    comments please

    :thefingerDuCk HuNT:thefinger

    http://www.GotMovies.net

  2. #2
    mr kennedy's Avatar
    mr kennedy is offline KENNNNNEEEEDYYY!!!! mr kennedy is an unknown quantity at this point
    Join Date
    Aug 2007
    Location
    Doha, State of Qatar
    Posts
    525

    Re: Lets Learn Lotto Making in VB!

    VB? Visual Basic or vBulletin?

  3. #3
    frznmnky's Avatar
    frznmnky is offline x10 Sophmore frznmnky is an unknown quantity at this point
    Join Date
    Apr 2006
    Posts
    163

    Re: Lets Learn Lotto Making in VB!

    Visual Basic

    :thefingerDuCk HuNT:thefinger

    http://www.GotMovies.net

+ Reply to Thread

Similar Threads

  1. Www.Blog2Money.Net Your Online Money Making Guides
    By muizz in forum Link Exchange
    Replies: 3
    Last Post: 03-15-2008, 11:55 AM
  2. VB Only Feature
    By Werewolf in forum Scripts & 3rd Party Apps
    Replies: 16
    Last Post: 12-22-2007, 02:11 AM
  3. How did you learn webdesign?
    By Agenator in forum Crossfire
    Replies: 29
    Last Post: 11-26-2007, 01:51 AM
  4. The Better Money Making Tutorial-Part1
    By nitekazap in forum The Marketplace
    Replies: 4
    Last Post: 10-24-2007, 09:03 AM
  5. Webdesign Xenon is making for me.
    By echo_unlimited in forum Graphics & Webdesign
    Replies: 5
    Last Post: 05-14-2006, 08:38 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
x10hosting free hosting for the masses
dedicated servers