C

Simplified tutorials to learn the popular basic language C

VB.Net

Learn the basic desktop development application language

CodeIgniter

One of the popular PHP three tier (MVC) framework

Visual Basic and C# Basics - Creating a New Project


Tip Abstraction:
        This is a simple tutorial describes the basics of Visual Basic (VB) and C# from the scratch. 


Visual Basic shortly VB and C# are the popular study level software making Tool. This means you can create desktop applications using Visual Basic programming as well as C#. According to the other programming languages, VB is very simple to handle and write programs and C# is more related to C++ and Java Programming.

First of all, you have to install Visual Studio to create VB, C#, ASP, etc applications.
After successful installation, just open Visual studio.

Then go to File => New => Project.

Creating new project on Visual Studio

Select Visual Basic => ‘Windows Form Application’. Sometimes, you can’t see ‘Visual Basic’, and then check under ‘Other Languages’.

If you are going to create a C# project, then you have to choose ‘C#’ instead of Visual basic.
Now give a name for your project. Then press ‘OK’ button.

Creating a New Visual Basic Project

Now your software form is ready to design.

Introduction to the ToolBox.

Can you see a Toolbox?
If you can’t see, then go to ‘View’ Tab. Select ‘Toolbox’ as well as ‘Properties Window’.


Showing Toolbox and Properties Windows in VB


Now come to the ‘Toolbox’. Under ‘Common Controls’ you can see many tools that can addable to our form such as ‘Button’, ‘Labels’, ‘TextBox’, etc.

Some of VB / C# Common Controls:

VB C# Toolbox items

Label:

 Which represents simple text, but not editable by user directly.

TextBox: 

Text Box means a text field where user can type any values on it.

Button: 

This is the normal button that user can click on it for performing an event.

List Box:

 As the name indicates, this is a box of many list items.

ComboBox:

 Similar to the ListBox, but only selected item is appeared.


RadioButton: 

A set of items with button, here user can select only one item. Example: choosing gender form ‘Male’ and ‘Female’ radio buttons.

CheckBox: 

Similar to the radio button, but user can select multiple items. Exmaple: Interested programming languages: ‘VB’, ‘C#’, ‘C++’.


How to Add Controls into a Visual Studio form

It is very simple to add any control to our form. This makes easier to design our form.
If you want to add an element or ‘tool’ into our form, then just click on the tool item and draw on the form or click and drag on the form.

Adding a Tool item into VB C# form

If you want to add a textbox into our form, then select ‘TextBox’ from Tool box and come to the from, and click on a position where you want to add a textbox on the form. Or click on the tool item and drag into the form without leaving mouse click.

Like this you can add any tools into our form such as label, Button, etc.

Introduction to the Visual Studio Properties Window: 


Properties window contains the properties of the select item.
For example:  If you want to add a label into our form, then its name should be ‘lable1’. Then how can we rename it into ‘Name’?. Here we have to use properties window, then we can customize any tool item properties.
For this, just select the tool item (here Lable1). Then go to the ‘Properties window’ OR right click on the item (Label1) then select ‘Properties’.
In Properties window, you can see many properties. Just look up for ‘Text’. That should be ‘Label1’ or like that. Just edit and rename with any text that you want. Here I re-texted into ‘Name: ’

VB C# toolbox Item Properties

Like adding a label, I added a ‘TextBox’ in to our form to type the name by user.

How to Run our VB or C# Project

It is very simple to run our project. Just go to ‘Debug’ tab. Then select ‘Start Debugging’. Or directly use the run icon that located on standard toolbar.

Running Debugging a VB C# Application

Now your application should be run if you have any error in your programming.

My first VB C# application

Here we are not written any codes. In next lesson lets us see how to write VB or C# codes.

How to Stop Debugging in VB or C# Project

Just again take Debug menu, then select Stop Debugging or use the icon for debugging directly

Visual studio Stop debugging



No comments:

Post a Comment