8ball in Visual basic

By Lord-Harlot on Oct 17, 2009

Download visual basic 2008 and paste it in and run it.

I don't know which was easier to make. The python 8ball or the VB one. I think it's the VB one since I hadn't done any python before.

Module Module1
    Sub Main()
        Dim x As Integer, rand As New Random, a As Integer, b As String
        x = 1
        Do While x
            Console.WriteLine("Enter a question here!")
            b = Console.ReadLine()
            a = rand.Next(1, 5)
            If b = "exit" Then
                Exit Do
            End If
            Select Case a
                Case 1
                    Console.WriteLine("The answer is in your heart")
                Case 2
                    Console.WriteLine("The answer is no")
                Case 3
                    Console.WriteLine("The answer is yes")
                Case 4
                    Console.WriteLine("Go away and ask me later")
            End Select
    End Sub
End Module


Sign in to comment.
Ghost-writer   -  Jun 17, 2010

why is yours so long m8..

'Ghost-writer 8ball.
dim x as integer
randomise timer
x = int((1 - 4) * rnd) + 1
if x = 1 then print "Yes"
if x = 2 then print "No"
if x = 3 then print "Maybe"
if x = 4 then print "Okay"
end sub
Jonesy44   -  Oct 22, 2009

There is a source code for the GUI, when you open the project, select the Form1 source from the Solution explorer and the options are around there, however im not sure if you can paste a new one in etc, i've stuck to posting console apps only.

Blogger   -  Oct 19, 2009

Hello PePpEr --> U on BhasIrc nah..... See you in here...

I can't make Snipest,any1 can help me.........


guest598594   -  Oct 19, 2009

You can just do Do...Loop, no real need for the x var.

PePpEr   -  Oct 19, 2009

nice :-)
i like that you didnt use random sayings like all the other's

Lord-Harlot   -  Oct 18, 2009

I've just started it
doing it in college but only 1 unit of it.

`Green   -  Oct 18, 2009

yeah that would be easier lol. and im kinda new to VB08 coding. are you good or no?

Lord-Harlot   -  Oct 18, 2009

I have no idea. I guess you would have to find the source code for the form as well.

`Green   -  Oct 18, 2009

well yeah i know this one is. but im saying that if i wanted to post a code for a "Form" wouldnt i have to do all of that?

Lord-Harlot   -  Oct 18, 2009

This is just a basic console app. No GUI

`Green   -  Oct 18, 2009

uh looks good. but idk how this whole new VB scripting is supposed to work because you would have to match all the buttons and textboxes and names and stuff to what the script says. and also you missed the r in answer from "The amswer is yes"

Are you sure you want to unfollow this person?
Are you sure you want to delete this?
Click "Unsubscribe" to stop receiving notices pertaining to this post.
Click "Subscribe" to resume notices pertaining to this post.