1.1 For your first Visual Basic exercise, you must first complete the Hello Worl
ID: 3636206 • Letter: 1
Question
1.1 For your first Visual Basic exercise, you must first complete the HelloWorld project. Then add buttons and event procedures to display the
“Hello World” message in two more languages. You may substitute any
other languages for those shown. Feel free to modify the user interface to
suit yourself (or your instructor).
Make sure to use meaningful names for your new buttons, following the
naming conventions in Table 1.2. Include remarks at the top of every procedure and at the top of the file.
“Hello World” in French: Bonjour tout le monde
“Hello World” in Italian: Ciao Mondo
1.2 Write a new Visual Basic project that displays a different greeting, or
make it display the name of your school or your company. Include at least
three buttons to display the greeting, print, and exit the project.
Include a label that holds your name at the bottom of the form and
change the Text property of the form to something meaningful.
Follow good naming conventions for object names; include remarks at
the top of every procedure and at the top of the file.
Select a different font name and font size for the greeting label. If you
wish, you also can select a different color for the font. Select each font attribute from the Font dialog box from the Properties window.
1.3 Write a project that displays four sayings, such as “The early bird gets the
worm” or “A penny saved is a penny earned.” (You will want to keep the
sayings short, as each must be entered on one line.) When the saying displays on your form, long lines will run off the form if the label’s AutoSize
property is set to True. To wrap text within the label, change the AutoSize
property to False and use the sizing handles to make the label large enough.
Make a button for each saying with a descriptive Text property for
each, a button to print, and a button to exit the project.
Include a label that holds your name at the bottom of the form. Also,
make sure to change the form’s title bar to something meaningful.
You may change the Font properties of the large label to the font and
size of your choice.
Make sure the buttons are large enough to hold their entire Text
properties.
Follow good naming conventions for object names; include remarks at
the top of every procedure and at the top of the file.
1.4 Write a project to display company contact information. Include buttons
and labels for the contact person, department, and phone. When the user
clicks on one of the buttons, display the contact information in the corresponding label. Include a button to print and another to exit.
Include a label that holds your name at the bottom of the form and
change the title bar of the form to something meaningful.
You may change the Font properties of the labels to the font and size of
your choice.
Follow good naming conventions for object names; include remarks at
the top of every procedure and at the top of the file.
1.5 Create a project to display the daily specials for “your” diner. Make up a
name for your diner and display it in a label at the top of the form. Add a
label to display the appropriate special depending on the button that is
pressed. The buttons should be
• Soup of the Day
• Chef’s Special
• Daily Fish
Also include a Print button and an Exit button.
Sample Data: Dorothy’s Diner is offering Tortilla Soup, a California
Cobb Salad, and Hazelnut-Coated Mahi Mahi.
Explanation / Answer
Objectives In this topic, we'll take a quick tour of the features that you'll use to build Metro style apps using C++, C#, or Visual Basic. We'll create a simple blog reader that downloads and displays data from an RSS 2.0 or Atom 1.0 feed, and see how to make an app that conveys the right personality. We introduce concepts that are core to the development platform, including Controls, Capabilities, Layout, Templates, and Data Binding. By the time you complete this tutorial, you'll be prepared to start building your own Metro style app using C++, C#, or Visual Basic. This topic should take about 20 minutes to read; however, if you complete each of the exercises, it may take you a little longer. Hello World When you create your Metro style app using C++, C#, or Visual Basic, you typically define the UI using XAML, and write your app logic in an associated code behind file in your selected language. You will find the XAML UI framework for Metro style apps using C++, C#, or Visual Basic in the Windows.UI.Xaml.* namespaces of the Windows Runtime. If you've written apps using Windows Presentation Foundation (WPF), Silverlight, or Silverlight for Windows Phone, you're already familiar with this programming model and much of your experience will transfer to creating your Metro style app using C++, C#, or Visual Basic. The example here shows the XAML that defines the UI for a simple Hello World app and its associated code behind page. Even this simple example shows several concepts that are important to the XAML-based programming model, including partial classes, layout, controls, properties, and events. // C# namespace HelloWorld { partial class MainPage { public MainPage() { InitializeComponent(); } private void HelloButton_Click(object sender, RoutedEventArgs e) { DisplayText.Text = "Hello World"; } } } ' Visual Basic Partial Public Class MainPage Public Sub New() Me.InitializeComponent() End Sub Private Sub HelloButton_Click(ByVal sender As Object, ByVal e As RoutedEventArgs) DisplayText.Text = "Hello World" End Sub End Class // C++ MainPage::MainPage() { InitializeComponent(); } MainPage::~MainPage() { } void HelloWorld::MainPage::HelloButton_Click(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e) { DisplayText->Text = "Hello World"; } A Hello World app is good place to start. But it doesn't take you very far down the road to profitability, so we'll take a different path as we explore building Metro style apps for Windows Developer Preview. The sample app that we use to get started is a simple blog reader that downloads and displays data from an RSS 2.0 or Atom 1.0 feedRelated Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.