Solved

How do you write a simple program in Visual Basic 2010

Posted on 2013-01-01
3
523 Views
Last Modified: 2013-01-02
I have Microsoft visual Studios 2010.I am trying to write something very simple in it just to get my "feet wet.".I would like to have a box that has the text "what is your name.".
Next to this box, I would like another box where I can type my name.I would then like to have a button at the bottom that says "OK".Then, when I click the okay button-it will say "hello Dan,"-or whatever name. I typed in the 2nd box.I don't know where the items I'm looking for are.
0
Comment
Question by:dwcronin
3 Comments
 
LVL 83

Expert Comment

by:CodeCruiser
ID: 38735065
This should get you started

http://www.youtube.com/watch?v=fWmObdrbCMU
0
 
LVL 9

Expert Comment

by:sognoct
ID: 38735071
0
 
LVL 85

Accepted Solution

by:
Mike Tomlinson earned 500 total points
ID: 38735145
From the ToolBox...
Place a Label (Label1) onto the Form and change its Text Property to "What is your name:".
Place a TextBox (TextBox1) to the right of the Label.
Place a Button (Button1) to the right of the TextBox and change its Text Property to "OK".

Now Double Click on the Button to get the handler stub:
Public Class Form1

    Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click

    End Sub

End Class

Open in new window


Next, retrieve the value from TextBox1 using its Text Property and concatenate that with your message.  Store that in a String variable and display it with MessageBox.Show();
Public Class Form1

    Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click
        Dim msg As String = "Hello " & TextBox1.Text & "!"
        MessageBox.Show(msg, "Greeting", MessageBoxButtons.OK, MessageBoxIcon.Information)
    End Sub

End Class

Open in new window

0

Featured Post

Problems using Powershell and Active Directory?

Managing Active Directory does not always have to be complicated.  If you are spending more time trying instead of doing, then it's time to look at something else. For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

773 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question