23 September 2012

VB.NET - PROGRAM 1

Name : Text Transport
Difficulty : Very Easy

Today, I will show you how to make a program which transports the text input in the Textbox into a Label.


First of all, create a new Windows Application Project.

An empty form will show.












Now, drag a Textbox, a Label, and a Button from the toolbox on the left. It will look somewhat like this :












Click once on the Form. Change its "Text" Property to : Text Transport
If you do not know already, the properties box is located on the lower right of your VB.NET screen.
  
Click once on the Button and change its "Text" Property to : Transport


Click once on the Label and clear its "Text" Property.

It will now look like this :













Here comes the fun part, coding. 

Simply right click on the form and choose View Code.
 Now, you should be in the code editor.

All you have to do is copy this code and paste it into your code editor:

Public Class Form1

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Label1.Text = TextBox1.Text
    End Sub

End Class


Next, run the program by pressing F5 or clicking the green play button on the top. 
 A window will show, you may type anything into the textbox (for example : ABC) and then clicking on the Transport button. The text on the Textbox (which is ABC) will be copied onto the Label which indicates that you are successful.














Happy Coding !

Cyber Frost

No comments:

Post a Comment

Search