Visual Basic Fundamentals: Development for Absolute Beginners

Creating Your First Visual Basic Program - 02

Download this episode

Download Video

Download captions

Download Captions


In this lesson you'll create a simple application twice -- the first time using Windows Notepad and the Visual Basic Command Line Compiler, then then second time using Visual Studio or Visual Basic Express Edition. The point of this video is to demonstrate how much easier your work becomes by utilizing an Integrated Development Environment (IDE) than simply attempting to work in a loose collection of windows and tools. The video concludes by explaining common solutions to the many different problems you might encounter as you first beginning writing and compiling code.

 Download the source code for Creating Your First Visual Basic Program.

 IMPORTANT UPDATE:  Before you watch this lesson, please make sure you have watched this video to learn about changes to Visual Studio since this series was originally recorded.



Available formats for this video:

Actual format may change based on video formats available and browser capability.

    The Discussion

    • Algorithum

      Hey that was a great Video great job Bob.  I actually have been programming for a while so this was not new, but I did learn how to compile code from command line which was great.  Tnx for a great lesson!

    • C10

      Hey Bob these are really great videos.
      You know, it's quite embarrasing to have problems in the first lesson, but my Command prompt is showing me an error. It's "error BC30451", aparently 'Console' is not declared.
      I've written every word exactly the same as you've written yours, could you help me?. What do I have to do to make it work?

    • BobTabor

      @C10:Two things ... first, are you getting stuck with the command line version or the IDE version of the project / video?  Second, would you mind posting the code directly in a reply to this message?  Thank you!

      PS ... never be embarrassed.  While I'm willing to bet the solution is something really small, you'll have thousands of these little humbling moments as you continue programming.  Happens to me every day (hopefully not the same thing twice, but even THAT has happened!)  Smiley

    • devoria

      for me it workd as well as i saw in your video
      just one minute i love your teaching ability, you are a real maser, when my college teach us coding i sleep, but with your video i become more carious because i just not love the course but also you the teacher, thanks BOb

    • Paul Breen

      Visual Studio and express make things a little easier by using the console window links provided. They are called "Visual Studio Command Prompt" and are listed in the visual studio tools menu. I am pretty sure they are in the expresss version too. What you can do with them is just type "vbc test.vb" and you don't have to fiddle with long paths etc or set you environment variable path.
      I don't want to push command line compiling but it is a way to learn some things and if you have a cheap computer like mine, it is way faster. Could you put some coverage of the mgdb command line debugger? This is set up by the visual studio link tool I mentioned above. So you can just mgdb test.vb (if you use the debug command flags). It is very simple really to get started.
      thanks for the videos

    • BobTabor

      @Paul Breen: Great tip!  I just booted up Visual Basic 2010 Express Edition and unfortunately it does not contain the Visual Studio Command Prompt, so unfortunately that wouldn't work for the requirements of this video series.  Furthermore, I'm NOT a command line guy so the mgdb tip is new to me.  Thanks for the great ideas!

    • Keef

      I haven't coded since I was 15, over 22 years ago coding 68k assembler and have basically forgotten everything and anything.

      VB seems to be a nice introduction to coding again before I take the leap into Java. Just the style of your tutorials, and the way you explain things, not just what needs to be done but WHY they need to be done, tells me this is going to go a lot smoother than I thought.

      Looking forward to the rest of the lessons.

    • Lil Ao

      Bob, I am unsure of how to move forward. I have "c:\HelloWorld\helloworld.vb(3) : error BC30451: 'Console' is not declared. It may be inaccessible due to its protection level.

      Console.WriteLine("Hello World!")"

      Then the same for console.ReadLine()

      Now what?

    • BobTabor

      @Lil Ao: Two things ... first, don't forget what I say in the video -- that whole command line example was to impress on you that, without a tool like Visual Studio (or the Express Editions) writing programs would be really tough ... exactly for the reasons you've now seen!!!  SO, as to "now what?"  You COULD just ignore this and move on with the rest of the series.  But if you really want to figure it out ...

      Second, by virtue of the fact that it says it cannot see the Console object, I'm guessing there's something fundamentally wrong with your code.  Did you try to download the code (see below the video), copy that file into your directory, then attempt to compile that?  If that DOES work, then compare what's in my version of helloworld.vb versus your version of helloworld.vb.

      If it STILL doesn't work, then I would need to see what commands you're typing into the DOS Prompt / Command window to invoke the compiler.

      I'll try to help you get this straightened out! Best wishes! -bt

    • Alv

      Wow, the video's keep getting better and better.

      I remember seeing the first vids from Bob Tabor and thought they were very informative and helpful to the beginner but they've gone up to a new level.

      Highly impressive, highly educational, well presented and very professional. 4 and a half stars.... leaving some room for your next series of videos :)

    • Ken

      Great video!

    • Taxus

      Bob, one tip I spotted which you did on the video but did not emphasise was the typing of opening and closing parantheses and opening and closing quotes and Sub and End Sub Clauses at the same time. This avoids one of the common errors that most of us are guilty of and to which you alluded - "forgetting to close". Typing the closing part at the same time as the opening part is very easy to do and can avoid a lot of head scratching later on!

      (not sure whether it was a "just making sure you are paying attention" moment but you have a typo in the Recap bullet point 2 re preciseness!)

    • Judy

      I have a few questions. I started to watch you video. I did the HelloWorld and it worked, but I'm wanting to creat macros using VB in PowerPoint and Excel...Should I keep going even if I'm not using Visual Express???

    • BobTabor

      @Taxus:  Thank you ... and oh, the irony of "preciseness".  Sad

      @Judy: Honestly, this probably will *help* but it will not be directly applicable.  You are interested in VBA, or rather, Visual Basic for Applications, which has a similar syntax, but a good tutorial on VBA would also teach you about the Office API, which we will not cover at all in this series.  Also, things like data types, etc. are different (at least, I think).  Sorry, I know almost nothing about VBA.  Hope that helps!

    • Will K

      Thank you Bob your video's are very clear & concise. I'm new programming and your tutorial's on learn Visual Studio.NET have helped me grasp the concept quite easily.
      I will buy your life membership well worth it
      Thanks Bob!!

    • BobTabor

      @Will K:  Outstanding.  Glad you enjoyed these.  More coming ...

    • harrywwc

      G'day Bob,

      I'm a teacher in a technical college in NSW, Australia, and always on the lookout for "Beginners Resources" for my students. This looks like Gold.

      One minor nit - in DOS, the "\" is technically "back-slash" (or "slosh"), not a "slash" ("/" - or "forward-slash").

      Additionally, and perhaps you don't want people to become comfortable on the CLI ;) the CMD.exe on NT6.x has a <tab> command completion option - so typing all of the, say, 'v4.0.30319' directory name - could have been read out as "type cd v4 press <tab> to complete the line, and press <enter>".

      But yeah, expect a number of hits from Australia over the next week or so as my students panic about their assignment due real-soon :)

      Kind regards,


    • BobTabor

      @harrywwc: Great feedback!  I know some of these, but in the heat of the moment when you've hit the record button, you revert to whatever comes to mind in that moment.  Points well made, and best wishes to you and your students ... even the ones who are finishing up their studies at the 11th hour.  Big Smile

    • Abid

      Hey Bob, is it possible to have two inerfaces in one program (Command Line & GUI). Can I launch a console window from GUI, sort of like forms.

    • Azam

      Hey! I was getting so mad with cmd and using the vbc to make the exe, It took me an hour to realize I was wasting my time. I gave up, made a bat file, and used a bat to exe compiler. Thanks for the great videos.

    • knailer

      A teacher you are and easier isn't always the best. I really would like to at least become accustomed to using the notepad and command line first. Can you point me in that learning direction?

    • Yair

      Hello, Bob. I'm having a problem with my "HelloWorld" Application. I'm pretty sure I followed all the instructions carefully, but when I try to open the application, it flashes on screen for a brief moment then disappears. Any idea why this is?

    • BobTabor

      @knailer: When .NET first came out, people really were pushing that and books would feature that.  I wrote a book at that time, and the reviewer smashed me for not taking a Notepad+Compiler perspective.  But I think everyone has come around to accepting that the IDE is your friend, and the better the IDE, the friendlier the experience.  I don't know of any resources but I'm sure they're out there.  But let me really encourage you to learn Visual Studio's IDE inside and out.

      @Yair: Did you forget a Console.ReadLine(); at the very end of the program?  Smiley

    • slwbid

      newbie here.  I cannot get any audio with any of these tutorials.  Any idea what I need to do?


      Stacy Whetzell


    • Clint

      @slwbid: emailed you

    • Rob

      I cannot get audio with this or any of the videos either.
      Can someone help?

    • chris

      i shorten up things but i get this~ vbc : Command line error BC2012 : can't open 'c\hello\hello.exe' for writing

    • BobTabor

      @chrisc\hello\hello.exe ... you missed the semi-colon ... c:\hello\hello.exe ... assuming you do have the other names spelled correctly, etc.  Hope that helps?

    • chris

      thank you sir, i do feel silly, i had copied note pad deleted it pasted a new 1 and for some reason ever thing went fine

    • Usman Abubakar Umar

      Vb is so amazing bcus I remember when 1st I use it to design a calender that display time,date,year. If u have any sort of example that will help me please make all procedure steps draw the GUI,assign properties and the code. Thanks 4rm a student of computer engr kano state poly.

    • ahsan ullah

      hi bob.i want to become expert in can i do this?

    • BobTabor

      @ahsan ullah: Spend every extra minute you have learning, practicing and reading.  I'm no expert, but that's what I do.  Good luck!

    • Femi Aderanti

      hello Bob,
      I tried this code in visual basic 6.0 and discovered it's not working. There are several errors and, the program didn't run. I also discovered there is no keyword like "Module" in VB6. Is this disparity a result of the difference in the VB application version?. I can see you are using VB express 2010.
      Thank you.

    • closecalls

      Hello Bob,
      I tried this code in visual basic 6.0 and discovered it's not working. There are several errors and, the program didn't run. I also discovered there is no keyword like "Module" in VB6. Is this disparity a result of the difference in the VB application version?. I can see you are using VB express 2010.
      Thank you.

    • BobTabor

      @Femi Aderanti: @closecalls: This will not work with VB6.  What I say next is my personal advice -- not Microsoft's official position:   VB6 is dead.  VB6 was released in October 1998, over 14 years ago.  There have been 6 versions since VB6, all .NET.  VB6 is never coming back.  You MUST switch for your career's sake.  Visual Basic 2012 is free! Please use that link, download, install, then watch this series.  Hope that helps!

    • Kioskay

      Hello Bob,
      You are the best teacher I've ever seen by d way i am a student of class 9 n we have d chapter visual basic in our book but i cant understand a thing as our teacher is crap.
      So thanx a lot fr these videos !
      my question is that i am watch these videos on mac !
      n is there any way i can use visual basic on mac without paying anything !
      Please Help ! :D

    • BobTabor

      @Kioskay: Hi and thanks for the nice words! re: mac ... I've never used this product, but in theory this should work:

      That will allow you to create a virtual machine containing Windows (like VMWare or Parallels).  Then you can install Visual Basic 2012 Express and run it.  The other option is to switch to C# and use Mono:

      The third option is to use Bootcamp on the Mac to create a partition and load up Windows, VB, etc.

      Without Mono, there's no way I'm aware of to run .NET applications on a Mac ... you could create Web Applications that can run in *any* browser.  That's what I would recommend to most companies.

    • Tayyab Malik

      Am very new to the visual basic programing . i successfully completed my second video .whenever i run the program it gives me number of errors still it displays Hello Word in console window

    • BobTabor

      @Tayyab Malik: What do the errors say?

    • closecalls

      Hello bob,

      Thanks for your advise. Your videos are great. By the time I'm done with vb express, i have the intention of moving to C#. Keep up the good work.

    • closecalls

      @BobTabor: Thanks for your advise. Your videos are great. By the time I'm done with vb express, i have the intention of moving to C#. Keep up the good work.

    • Pavan Soor

      Thanks for all your efforts. I have just downloaded Visual Studio Express 2012, and there is no such 'Console Application' available when I click New Project. How can I proceed? Thanks

    • BobTabor

      @Pavan Soor: Check this out:

      Important Update Video

       ... we just uploaded it yesterday ... sorry for the confusion -- things change!

    • Craig

      Nice video Bob. Found the second point on the recap slightly ironic - "Writing Visual Basic srequires preciseness."

    • BobTabor

      @Craig: Irony?  Or Genius?   Tongue Out

    • kujtim

      I'am Kujtim Shahini, am interested in a Visual Basic program have the opportunity to send me a video link to learn to work with Visual Basic

    • BobTabor

      @kujtim: Hi, not sure what you're asking for.  The videos on Channel 9 are all here and available for you to watch already.

    • cyphi1

      Initially I forgot the ConsoleRead line while typing the code in the .vb file. After using the command prompt compiler I got a console window with Hello World flashing which only briefly flashed on screen. I had to edit, save and then recompile the file in order for the changes to take place and the window to stay open. I caught my mistake pretty quick, but if your having this problem hope this helps.

    • Pinki

      Hey Bob, you are a God sent, thank you very much

    • Feris

      Thanks Bob for the video . I would like to ask a question about the command that you typed in 07:16 . I already typed exactly the same with yours but it gives me the error saying 'c' is not recognized as an internal or external command , operable program or batch file . How could I fix this?

    • Feris

      srry bob , i made a mistake while typing the in the command prompt haha

    • SQLPaul

      Moving from the medical industry to the IT  world is a huge mental shift. Thank you Bob and the Microsoft team for making it a refreshing breeze.

    • David Weaver

      In "Creating Your First Visual Basic Program - 02" at 17:20 "srequires" ?

    • BobTabor

      @SQLPaul: Very cool, glad these lessons helped!

      @David Weaver: Whoops.  But you won't have to look to hard to find mistakes, I'm afraid.  Perplexed

    • Hayden Horan

      Hi Bob,

      I have been getting stuck after I enter: vbc /out:c:\HelloWorld\HelloWorld.exe c:\HelloWorld\HelloWorld.vb

      An error message comes up: error BC30451: 'Console' is not declared. It may be inaccessible due to its protection level. Then it underlines 'Console' in Console.WriteLine("Hello world!") and in Console.ReadLine()

      Could you help me out, please!

      Greatly appreciated,


    • Clint

      @Hayden Horan: can you paste your program in here?  Do the sample source code for this lesson compile for you?

      Here is the functional program, I compiled and ran it.

      Module Module1    
          Sub Main() 
              Console.WriteLine("Hello World!")
          End Sub
      End Module

    • Hayden

      Thanks Clint,
      but i figured out the problem. I had to NOT choose the file with the largest version during the command prompt stage. Thank you.

    • anujj prem

      hello bob . i am anujj . i am 10. i am from india. in my school i top in computers. but here there no enough sources to learn more than what it is in your class. please help me out . and i want to know where and what to visualbasic express or something .i get confused between many names when i search.

    • Clint
    • anujj prem

      thank you clint. that video was useful.

    • Adriano Correia

      i like this program i able to learn visual basic

    • jmclarkdesi​gn

      awesome series of lessons, bob.  really very well done.


    • H K

      Hi Bob, I've followed you through the first half of video. Very much want to use the VS IDE to finish. However, I have VS 2010 (not express) and I can't find Console Application. In VS 2010, when I click New Project, then Visual Basic, all I see is Online Templates: Silverlight business application and WCF RIA Services Class library. Are you familiar with VS 2013? Are these items missing because I didn't install all features? I no longer have the disk I used to install VS 2010...
      I like your tutorial and would like to continue.

    • H K

      addendum to last post. I installed Visual Studio Express 2013 and am also not finding Console Application. Can you update video with callout for this later versions?

    • BobTabor
    • H K

      Yes it does. Moving forward with lesson. Thanks.

    • tashi tobagy

      hello....actually i am here to say that will you mention the website of visual studio tutorial to download.

    • BobTabor

      @tashi tobagy: I'm not sure exactly what you're asking.  However, here's a shortcut to the Express editions ... maybe this helps?

    • DaveThe​Learner

      Is there any way to keep the video on top of other windows?

    • BobTabor

      @DaveTheLearner: Big screen?  Two screens?  Two computers?  A computer and a tablet / phone?  Just throwing out ideas. Smiley

    • Totardo

      Problem: I can't watch the video
      Is there any solution for me?

    • Fisnik

      Worked good , thanks for these tutorials Bob :)

    • Dean Francis

      Another little tidbit regarding problems one may have running this first bit of code. The HelloWorld program apparently is listed in some AV software's virus definitions. In order to get the executable to run, you must inform your AV software to ignore the folder your projects are stored in. The how for a particular AV suite varies, but I found mine by Googling.

    • Keith

      Hi Bob,

      I have Visual Studio Express 2013 and your second video when you say to click on new project, then console application, well I do not have a console application to click on to. Any suggestions what I should click on to?

      Thanks so much

    • Keith

      Hi Bob,

      Will I be able to follow along with Visual Studio Express 2013 for all your videos? Just asking as already on the 2nd video it does not look the same. Should I remove the program and download VB 2010 like you have? Thanks

    • BobTabor

      @Keith: I think you need to download Visual Studio Express for WINDOWS DESKTOP ... not just WINDOWS.  And yes, you should be able to follow everything I've done in this series with 2013 ... the code files I distribute *should* work, but if they don't, you should be typing them in yourself.  :)  Seriously, the 2013 version of this series will be released in the near future on Microsoft's Virtual Academy.

    • Nimesh shiwakoti

      hi bob i am nimesh shiwakoti and I have a error while compiling my program.
      vbc : Command line error BC2012 : can't open 'c\vb\Module1.exe' for writing

      can you please help me..............

    • BobTabor
    • Nimesh Shiwakoti

      Thank you so much Bob

    • Mikamasing

      Hi Bob,

      I`m currently at Visual Studio 2013 and I followed your tutorial until I saw that you used a template called "Console Application", and I don't have that template. The closest template is "Blank App (XAML)". I tried this one, but when I wrote the "Console" command, the program didn'd recognize the code.


    • BobTabor

      @Mikamasing: Yes, things change.  I address that very question in the updated version of this series (2013):

      Be sure to watch from the beginning!

    • George Zitmann

      Usually when we talk about Visual Basic, we talk about Visual Basic 6.0. Visual Basic 6 is so good that it did not require improved versions over time (the programmers of this language were that good). However, a new version should be able to make applications for mobile (although there have been cases in which advanced VB6 programmers used the assembly language together with VB6 to make mobile applications).

      The truth is that VB .net is raised artificially in different ranks, but, even so, it can not (even by far) get close to the popularity of VB6. This greatly ignited some new scandals in 2014.

      In the near future, Microsoft will understand the VB6 phenomena and they will design a new version of VB6.

    • IRFAN

      HI, BOb could you tell me how i run my access data base through visual basic.

    • BobTabor

      @George Zitmann: It's been 16 years since VB6 was released.  I think that ship has sailed and it ain't ever coming back.

      @IRFAN: Sorry my friend, I'm only answering questions about these videos.  You should be able to find some good tutorials online.


    Comments closed

    Comments have been closed since this content was published more than 30 days ago, but if you'd like to continue the conversation, please create a new thread in our Forums, or Contact Us and let us know.