100 likes | 207 Vues
This audio PowerCast covers the essentials of programming Windows Forms applications. Led by Dr. Steve Broskoske, it starts with setting up a new project and selecting the appropriate project type. Learn to place controls on your forms, manage properties, and initiate coding through double-click actions. The session also covers button coding for navigation, program execution, and saving projects. Enhance your understanding of anchoring controls for responsive design and tackle a remote assignment to create a web browser screen with various properties.
E N D
Class 1 Remote InstructionMore with Forms and Controls EDU 556 Programming for Instruction Dr. Steve Broskoske This is an audio PowerCast. Make sure your volume is turned up, and press F5 to begin. Click to advance as usual.
Getting Started Select “windows forms application” as project type on start-up. Name project (name of application) before hitting OK button.
Place controls on form. Double-click control to initiate coding. Click tabs to see form design or form coding. Select controls from toolbox. See properties (or events) by category or ABC.
Setting Properties • Be careful what you click on! • Click a control (or the form) to set its properties. • Always set these 2 properties first: • Name: Refer to control’s name when coding. • btnNameofButton • lblNameofLabel • txtNameofTextbox • Text: What is displayed in control. • Then click a control and set its properties.
Coding for Buttons • Display next form: • Form2.show • Me.hide 'You must keep the first form running. • Navigate back to previous form: • Form1.show • Me.close ‘You can close any form except Form1. • End the program through a button: • Me.close
To Run/Stop a Program • To run a program:Press the play buttonor press F5. • To stop a program:Press the stop buttonor press the X on program window.
Click tabs to toggle between design and coding. MonthCalendar1.Visible = True OR MonthCalendar1.Visible = False Calendar control. Label control. lblDemo.Visible= True OR lblDemo.Visible= False Buttons grouped with a panel. Buttons grouped with a group box.
Saving Your Work Select file—save all from menus. Make sure your project name is here. Browse and specify where to save your project (hard drive or stick). Check to create a directory (folder). To close this project and start a new project, select file--close projectfrom the menus.
Anchoring Controls Anchor text box: left, top, and right. Anchor button: top and right. Anchor label: left and top. Anchor controls to allow for resizing. Anchor web browser: left, top, right, and bottom.
Remote Assignment • Create a Web browser screen as shown in the last slide. • Name all of the controls. • Play with anchoring (left, top, right, bottom) properties of objects to see how they work. • If you maximize form when it runs, the “go” button should be anchored to right side, and the URL box (textbox) should stretch across form.