Presentation is loading. Please wait.

Presentation is loading. Please wait.

Fonts, TabControl, ListBox

Similar presentations


Presentation on theme: "Fonts, TabControl, ListBox"— Presentation transcript:

1 Fonts, TabControl, ListBox
CSC 265 (Blum)

2 Naming Be careful to give distinct things distinct names.
E.g. don’t name the form Random since there is a Random class in VB. E.g. Don’t give a form and a usercontrol the same name. Hungarian prefixes are useful here. If you use FrmRandom or UscRandom, etc. you less likely to come up with conflicting names. CSC 265 (Blum)

3 Changing Font CSC 265 (Blum)

4 Return of Font Change (Start up)
CSC 265 (Blum)

5 Choose a Font Name and a Font Size and click button
CSC 265 (Blum)

6 Declare class variables including Font and FontStyle
CSC 265 (Blum)

7 RadioButton event methods
Handling multiple events CSC 265 (Blum)

8 Button click event method
Instantiates a new font based on user’s selections. CSC 265 (Blum)

9 Form load event method Determine font name and size that are there from beginning in case user clicks buttons without having made radiobutton selections. Note lblMessage.Font.Name is OK on the right-hand-side of an assignment statement. CSC 265 (Blum)

10 Method 2: Declare object in click method
Object is declared in click event and is re-established with each click event and can be instantiated with each click event. CSC 265 (Blum)

11 TabControl CSC 265 (Blum)

12 TabControl and TabPages
CSC 265 (Blum)

13 Add a TabControl to a form, rename it, the prefix is tbc
CSC 265 (Blum)

14 Right click on the TabControl and choose Add Tab
CSC 265 (Blum)

15 Result: TabPage1 is added to TabControl
CSC 265 (Blum)

16 Click on TabPage1 (below the tab), rename it, the prefix is tbp
CSC 265 (Blum)

17 Change the Text property
CSC 265 (Blum)

18 Right click again on the tab control (in the tabbing region) and add a second page
CSC 265 (Blum)

19 The TabPages are like Panels or GroupBoxes and serves as containers for controls
Addition TabPage controls CSC 265 (Blum)

20 Subtraction TabPage Controls – These are distinct from the controls on the previous TabPage
CSC 265 (Blum)

21 Declaring “class” variables
CSC 265 (Blum)

22 Form Load Event Method CSC 265 (Blum)

23 Code for Clicking button on addition TabPage
CSC 265 (Blum)

24 Code for Clicking button on addition TabPage (Cont.)
CSC 265 (Blum)

25 Code for Clicking button on subtraction TabPage
CSC 265 (Blum)

26 Code for Clicking button on subtraction TabPage (Cont.)
CSC 265 (Blum)

27 ListBoxes CSC 265 (Blum)

28 Entering Items into a ListBox
CSC 265 (Blum)

29 User enters name into TextBox and clicks Enter
CSC 265 (Blum)

30 TextBox is cleared and name is entered as first item in list
CSC 265 (Blum)

31 First name at top, successive names underneath
CSC 265 (Blum)

32 Code to add item to list and clear textbox
CSC 265 (Blum)

33 Select item from list then click Remove button
CSC 265 (Blum)

34 After Selecting an item from list then clicking Remove button
CSC 265 (Blum)

35 Remove code SelectedIndex is a property of a ListBox that tells the programmer which item is highlighted. If no items are highlighted, it is –1. CSC 265 (Blum)

36 Another kind of remove CSC 265 (Blum)

37 Another kind of remove (Cont.)
CSC 265 (Blum)

38 Nothing happens, no error
CSC 265 (Blum)

39 Another kind of remove (Cont.)
CSC 265 (Blum)


Download ppt "Fonts, TabControl, ListBox"

Similar presentations


Ads by Google