VB.Net Basics - PowerPoint PPT Presentation

1 / 23
About This Presentation
Title:

VB.Net Basics

Description:

TOE Chart Task, Object, Event. Task your interface helps user perform. Object the VB control you will use ' ... Task List at bottom left will show error msg. ... – PowerPoint PPT presentation

Number of Views:72
Avg rating:3.0/5.0
Slides: 24
Provided by: cisUso
Category:
Tags: basics | bottomleft | net

less

Transcript and Presenter's Notes

Title: VB.Net Basics


1
VB.Net Basics
  • R. Johnson ITE 285

2
Designing a GUI
  • Form the on screen window your program owns
  • TOE Chart Task, Object, Event
  • Task your interface helps user perform
  • Object the VB control you will use
  • Fired Event for which you will write code to
    respond. May be N/A.
  • Also dont forget a simple sketch!!!

3
TOE Chart
4
Command Button
  • Task major user-initiated action
  • Common Properties
  • Name (the variable name)
  • Text (what is displayed)
  • Prefix btn
  • Click event procedure where you put code.

5
Textbox
  • Task enter/edit text
  • Common Properties
  • Name, Text
  • TextAlign, Readonly
  • CharacterCasing
  • Multiline
  • Prefix txt

6
Label
  • Task static cosmetic text, describe a textbox,
    or sometimes display output
  • Common Properties
  • Name, Text
  • UseMnemonic
  • Prefix lblnon-default name only needed if you
    use at runtime

7
Checkbox
  • Task make a simple yes/no setting
  • Common Properties
  • Name, Text
  • Checked (a boolean)
  • Prefix chk

8
Radiobutton
  • Task Exclusively pick one option from a group of
    possible settings.
  • Common Properties
  • Name, Text
  • Checked
  • Prefix rad
  • Usually with Groupbox

9
Groupbox
  • Purpose
  • Visually group related controls for clarity
  • Define a set of radiobuttons
  • Common Properties
  • Prefix

10
More on Properties
  • We will be using many other properties of these
    controls!!

11
Not in the Toolbox
  • Inputbox
  • Messagebox
  • Similar to JOptionPane dialogs in Java
  • Only use on exceptional basis!!!!!

12
Keyboard Issues
  • Focus
  • Currently highlighted control will receive
    keystrokes, has the focus.
  • Focus is advanced to next control by mouse click
    on it or pressing the Tab key.
  • Tab Order
  • Default order is order in which created.
  • Edit order interactively ViewgtTab Order
  • Or TabIndex property of each control.
  • Access Keys
  • in Text value works with Alt- as a keyboard
    shortcut

13
VB.Net IDE
  • IDE Integrated Development Environment
  • Contains source code editor, compiler, debugger,
    help.
  • Similar in concept to JGrasp or Eclipse.

14
New Project Dialog
  • Make sure you set the location where you want
    it!
  • Name is used for new folder as well as files.

15
Project Workspace w/Form
16
Toolbox
  • Double-click or dragndrop to place control on
    Form
  • Click in toolbar if hidden
  • Your controls are objects, instances of the
    control class.

17
Properties
  • If hidden
  • AZ button sorts alphabetically
  • Click in value field for button to see predefined
    list

18
Writing Code
  • When using the Design view to add controls and
    adjust Properties, code is written for you.
  • Add your code in Code View
  • Dbl-click on a control in Design View to open
    Code View for its default Event Handling
    Procedure
  • Can switch views with tabs at top
  • Most of our code for now will be in Event
    procedures

19
Compiling and Running
  • Build menu compiles and links
  • Debug menu has Start to run, or Play button in
    toolbar.

20
Build (Syntax) Errors
  • ALWAYS click No on a build error!
  • Task List at bottom left will show error msg.
  • Dbl-click msg to highlight suspected line of code
    in source window.

21
Solution Explorer
  • Rename your form from the default Form1 to
    something like frmMain (in Properties).
  • Next, rename the file the same, eg frmMain.vb
  • Set the projects Startup Object to the new name
    (menu ProjectgtProperties)

22
Project FilesDefault location is underMy
DocumentsgtVisual Studio ProjectsgtYourProjectName
23
Project Files 2
  • You can load project by dbl-clicking Project
    (.vbproj) or Solution (.sln) file.
  • The compiled executable (.EXE) is in the bin
    folder.
  • NEVER save files to a floppy using FilegtSaveAs
    from inside Visual Studio!
  • Always save everything, exit VS, then copy entire
    project folder.
Write a Comment
User Comments (0)
About PowerShow.com