?
Solved

How do you write a simple program in Visual Basic 2010

Posted on 2013-01-01
3
Medium Priority
?
535 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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 86

Accepted Solution

by:
Mike Tomlinson earned 2000 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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
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…
Suggested Courses
Course of the Month14 days, 10 hours left to enroll

770 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