Solved

How do you write a simple program in Visual Basic 2010

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

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

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

Suggested Solutions

The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
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…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
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…

738 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