60 likes | 69 Views
Learn about the properties and events of textboxes and buttons in VB.NET programming. Discover how to take user input, set maximum length, display password input, and handle button click events.
E N D
2c – Textboxes and Buttons CSCI N331 VB .NET Programming Lingma Acheson Department of Computer and Information Science, IUPUI
Textboxes • Takes user’s text input • Properties: • Name: txtYyyyy • Text: the value inside of the textbox • MaxLength: the maximum number of character users can enter • PasswordChar: character to display for password input • ReadOnly: the value cannot be changed
Buttons • For users to click and let something happen • Properties • Name: btnYyyyy • Text: the text on the button • Button click event - an even that will happen when the button is clicked.
Buttons • To define an event (what should happen when the button is clicked?) • Double clicking on the button on the design page will take you to the source code page. • The event frame work is created automatically. • You only need to fill in event details in the frame work, between “Private Sub buttonName_Click( …” and “End Sub”
Others • MessageBox.Show() – used to create a pop-up message box to display some information. Whatever defined inside the () will show on the message box. • Me – the current form, a handy way to find object names or tasks • Blue wavy line on the code page – something is not right yet, either the statement is not finished or there is an error. Must make it go away before you run the program.
Others • String concatenation sign “&” – connect short texts(strings) together to form a longer text. E.g. “Your name is “ & “Bob.” will become “Your name is Bob.”. Space inside the double quotes will be interpreted as spaces.