My first tutoral

Heres your chance to share your own tutorials with the community. Just post them on here. If your lucky they may even be posted on the main site.
1 post Page 1 of 1
Contributors
User avatar
jtlusco
VIP - Donator
VIP - Donator
Posts: 138
Joined: Mon Jul 12, 2010 11:28 pm

My first tutoral
jtlusco
Ok this is my first tutorial so I hope you like it
This is how to make Gypsy (magic eight ball) type app.

Fist start a new project
You will need
3 Buttons
1 Label
1 Textbox
2 Timmers

Place the buttons, label, and linklabel however you wish
Set timmer1 enable to true and interval to 50
Dubble click timmer1 and add the code below
Code: Select all
 If Label1.ForeColor = Color.Black Then
            Label1.ForeColor = Color.Blue
        ElseIf Label1.ForeColor = Color.Blue Then
            Label1.ForeColor = Color.Red
        ElseIf Label1.ForeColor = Color.Red Then
            Label1.ForeColor = Color.Green
        ElseIf Label1.ForeColor = Color.Green Then
            Label1.ForeColor = Color.Yellow
        ElseIf Label1.ForeColor = Color.Yellow Then
            Label1.ForeColor = Color.Black
        End If 
Now set timmer2 enable to true and interval to 100
Dubble click timmer2 and add the following
Code: Select all
 If Label1.Visible = True Then
        Label1.Visible = False
        ElseIf Label1.Visible = False Then
        Label1.Visible = True
        End If 
The code for button1
Code: Select all
 Dim msg1 As Integer
        Randomize()
        msg1 = Int(Rnd() * 10)
        Select Case msg1
            Case 0
                textbox1.Text = "   Love is on the wind."
            Case 1
                textbox1.Text = "   You will be loanly tonight."
            Case 2
                textbox1.Text = "   They will be in your dreams."
            Case 3
                textbox1.Text = "   I see happiieness in your future."
            Case 4
                textbox1.Text = "   It does not look good for you."
            Case 5
                textbox1.Text = "   Ask agin latter."
            Case 6
                textbox1.Text = "   I see dark times for you comeing soon."
            Case 7
                textbox1.Text = "   Your wife said stop asking."
            Case 8
                textbox1.Text = "   Love is all around you."
            Case 9
                textbox1.Text = "   What is love anyway."
        End Select 
Code for button2
Code: Select all
 Dim msg2 As Integer
        Randomize()
        msg2 = Int(Rnd() * 10)
        Select Case msg2
            Case 0
                textbox1.Text = "There is Great wealth in your future"
            Case 1
                textbox1.Text = "Times ahead are looking rough"
            Case 2
                textbox1.Text = "Money can't buy happiness."
            Case 3
                textbox1.Text = "Today is not a good day to invest."
            Case 4
                textbox1.Text = "Spred your wealth."
            Case 5
                textbox1.Text = "I see a raise in the future."
            Case 6
                textbox1.Text = "It may be time to change jobs."
            Case 7
                textbox1.Text = "Your girlfriend spent your paycheck."
            Case 8
                textbox1.Text = "Future is cloady ask agian latter."
            Case 9
                textbox1.Text = "I sugest you play the lotery."
        End Select 
Code for button3
Code: Select all
 Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
        Dim msg3 As Integer
        Randomize()
        msg3 = Int(Rnd() * 10)
        Select Case msg3
            Case 0
                textbox1.Text = "The sun shines apon you this day."
            Case 1
                textbox1.Text = "You bring happines to all around you."
            Case 2
                textbox1.Text = "Why so angry."
            Case 3
                textbox1.Text = "Let your heart guide you."
            Case 4
                textbox1.Text = "Stop and take in your suroundings."
            Case 5
                textbox1.Text = "Take time to relax (and code)."
            Case 6
                textbox1.Text = "Share your knolage with others."
            Case 7
                textbox1.Text = "Be helpfull."
            Case 8
                textbox1.Text = "Stop pulling your siters hair."
            Case 9
                textbox1.Text = "Your life is a mystory."
        End Select 
And if you want you can add other things like speech
Code for that is under keydown
Code: Select all
 If e.KeyCode = Keys.Enter Then
            Dim voice = CreateObject("SAPI.SpVoice")
            'Tells the narrator what to say
            voice.Speak("Your text here.")

        End If 
Well I hope you like it
Any coments would be aprecaited
The sorce is below
You do not have the required permissions to view the files attached to this post.
Have you been scripted today
Image
1 post Page 1 of 1
Return to “Tutorials”