Presentation is loading. Please wait.

Presentation is loading. Please wait.

Visual Basic.NET Windows Forms Hello World Homework Assignment.

Similar presentations


Presentation on theme: "Visual Basic.NET Windows Forms Hello World Homework Assignment."— Presentation transcript:

1 Visual Basic.NET Windows Forms Hello World Homework Assignment

2 Homework Assignment This assignment builds on the Windows Forms Hello World class exercise.

3 Now Lets Add Some More Controls to Our Project (see next slide) Add a TextBox –Set the Font Size Property to –Clear the Text Property Add two Buttons to the Side –Set the Top Button Text Property to "Say Hi" –Set the Bottom Button Text Property to "Clear" Add Three Buttons at the Bottom –Clear the Text Property for each bottom button –Set the BackColor Properties to Red, Blue, Green

4

5 Now Let's Write Some Code We are going to change the label display using whatever name is typed into the text box. If no name is typed we will display a message asking that a name be entered. When the clear button is click we will reset the label text to "Hello World" and clear the TextBox. When one of the three color buttons is clicked we will change the backgroud and foreground colors on the form. Feel free to exercise your creative freedom and choose whatever colors you like.

6 First the "Say Hi" Button Double Click on the "Say Hi" button and add the following code. Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click If TextBox1.Text = "" Then MessageBox.Show("Please enter a name.") Else Label1.Text = "Hi " + TextBox1.Text End If End Sub

7 Next the Clear Button Double Click on the "Say Hi" button and add the following code. Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click TextBox1.Text = "" Label1.Text = "Hello World" Me.BackColor = Color.Gray Me.ForeColor = Color.White Label1.BackColor = Me.BackColor Label1.ForeColor = Me.ForeColor End Sub

8 For Each Color Button Enter the following code with your choice of color. Note: Chose your colors to match the button color. Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click Me.BackColor = Color.Green Me.ForeColor = Color.Yellow Label1.BackColor = Me.BackColor Label1.ForeColor = Me.ForeColor End Sub Note: In Me.BackColor Me is the form. The code is the same as Form1.BackColor = Color.Green

9

10 Now Build and Run the Application

11 The Running Application Should Look Like This

12 or This...

13

14

15 Homework Assignment

16 Part I - Please email me the following, this week if possible –Your full name, nick name, Student ID # –Your home phone and work Phone –Any additional email addresses you'd like me to use –Your background in computing/programming –Any experience with.NET, other courses? –Your objective or goals for this course –Any topics you have a special interest in covering? –Any other issues or questions you may have?

17 Homework Assignment Part II – Due Next Wednesday –Expand on this last Windows Form exercise –Have some fun with it –Try additional text boxes, controls, buttons, whatever... –When you are satisfied, zip the project file and email it to me

18 Tenitive Grade Matrix for this Assignment This project will be graded as follows: Form Layout: 1. Form Layout and Title (5 points) 2. LabelBox (5 points) 3. TextBox (5 points) 4. "Say Hi" and "Clear" Buttons (10 points, 5 points each) 5. Three Color Buttons (15 points, 5 points each) Button Functions (does it work as designed?): 1. "Say Hi" Button (5 points) 2. Use of MessageBox (5 points) 3. "Clear" Button (5 points) 4. Three Color Buttons (15 points, 5 points each) Absense of Execution Errors (5 points) Creativity (25 points) Note: Partial credit maybe awarded where appropriate.

19


Download ppt "Visual Basic.NET Windows Forms Hello World Homework Assignment."

Similar presentations


Ads by Google