Visual Basic NET And Visual Studio 2008 Visual
Visual Basic. NET And Visual Studio 2008
Visual Studio Express 2008 � Free Download � http: //www. microsoft. com/express/vb/ � Clusters have Visual Studio 2005
Who has used VB. NET? • Get to know your knowledgeable classmates • Ask the TAs early and often 3
What is Visual Basic. NET? UI Builder 4
What is Visual Basic. NET? Code Editor
What is Visual Basic. NET Debugger
The UI builder Drag and drop GUI elements Property editor to change the characteristics of UI controls Does not help you with the dynamic behavior of UI controls 7
The UI builder: Toolbox � Holds ◦ ◦ ◦ all the form elements Buttons Labels Check. Boxes Panels Web Browsers
The UI builder: Properties � Change properties of a UI item ◦ Mostly visual properties �Font �Color �Background Image �Size �Visibility
The code editor Write code to give UI controls behavior Watch for warning and error feedback Use the editor to help find the names of methods and properties of things 10
VB. NET: Variables and Sub Procedures � Variables ◦ Declared with “Dim variable. Name As variable. Type” �Ex. Dim num. Students As Integer ◦ Standard data types (Byte, Char, Integer, Double, Long, Short, Single, String, Date, Boolean, Object, Decimal) � Sub Procedures (methods) ◦ Most of these will be written for you (event-based) ◦ Declared with “Sub function. Name(By. Val or By. Ref input. Variable…)” � End with “End Sub” � Ex. Public Sub add. Numbers(By. Val num. A As Integer, By. Val num. B As Integer) Dim answer As Integer = num. A + num. B; End Sub
The debugger When you see a problem, start with a hypothesis Set breakpoints to inspect parts of the program that will help you test your hypothesis If you’re stuck, check your assumptions 12
Reading Input Dim text. Input As String = one. Text
Switching Panels � Need to switch between different screens � Use panels as containers for each screen � Create an array to hold all the panels � Create a method that: ◦ Loops through the array ◦ Displays the proper panel ◦ Hides all of the other panels
Cooler (non-square) buttons � Use images � Overlay square buttons over a background image
Additional Resources � TAs � http: //msdn. microsoft. com/en- us/vbasic/default. aspx � http: //www. homeandlearn. co. uk/NET/vb. Net. h tml � More on the course website ◦ http: //www. cs. cmu. edu/~bam/uicourse/08763 fall 08/visualbasicresources. html
let’s average three numbers (1) take three numbers and show the average (2) make sure the text represents a number (3) show an error when there aren’t three numbers (4) show the average when there are three numbers 17
prototype your code! 18
before you write any code. . . decide what features you will and won’t implement determine what variables and state you will have to manage in the interface decide how you will use events to manage and manipulate this state 19
design your architecture! what is the underlying state necessary for it to run? which states depend on each other? what are the different modes in the interface? how will you switch between modes? what input is valid and what input is invalid? how will you check the validity of input data? 20
the design of our averaging UI three numbers as input, represented as text one number as output, represented as text after every change to the text representing the three numbers, validate the text and provide visual feedback on errors 21
demo 22
- Slides: 22