11.07.2015 Views

Beginning C# 2008-from Novice-to-professional - A2Z Dotnet

Beginning C# 2008-from Novice-to-professional - A2Z Dotnet

Beginning C# 2008-from Novice-to-professional - A2Z Dotnet

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

CHAPTER 1 ■ READY, STEADY, GO! 9Making the Windows Application Say HelloThe Windows application does nothing other than appear with a blank window that you canclose. To make the application do something, you need <strong>to</strong> add user interface elements or addsome code. Adding code without adding user interface elements will make the program dosomething, but it’s not as exciting. So, we’ll add a but<strong>to</strong>n that, when clicked, will display “hello,world” in a text box.First, you need <strong>to</strong> add the But<strong>to</strong>n control <strong>to</strong> the form. Double-click Form1.cs in the SolutionExplorer <strong>to</strong> display a blank form. Then click the Toolbox tab <strong>to</strong> access the controls. ClickBut<strong>to</strong>n, and then click the form <strong>to</strong> place the but<strong>to</strong>n on the form. These steps are illustrated inFigure 1-5.Figure 1-5. Adding a but<strong>to</strong>n <strong>to</strong> the formNext, add a TextBox control using the same basic procedure. Finally, align the but<strong>to</strong>n andtext box as shown in Figure 1-6. To move a control, use the handles that appear when youhighlight the control. Visual <strong>C#</strong> Express will align the edge of a control <strong>to</strong> nearby edges as youdrag it, so that you can align controls accurately.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!