Team Foundation Server Hosting
Skip Navigation Links
Home
Forum Home
Latest 50
Unanswered
Win Prizes
All Time Leaders
Jump to CategoryExpand Jump to Category
Login 
    Welcome Guest!
 Search Forum For :  
X
 Login
Please login to submit a new post, reply and edit exiting posts, see user profiles, and access more features. If you are not a registered member, Register here.
User Id / Email:
Password:  
Forgot Password | Forgot UserName
   Home » How do I » Hello User
       
Author Reply
jordan
posted 6 posts
since Aug 30, 2010 
from

Hello User

  Posted on: 30 Aug 2010       
Most people are used to the basic one button click "Hello World" tutorial. But today I am going to show you the little bit more advanced version called "Hello User"

First open up Visual Basic, I use the 2010 Express version which you can download at http://www.microsoft.com/express/downloads/

Go to File > New Project > Windows Forms Application and at the bottom name it "Hello User"

You should now have a blank "Form1" application. Click the grey area and in the bottom right corner you should see the properties box. Scroll to the text property and change it to what ever you want, probably "Hello User". Press enter and you will see the name of your form has changed, that is what the text property does.

Now, add a label control to your form from the toolbox.
Note: If you can't see the toolbox click Ctrl+Alt+X
Click the label and change the text property to "Enter your name"

Add a textbox control and move it under the label. This is where the user will enter their name into. Change the "Name" property to txtName.
Note: The name property is used to reference to the control in your code.

Add two button controls
1. Change the text property to "Ok" and the name property to "btnOk"
2.Change the text property to "Exit" and the name property to "btnExit"

Double click the Ok button and add the bolded code.
 [code]Private Sub btnOK_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnOK.Click
[b]        'displays a message box greeting to the user
        MessageBox.Show("Hello, " & txtName.Text & "! Welcome to VB 2010")[/b]
    End Sub[/code]

Messagebox.show = Pops up a message box with whatever is in the parenthesis.
("Hello, " & txtName.Text & "! Welcome to VB 2010") = Will show as exactly what it says. txtName.text will get the text from your textbox control.
Ampersands(&) = connect what is in between the quotation marks and your code. There must be a blank space preceding it.

Return to your Design editor and double click the exit button
Once again, add the bolded code


[code]Private Sub btnExit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnExit.Click
        [b]Me.Close()[/b]
    End Sub[/code]
Me = tells the program it will act upon itself
close = obviously close

Now go to File > Save All and browse to the folder you want to save it to. Then hit "F5" or the green button that says start debugging to start your program. Type a name and hit "ok" and tada, you get a lovely greeting to visual basic 2010. Now hit exit and it closes. If you want to get an exe file for your program go to Debug > Build. This will build it into the same place you saved it. It will be found in Bin > Release > Program.exe

Enjoy Everyone,
Zer[o]

Abhimanyu Kumar Vatsa
posted  577 posts
since  May 01, 2010 
from 

 Re: Hello User
  Posted on: 01 Sep 2010        0  
your post is very good and very helpful.

post such item in blog area here so that most of the user can read it and learn it.

this is forum are here we use to ask and answer the questions. right !


thanks and keep such posting.



ADCA BCA  MINDCRACKER MVP
Website : http://www.itorian.com 
http://www.microsoftskill.in/
       
Top Articles
View all »
Discover the top 5 tips for understanding .NET Interop
Dynamic PDF
ceTE software specializes in components for dynamic PDF generation and manipulation. The DynamicPDF™ product line allows you to dynamically generate PDF documents, merge PDF documents and new content to existing PDF documents from within your applications. Visit DynamicPDF here
Discover the top 5 tips for understanding .NET Interop
Ricky Leeks presents the top 5 tips for understanding .NET Interoperability. Learn more.
Introducing MaxV - one click. infinite control. Hyper-V Hosting from MaximumASP.
Finally – a virtual platform that delivers next-generation Windows Server 2008 Hyper-V virtualization technology from a managed hosting partner you can truly depend on. Visit www.maximumasp.com/max for a FREE 30 day trial. Hurry offer ends soon. Climb aboard the MaxV platform and take advantage of High Availability, Intelligent Monitoring, Recurrent Backups, and Scalability – with no hassle or hidden fees. As a managed hosting partner focused solely on Microsoft technologies since 2000, MaximumASP is uniquely qualified to provide the superior support that our business is built on. Unparalleled expertise with Microsoft technologies lead to working directly with Microsoft as first to offer IIS 7 and SQL 2008 betas in a hosted environment; partnering in the Go Live Program for Hyper-V; and product co-launches built on WS 2008 with Hyper-V technology.
Nevron Chart for .NET 2010.1 Now Available
The leading .NET charting control now features PDF, Flash and Silverlight export, visualization of large datasets and more. Deliver true charting functionality to your BI, Scorecard, Presentation or Scientific apps. Download evaluation now.
ASP.NET 4 Hosting
Get 2 Months Free of ASP.NET Hosting for Only $4.95/month! Receive FREE MS SQL and MySQL Databases Including ASP.NET 4/3.5, MVC 3.0, Silverlight 4, Windows 2008/IIS 7.0 Plus FREE IIS 7 Modules. Host UNLIMITED ASP.NET Web Sites – Click Here!
Team Foundation Server Hosting
 Hosted by MaximumASP  |  Found a broken link?  |  Contact Us  |  Terms & conditions  |  Privacy Policy  |  Site Map  |  Advertise with us
Current Version: 5.2011.3.12
 © 1999 - 2012  Mindcracker LLC. All Rights Reserved