Download presentation
Presentation is loading. Please wait.
Published byHollie O’Neal’ Modified over 8 years ago
1
Using Forms and Form Elements In Visual Basic.NET
2
Lesson Objectives To use appropriate form elements To name form elements correctly To be able to change the text of a label To be able to retrieve the data in a text box
3
Common form elements There are lots of form elements available Mostly use – TextBox - for entering info – Label – for displaying info – Button – for adding interactivity – Later also ListBoxes, Checkboxes, Radio buttons…
4
Naming Conventions Good programming practice to give elements meaningful names e.g.: – txtAnswer – lblResult – btnCalculate When programs get more complex, good variable names will help you!
5
To change the text on a Label Use the Text property of the Label element lblResult.Text = “Please enter your name”
6
To read the data in a TextBox Use the Text property of the TextBox element Dim answer As String answer = txtAnswer.Text
7
TASK Create a new project (Windows Form) Add a textbox, button and 2 labels Use the naming conventions! Label 2 should say “enter your name” On the button code (double click) change the label to display – “Hello your name, welcome to my form”
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.