110 likes | 249 Views
VB Chapters 11 & 12. Security panel app chpt 12. Textbox Properties . In the Interest Calculator we have a few new properties Multi-line property set to true ReadOnly set to true Scrollbar set to Vertical. TextBox Methods. inputTextbox.clear( ) inputTextbox.focus( ). Listboxes.
E N D
VB Chapters 11 & 12 Security panel app chpt 12
Textbox Properties In the Interest Calculator we have a few new properties • Multi-line property set to true • ReadOnly set to true • Scrollbar set to Vertical
TextBox Methods • inputTextbox.clear( ) • inputTextbox.focus( )
Listboxes • Allow users to select items from a list • Users can add or delete items • You must write code to add or remove items from a listbox • paymentsListbox.items.clear( ) • paymentsListbox.items.add(“months” & ControlChars.Tab & “monthly Payments”) • gradesListBox.Items.Add(val(inputTextbox.Text))
Hidden Code • You’re creating lots of code when you work with the GUI. • To see this code click “show All Files” in the solution explorer and then click the + next to the DentalPayment.vb. • Double click designer
Select Case • Another option for selection • Useful when there are many different options – it is a multiple selection statement • Can take the place of layers of nested or stacked ifs. This is much preferred over too many nested ifs • The expression following the keywords Select Case is called a controlling expression
Case Statements • Conditions are checked in the case statements • Multiple values tested in a single case statement are separated by a comma • Bad Case Statement: Case 51 To 30 • Here the case statement is ignored and may result in a logic error
Case Else • Case Else can be helpful with error checking • But be careful where you use it. Using it before any of your Case Statements results in a syntax error
An Example • Select Case AccessCode • Case Is < 10 • message = "restricted access" • Case 1645 To 1689 • message = "technitions" • Case 8345 • message = "custodians" • Case 9998, 1006 To 1008 • message = "scientists" • Case Else • message = "access denied" • End Select
Adding Stuff to a Listbox • LogEntryListBox.Items.Insert(0, date.now & “ “ & message)
Neat Textbox Stuff • The Text property of textboxes to access user input • SecurityCodeTextBox.Clear( ) • SecurityCodeTextBox.Text &= “2” • PasswordChar : setting this property to * masks data enter in the textbox. • Can prevent a user from modifying text in a textbox by setting enabled property to “false”