Solved

How do you write a simple program in Visual Basic 2010

Posted on 2013-01-01
3
527 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 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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
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…

762 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