• 0

visual basics 2008 tutiorals?


Question

so I want to get into programming. someone told me to get microsoft visual basics. so I got VB express 2008. but now where do I start any good online tutorials? preferably free since I dont have lots of money really

never mind i found the ones on microsofts website I am having lots of fun. I made my hello world thing that will say hello if I put my name but close if its another name

bit confusing for some things. like i only know how to have 3 responses. one for my name. one for my brothers. and one for anyone else. It keeps messing up when I try doing

if towhom = "name here" then

message = "message here"

it messes up it worked when I added my name and my little brothers name

Edited by mokthraka
Link to comment
Share on other sites

11 answers to this question

Recommended Posts

  • 0

its not a form its a dos prompt here is the code

Module Module1

Sub Main()

Console.Write("please enter your name: ")

Dim name As String = Console.ReadLine()

While name <> ""

SayHelloTo(name)

Console.Write("please enter your name: ")

name = Console.ReadLine()

End While

End Sub

Sub SayHelloTo(ByVal toWhom As String)

Dim message As String

message = CalculateGreeting(toWhom)

Console.WriteLine(message)

End Sub

Function CalculateGreeting(ByVal toWhom As String) As String

Dim message As String

If toWhom = "Sam" Then

message = "Welcome to your computer , mr.Palomino"

Else

message = "Goverment agents will be at this location shortly, Enjoy your last moments :) "

If toWhom = "Travis" Then

message = "get away, " & toWhom

End If

End If

Return message

End Function

End Module

when I add

if toWhom = "name here" then

message = "message here" & toWhom

it deos not work it just gives the message for any other names

Link to comment
Share on other sites

  • 0
What error do you get exactly?

thats the problem there is no error. it just dosent work :( I dont think im adding it right. it still runs fine but I cant put another costume message

Link to comment
Share on other sites

  • 0

does anyone one know of somewhere that has some starter visual basics tutorials. I know microsoft has some but it dosent really give you a choice of what to do. and I dont like videos. Though they where helpful, because I have made a web browser that has bookmarks and all that which is cool. but I want a little more choice in what to do

Link to comment
Share on other sites

  • 0

A case statement (another type of conditional statement) would do that easier if you have multiple values.

Here's a little example I wrote for you:

Dim varName as string

Select Case varName
	Case "mokthraka"
		Msgbox("You are mokthraka")
	Case "John"
		Msgbox("You are John!")
	Case "Mary"
		Msgbox("You are Mary!")
	Case "ajua"
		Msgbox("You are ajua!")
	Case Else Me.Exit

Microsoft's MSDN website is full of documentation. You can start there or search for free e-books or tutorials elsewhere.

EDIT: I forgot to write the link to MSDN.

Edited by ajua
Link to comment
Share on other sites

This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.