Jump to content

VB for Beginners - Part 1 - Introduction

- - - - -

This topic has been archived. This means that you cannot reply to this topic.
20 replies to this topic

#1
Vswe

Vswe

    Writes binary right handed and hex left handed

  • Members
  • PipPipPipPipPipPipPipPipPip
  • 9,552 posts
Hello everyone. These tutorials is made for someone who want to start learn programming or just have started with VB.Net since that is what I'm going to teach you. You don't need any experience at all.





Well, let's get started. VB.Net is a very good language for a beginner, it looks like English and is easy to use.

First you're going to need Visual Basic. It's where you'll write your programs, you can find a link Under Downloads/Comunity/MS Downloads in the top menu of this forum.



After you have installed Visual Basic and then started it, you will come to the Start Page. Click File in the menu and select New Project... or you can simply just press Ctrl+N on your keyboard. Now you will see a new window asking you what template you want to use for your program.
We're going to use "Windows Forms Application", make sure it's selected. Then we're going to select a name for our project.
Note: This is not the name of the program, just the project name.
I name mine "TestApplication". Then Prees OK.


Now we'll come to the design view of our project. As default you have the layout of the program in the middle. This is how the program looks like. In the design view it's drag-and-drop editing. You just move things with the mouse and resize them and so on.




But before we continue we'll need to rename our form. It's good to learn this right from the beginning: "The name of an object should tell what it is and what it is for."
So we want to rename Form1 (this is the form you can see in the middle, a program can be made of more then on form) to MainForm. This is so you (by only seeing the name) know it's a form and that it's our main one.

You maybe thinks it isn't so important to have good name, why can't I just have Form1,Form2 and Form3? Well, in programs with a few items you can't remember what everything does, and it's best to learn it the right way from the beginning.

To change the name of our form click on Form1.vb in the menu in the upper-right corner. In this menu you can see everything in your project (and even the whole solution, but you don't need to think about that).
Then go to the menu below the other menu ans change File Name from "Form1.vb" to "MainForm.vb". In this other menu you can change the properties of the selected object.





You maybe have noticed that it still stands Form1 on the form in the middle. Thats because the text of the form is still "Form1". Click on the form in the middle.
Now you will see a long list in the properties menu. Now we're going to change some values here. Change Text to "My First Program".




If you want to see your program you can press F5. It's not so much to see though since it's just an empty form.
Save you project by clicking save all under file in the top menu. The first time you'll need to select the name, it's just to press ok since we already have chosen the name.



In the next Part we'll work with items and some simple code.
Take care. :D

#2
Guest_Jordan_*

Guest_Jordan_*
  • Guests
Not bad. How about some screenshots? :)
+rep

#3
Vswe

Vswe

    Writes binary right handed and hex left handed

  • Members
  • PipPipPipPipPipPipPipPipPip
  • 9,552 posts
Thanks... Maybe I should add some picture. I planned to upload part 2(I have currently made to part 4) when this was confirmed but now I have it on wrong computer.

#4
Xav

Xav

    Writes binary right handed and hex left handed

  • Members
  • PipPipPipPipPipPipPipPipPip
  • 13,118 posts

Vswe said:

So we want to rename Form1 (this is the form you can see in the middle, a program can be made of more then on form) to MainForm. This is so you (by only seeing the name) know it's a form and that it's our main one.

I disagree with this. What about standard naming conventions? Any professional will recommend naming your main form frmMain, in the same way a text box containing your postcode should be txtPostcode.
Jordan said:

Good members, like yourself, stick around and post for ages to come!
Mr. Xav | Blog | Forums

#5
Vswe

Vswe

    Writes binary right handed and hex left handed

  • Members
  • PipPipPipPipPipPipPipPipPip
  • 9,552 posts

Xav said:

I disagree with this. What about standard naming conventions? Any professional will recommend naming your main form frmMain, in the same way a text box containing your postcode should be txtPostcode.

How can you disagree with a argument which is agreeing with what I said? The frm shows it's a form and the txt show that it's a textbox.

#6
Guest_Jordan_*

Guest_Jordan_*
  • Guests
He is stating the frm instead of Form. Many .NET books and teachers preach this standard but there is no right or wrong when it comes to naming conventions.

Posted via CodeCall Mobile

#7
Xav

Xav

    Writes binary right handed and hex left handed

  • Members
  • PipPipPipPipPipPipPipPipPip
  • 13,118 posts
Indeed there is not, but from personal experience I have learnt that:

1) Using the same "frm" extension for forms makes things a huge amount easier to manage in code.
2) Putting the type of control at the start of the name instead of at the end is far preferable for coding, especially in projects (like this one) that use Microsoft's Visual Studio Express IDE. The reason for this is IntelliSense - when typing a reference to a form object, you need only type "frm" and the entire name of the form comes into view. The other way round, you would need to memorise the name of each form that you have in your project in order to call it up for manipulation.
Jordan said:

Good members, like yourself, stick around and post for ages to come!
Mr. Xav | Blog | Forums

#8
Vswe

Vswe

    Writes binary right handed and hex left handed

  • Members
  • PipPipPipPipPipPipPipPipPip
  • 9,552 posts
Xav, you must have understood what I wrote wrong, I wrote:

Vswe said:

"The name of an object should tell what it is and what it is for."

This part doesn't say you should name it Form, just that you should name it something so you know it's a form.

#9
Xav

Xav

    Writes binary right handed and hex left handed

  • Members
  • PipPipPipPipPipPipPipPipPip
  • 13,118 posts
Yes, this part certainly doesn't say you should name it Form.

But if you read the next sentence you wrote, it says that "we want to rename Form1 (this is the form you can see in the middle, a program can be made of more then on form) to MainForm". :)
Jordan said:

Good members, like yourself, stick around and post for ages to come!
Mr. Xav | Blog | Forums

#10
Vswe

Vswe

    Writes binary right handed and hex left handed

  • Members
  • PipPipPipPipPipPipPipPipPip
  • 9,552 posts
Yes, that's true. So you mean that you always should name your application for TestApplication?

#11
Xav

Xav

    Writes binary right handed and hex left handed

  • Members
  • PipPipPipPipPipPipPipPipPip
  • 13,118 posts
I'm not talking about naming applications. You should name the application based on its purpose.

With controls, however, it makes a lot of sense to follow the naming conventions.
Jordan said:

Good members, like yourself, stick around and post for ages to come!
Mr. Xav | Blog | Forums

#12
Vswe

Vswe

    Writes binary right handed and hex left handed

  • Members
  • PipPipPipPipPipPipPipPipPip
  • 9,552 posts
I named my application TestApplication and my Form for MainForm, I didn't say you SHOULD do it, just that you should name it so you can now its type and its purpose.