A.S.

Syllabus for Visual Basic COP 2171

4-Credits

Text: Simply Visual Basic 2008 - by Deitel

Spring 2010

Lecture: Rm 19-102 M/W 1:00-3:00; Office Hours: After class. MTWF: 10:00-11:30. Thu: 4:00

CRN 21391

Professor: Floyd J Winters 752-5488, WinterF@scf.edu

 

 

 

1Design | 2Calcs | 3Validate | 4Loops | 5Functions | 6Arrays & Menus | 7Log-in | 8StreamWriter | 9DB | 10Reports

 

 

Home

E-mail: winterf@scf.edu, Subject: 2171YourLastName, Message: your 6-digit ID, it can be a date

Grades

To check grades: http://faculty.mccfl.edu/winterf/WinterF.htm, COP 2171, click Grades

Objective:

Give students the background to WRITE programs, learn basic programming concepts, and object-oriented programming. This is an ADVANCED course. This course will NOT teach students how to USE basic programs like a Word Processor or Windows.

 

Helpful Links:

Department Web Page: http://www.scf.edu/pages/177.asp

Virtual Library: http://www.scf.edu/pages/1967.asp

Academic Resource Center: http://www.scf.edu/pages/144.asp

Student Services: http://www.scf.edu/pages/242.asp

End-of-term Course Evaluation: http://www.scf.edu/DLEval/validate.cfm

DL Home Page: http://www.scf.edu/pages/108.asp  Distance Learning Self Assessment

Technical Assistance: helpdesk@scf.edu or call SCF at 941.752.5357 or contact Online Academic Services Help Desk 24/7 Toll free: 866.506.1188 or https://supportcenter.embanet.com/scf

 

Email: All communication for this course should be through Angel email

 

Student Responsibility: All assignments should be emailed to the instructor through the Angel online learning software platform by the due dates provided in the assignment schedule shown on this syllabus.

Additional questions and correspondence should be submitted to the instructor through Angel email. Proofread, Spell-check, professionally write, and include a meaningful Subject line for all email. Label all assignment email with the assignment name in the Subject line, such as Word 4 Assignment and your issue. The instructor will answer all correspondence within 48 hours.

Standards of Conduct
: Students are expected to abide by all Lancer Student Handbook guidelines.

 

Withdrawal Policy: In accordance with the State College of Florida policy, as stated in the college catalog, students may withdraw from any course, or all courses, without academic penalty, by the withdrawal deadline listed in the State College of Florida academic calendar. See the online Academic Calendar for important dates.  Students should take responsibility to initiate the withdrawal procedure but are strongly encouraged to talk with their instructors before taking any withdrawal action.  In addition, students should note that faculty may also withdraw students for violating policies, procedures or conditions of the class, as outlined in individual class syllabi, and such action could affect financial aid eligibility.

Statement of Plagiarism: Plagiarism is the use of ideas, facts, opinions, illustrative material, data, direct or indirect wording of another scholar and/or writer—professional or student—without giving proper credit. Expulsion, suspension, or any lesser penalty may be imposed for plagiarism. Copying another student's work will result in a zero for both students.

 

Accommodation Services: The State College of Florida, in accordance with the Americans with Disabilities Act will provide classroom and academic accommodations to students with documented disabilities. If you need to request an accommodation in this class due to a disability, or you suspect that your academic performance is affected by a disability, please see me or contact the Disability Resource Center (DRC). The DRC is located in 300-326 on the Venice campus and in the Student Services Center (01-219) on the Bradenton campus. The phone number is 941-408-1448   Ext # 61448 (TTY 941-480-3420) on the Venice campus and 941-752-5295 Ext # 65295 (TTY 941-751-8179) on the Bradenton campus.

 

Course Evaluation: Each class assignment is worth 100 points. Grading criteria for each assignment are provided below. The instructor will typically do a pregrade for each assignment during the class just prior to the due date. Additional student resources are available on the instructor’s website.

 

Consider downloading a free copy of Visual Studio Express

For a full copy of Visual Studio see: http://mcc1.mccfl.edu/msdnaa/homepage.cfm

 

Student Resources for Textbook: Source Code, Quizzes, PowerPoints, Videos

 

Begin INVOICE project. VB.Net-Tutor.zip: http://faculty.mccfl.edu/WinterF/0ClassFolders/2171VB/

Read
Tutorial 2
 

You will do an INVOICE project of your choice for your own business (it can be make believe). You will add to and refine your project week by week as you do the screen design, data entry, calculations, error checking, log in screen, about screen, color and font dialog boxes, save the data, retrieve the data… You will back up the project each week, but you will never use the backups unless there is an emergency. Always use the same program week after week. Do not rename it, just keep adding to it.

Assign 1

Pseudocode

Form Design

Tutorial 3

Due Wed Wk 2 100pts

Refresh
Browser
each
visit

 

10pts Type up an algorithm (p127) or Pseudocode (p411) of how your Final Invoice program will work.
Look at syllabus to see what will be done to the Invoice program during the semester.

10pts Type up a Flowchart of how your FINAL Invoice program will work.

10pts Name your new project with a short relevant name. Ex: InvoiceDVDs or InvCars or InvRepairs

10 Begin Form design: Add main labels to form (p47) and align Labels appropriately (p49)

Under the Label Name property use good object names lblTitle, lblInvDate, lblCustName, lblPart#, lblDescription, lblPrice, lblQuantity, lblTax, lblTotal…

10 Use at least two noticeably different Label Fonts (p48) and label Colors (p45)

10 Add a relevant Picture Box (p49), such as a logo

10 Set the Form Title and Description in TitleBar (see Form.Text property)

10 Add a Tab Control (it’s in the toolbox; if we do not do this upfront it may cause problems later: sometimes if you paste existing code to a new Tab you may have to retype the “handles” section at the end of the sub. Ex: handles txtPrice.leave

10 Everything is attractive, well designed and lined up.

10 Save form (P43) with a good form name (like InventoryMainEntry).

This will be graded in the lab on your USB drive. You must have a USB thumb drive.
[Insurance (+5): E-mail me your 6-digit ID (see top of syllabus)]

 

Good debugging practices:

Make the problem as simple as possible | Consider creating a project called Junk with just 2 text boxes to test your code before adding it to your real project | Insert breakpoints | Use Debug.WriteLine and view the Output window to see the value of your variables | Use VB help | Do a search on the Web for sample code

 

 

Continue INVOICE project with input Textboxes and Variables – Screen Grade based on assign 1-2

Know: Object, Class (pattern), Property, Method (object action such as .close), Event (user action such as keypress), Procedure

Assign 2

Input

Tutorial 4

Calculations

Tutorial 5 Variables

Tutorial 6

Tutorial 7


Practice grade:
Mon Jan 25

 

Due Wed Wk 3

Wed Jan 27

100pts

 

Angel Quiz 1
W 02/03/10 

Continue. Click on last week’s project folder and backup: [Ctrl] + [C], then [Ctrl + V].
Do not work with the backup. Do not rename your main project or your project folder.

10 Add additional suitable Labels (p70) Set at least 2 noticeably different Label border styles (p73)

10 Add corresponding Textboxes (p74): txtInvDate, txtCustName, txtPart#, txtDescription, txtPrice, txtQuantity, lblCalcTax, lblCalTotal (Autosize=False)

10 Most Label text should be left aligned (p49), Numbers right aligned (p75)

10 Add a working [Exit] Button: btnExit (Text: E&xit) that works on [Alt]+[X]. Code: End  (p451)

10 Add a button (p75, p95, p145) to [Calculate].

Code: lblTotal.text = Val(txtPrice.text) * Val(txtQuantity.text)

10 Set variables that convert txtPrice and txtQuantity to numbers using the Val command (p92)

10 Dim a variable (p106) with local or procedure scope for decTotal (vs module or global scope)

10 Set txtlInvDate to default to today’s date and set any other appropriate defaults (p290)

10 Add a button to [Clear] all the data entry from prior records (p188).

Ex: lblXYZ.Text = "", txtXYZ.Clear. Then set txtABC.focus on the first textbox (p210)

05 At beginning of program add documentation comments or REMs () for Title, Creation Date, Author Description and add a “To Do” Section.  Ex: To Do: Add accumulator for Total Sales

Use side Comments/REMarks (p89) or Top REMs to explain harder code
05 Demonstrate how to set and step through a Breakpoint during the screen grade.(p116)

 

 

Refine INVOICE project - Handling Exceptions and Messages – Screen Grade based on assign 1-3

Assign 3

Calculations

Decisions

Validation

Formats

Tutorial 7

Checkboxes

Tutorial 8

Due Wed Wk 5
Wed Feb 10

100pts

 

Refresh
Browser
each visit

Angel Quiz 2
W 02/10/10

Continue. Click on last week’s project folder and backup: [Ctrl] + [C], then [Ctrl + V].

10 Add IF statements to check for valid input range for Price and Quantity, displaying a message box on lost focus. (p134) [Ex: Price >= 99] allow reentry (Ex: Is this too high? [Yes] [No]) (p163)

10 Add IF statements to check for IsNumeric for Price and Quantity (use VB help)

10 Display an input specific message box with icon on click in Calculation procedure if either Price or Quantity is Null (“”) (p166)

10 All Calculations must now work (p138-140) (Replace [Calculate] button with Call)

10 Add checkbox for Tax_Exempt. Only calculate tax if Tax_Exempt is unchecked (p157, p161)

Ex: If chkTax.Checked =True

05 Calculate decTax and set lblCalcTax equal to decTax

05 Calculate decTotal and set lblCalTotal equal to decTotal

10 Format ALL Dates and Numbers (p142-144, 298, 323)
Ex: txtSubTotal.Text = FormatNumber(txtSubTotal.Text, 2)

10 After the user enters txtPart#, covert it to all uppercase (text.ToUpper method – p511); Trim (text.Trim – p518) any leading spaces and keep string length for txtPart# to 6 characters

10 Add a Try/Catch block to Calculation routine. (p593-p598)

10 Organize code: The Title and ID comments are at the top, then comes the Class, then Form Load, Create a #Region for Input code, a #Region for Calculations, and a #Region for Buttons

 

 

 

Continue the INVOICE project - SCREEN GRADE based on assign 1-4

Assign 4

Loops

See Loops.zip

Do While

Tutorial 9

Loop Until

Tutorial 10

For/Next

Tutorial 11

Due Wed Wk 6
100pts

 

Angel Quiz 3

W 02/17/10

On a separate Tab use a Loop to add a ListBox to display the financing for up to 5 years for the balance of the Invoice

10 Add appropriate text boxes to enter number years to finance the invoice, and add any other textboxes needed to complete this assignment (see bottom of p189).  Also add somewhere an InputBox

10 Add a working ListBox (p181-p182)

10 Add a Header to the ListBox using & and ControlChars.Tab (p193, lines 18-20)

10 Properly Dim any required variables (p192-193)

10 Add a Do-While loop for financing calculations (p191) (compare to p234-235 using For/Next)

10 Add a Counter to increment the number of years (p192)

10 Properly exit the loop after 1 to 5 years (p192-193)

10 Add the code needed to do the financing calculations (p193)

10 Display the results in multiple columns in the list box [Ex: items.add] (p195-196)

10 On a separate Tab use a For/Next Loop and a Timer (p297) for a countdown (decrement) and some type of animation

 

 

 

Continue the INVOICE project - SCREEN GRADE based on assign 1-5

Assign 5

Case
Tutorial 12

Functions

Tutorial 13

Tutorial 14

Scope

Tutorial 15

Due Wed Wk 7 100pts

 

Angel

Quiz 4 

 

Angel

Quiz 5 

10 Select Case statement to make a decision and print out multiple possible messages for your project. (p246)

10 Use an appropriate programmer-created function with your program (also see Function.zip) (p267)

If you use my demo functions above: make up another of your own or modify another from the Web.

10 Demonstrate during screen grade how to use the Debugger to Step Into and Step Over (p277)

Use at least one Debug line in Call Calculations [Ex: Debug.WriteLine("txtPrice= " & txtPrice.Text)]

During Run time there is an Immediate window button on the menu bar that will show values.

10 Add a formatted DateTime Picker, so there is both a default Invoice date (txtInvDate) and a System date (today’s date: lblSysDate) (p296, p323)

10 Use a least 1 local variable (p317), declare and initialize at least 1 Const - such as TaxRate (p318)

10 Add an Accumulator, such as decTotal += decSales (p319) to total current and past invoices in a separate label that only becomes visible after tapping the [Clear] button (p319)

10 Enable Option Strict On to avoid subtle errors (p326 to p329). You will need statements like:

10 Qty = CInt(txtQty.Text) and Price = CDec(Val(txtPrice.Text)) or Convert.ToDecimal(txtPrice.Text)

10 Add ToolTips to all Buttons (Drag ToolTip control to component tray; set Tooltip property)

05 Add a Status Bar with at least 2 components (Drag StatusStrip control to component tray; set Items)

05 Change form’s icon (see the forms Icon Property). do a search on icons, download an icon maker, or using a program like Photo Filtre make a small 16x16 or 32x32 image and choose Tools > Export as icon

 

Midterm 200pts Mar 17

50 Question Multiple Choice online MIDTERM on commands, terms, and concepts from assign. 1-5.
See see MidtermReview on the FTP site and MidtermPracticeVB1.Zip.

 

Mar 08-12 Spring Break

Withdrawals:

In accordance with the SCF policy as stated in the college catalog, students may withdraw from any course or all courses without academic penalty of a WF by the withdrawal deadline as listed in the SCF academic calendar. The student must take responsibility for initiating a withdrawal. Please talk your professor first.

 

 

Use arrays and collections on INVOICE project – SCREEN GRADE based on assign 1-6

Assign 6

Random #s T16

1 Dim Array

ComboBoxes

Tutorial 17

2 Dim Arrays 18

Classes Tut 19

Collections

Tutorial 20
Dialog Boxes

Tutorial 21

Due Mon 3/29 Wk10 100pts

 

Angel

Quiz 6 

10 Load the South East states into a 1 dimensional Array called arrayStates (P366)

10 Add a ComboBox to your form for State, with a default value of FL (use its Text property) (p367)

10 Load arrayStates into the ComboBox [Ex: cboStates.DataSource = arrayStates] (p368)

05 Sort the array [Ex: Array.Sort(arrayStates)] (p374)
In place of the above you can build your own Array to store each record added:

    Dim Description(1000) As String

    Dim Quantity(1000) As Integer

    Dim rc As Integer ' Record Count

    Private Sub btnStoreRecord_Click...

        rc += 1

        Description(rc) = txtDescription.Text

        Quantity(rc) = CInt(txtQuantity.Text)

' Store all relevant fields in array; Use an accumulator to keep running totals

' Use a loop or listbox to display the Array: For X = 1 to rc

' ListBoxShowArray.Items.Add(Description(rc) & ControlChars.Tab & Quantity(rc))

    End Sub

10 All TextBox, CheckBox, ComboBox objects have normal top-down/left-right Tab index (p449)

10 Put all form Labels in a Collection (p455, p459) (My online demo is better using With statement)

… Access the Collection with a For Each statement (p461)

10 Add code to change the Label Collection Color and Font using a Color Dialog Box (p492-494)

10 Add code to access the Label Collection Color Dialog Box if the [F2] key is pressed (p482-483)

… Add Menu options (p490-491)for  

05 File > Exit

05 Edit > Color (to access the Label Collection Color Dialog Box) (p492-494)

05 Edit > Font (to access a Font Dialog box)

05 Help > About (use a Message Box to display Title, Description, Author, Creation Date, Version)
05 Help > Hints [Process.Start("NotePad", "../Hints.txt")] Also make it work with [F1] key (p483)

 

 

 

Add a Log-in form with a Password to INVOICE project – SCREEN GRADE based on assign 1-7

Assign 7

Due Wed Wk11

100pts

 

Angel

Quiz 7

10 Add an attractive Splash Screen consistent with your overall project design

20 Add an attractive Log-in Form (Project > Add Form) consistent with your overall project design and is the Startup object for your project. Automatically center the Log-in form when it opens (there is a property)

10 Link the Log-in form to frmMainEntry

10 Link to frmMainEntry with a properly formatted Password (*** there is a property);

10 Give user 3 tries for the password (need a Counter and If command) (Include an image back door)

10 Close the log-in form after the non-modal (modeless) frmMainEntry opens

10 Add a modal ShowDialog About box (Title, Description, Author, Creation Date, Version)

Project > Add New Item > About Box: change content through properties and [Assembly information]

20 A Context Menu (Rt-click) for changing TextBox Color and Font using a Color/Font Dialog Boxes

 

 

Add a Password using a StreamWriter to INVOICE project – SCREEN GRADE based on assign 1-8

Assign 8

.ToUpper. .Trim

Already did T22

Write to File

Tutorial 23

Due Wed Wk12

100pts

 

Window
Quiz

10 Add a menu item called Tools > Password

10 Use an InputBox to enter the new Password

10 Save the Password to a text file (the extension will be .txt) created by IO.StreamWriter (p533-p537)

10 Add a RichTextBox (from the Toolbox) to your project that will be used to create a small relevant multiline text file

20 Add a [Save] Button with code that will store the results of a multiline RichTextBox

20 Add a [Open] Button with code to use IO.StreamReader to retrieve the multiline text file (p546)

10 Store the multiline text file in an Array

10 Display the array in a ListBox (You can use my online Months sample as a pattern only. Do not use Months for your project.)

Click here to see easy code to create, write, and read a Simple File

 

 

 

Link a Database to your INVOICE project – SCREEN GRADE based on assign 1-9

Assign 9

Databases

Tutorial 24

LINQ

Tutorial 32

Due Wed

Wk14 100pts

 

Quiz 8

20 * Build a Microsoft Access Database where each database field matches each input Textbox in your Visual Basic Invoice program. Do Not save calculated fields to file on disk.
Be sure to know the terms on: 0ClassFolders/2171VB/DataBases/SamplePayrollReportAndTerms.gif

See database samples at: http://faculty.mccfl.edu/WinterF/0ClassFolders/2171VB/DataBases/  

20 On a separate form Tab show the Access database table in a Data Grid

20 Perfectly space and line up and format all the fields all the fields in the Data Grid

20 On a separate tab add a form that links to the Access database table

20 Put your out of range tests and error checking routines in the new form

+5 Insurance: Add a e.Graphics.DrawString to print at least 1 line (p618) (More on e.Graphics)

 

* This assignment may be modified by professor.

 

 

Read the database file and Print a Crystal REPORT – turn in a hard copy of the report below

Assign 10

Due Wed Wk15

Reports

100pts

 

Angel

Quiz 9 

Print a Crystal REPORT showing All Records (at least 12 records)

Do Not save calculated fields to file on disk.

10 Title, include Your Name

10 A Logo image in the Title

10 Neatly aligned Header

10 Detail lines, neatly formatted and lined up

10 An inline calculation in the detail section.

10 Date and Page number

10 Include a Counter totaling all the records

10 Include an Accumulator showing Totals at bottom

10 Turn in a printed copy of the Crystal Design Screen ([Alt] + [Print Screen])

10 Print a printed copy of an attractive Report, with evenly spaced margins

This will be based on lectures and online demos

 

 

Title:

YOUR COMPANY INVOICE SUMMARY (include Logo)

 

May 30, 2009

Header:

 Pur Date

Part #

Description
Price
Qty

Line Total

 

 05/01/09

PC-3GHD160

3GHz, 520GB HD, Vista

1,300.00

3

$3,900.00

Detail:

 05/01/09

FMON17

17-Inch Flat Panel Monitor

249.00

3

$747.00

 

 05/08/09

PRN-L3000

Laser Printer, 2-tray

1,100.00

1

$1,100.00

Totals:

 

Inv. Count: 3

 

 

Total:

$5,747.00

 

 

 

 

 

 

 

Footer:

 

 

 

 

 

Page 1 of 1

 

Format the above report exactly as shown (ex: currency format for Total). You can add a location column.

 

 

Print an Invoice SLIP for one record in Crystal Reports (or use e.Graphics.DrawString)

Assign 11

Due Wed Wk16

100pts

 

Angel

Quiz 10 

20 Print an Invoice SLIP with 2 or 4 vertical columns for ONE RECORD

10 A Logo image in the Title

10 Include Subtotal for the one record

10 Include Tax

10 Include Total for the one record

10 Add some nice lines

10 Make sure it is attractive, spaced neatly, with good margins

10 Turn in a printed copy of the Crystal Design Screen ([Alt] + [Print Screen])

10 Print the report showing only one record well spaced on the page

 

 

 

 

 

 

YOUR COMPANY Invoice (include Logo)

 

 

 

 

 

 

Invoice Date:

05/01/09

 

 

Customer Name:

John Williams

 

 

Part #:

PC-2GHD60

 

 

Description:

3GHz PC, 520GB HD, Vista

 

 

Price:

$1,300.00

 

 

Quantity:

3

 

 

SubTotal:

$3,900.00

 

 

Assign 12

Web app

Tutorial 28

Tutorial 29

Web Database

Tutorial 30

Due Wed Wk16

Extra Credit

100pts

Extra Credit: points below will be added as bonus points to your overall total points before averaging

40 pts Using Visual basic, create a Web Page in Visual Basic that looks like your frmMainEntry (p676)

20 pts Place the web file live on the Internet.

40 pts Make it work on the Web (p690)

Note: to Deploy your project: Right-click your project > Publish to create a Setup.exe

 

 

 

Build an excellent Documentation Package in 2 (two) parts:

(See FinalVBDocumentationCheckOff.xls for exact breakdown of points)

Assign 13

Due Wed Wk16 100pts

A: User’s Manual- front part of documentation package:

10 Table of Contents page and an Introduction page

10 Show and discuss Login procedure - use [Alt Print Screen]

10 Show and discuss frmMainEntry

10 Discuss descriptions, defaults, basic usage, data file description & path entry ranges (5),

10 Show and discuss Menu options

10 Show and discuss 2 Reports (10),

10 Show and discuss how to backup, and getting help

No VB code in the front part; the front is only for the users. (-10pts)

 

B: For Programmers- back front part of documentation package:

The back part of packet will include

10 Hardcopy of programmer code

10 Include page numbers on whole packet.

10 Documentation Package must be professionally bound or put on the Web.

 

Final Exam

Wed May 5, 12:30 Hands-on proficiency test in Lab based on 25 items listed for assignments 1-6.

400pts

For sample: faculty.mccfl.edu/WinterF/0ClassFolders/2171VB/SamplesExams/VB-FinalExamPractice.htm

 

 

Grading:

Grade Scale: A:90-100, B:80-89, C:70-79, D:60-69.  The lowest 100 point grade will be dropped.

 

-5 points for each day homework is late for 1st 5 days. -1 point for each additional day work is late.

 

For an example of a grade for a homework that is 7 days late:

 

-25 for first five days (5 times 5), -2 for next 2 days (2 times 1), so the grade will be a 73

 

Copying another student's assignment will result in a 0 for both students.

 

If you are absent for the Midterm a prorated grade based on the Final Exam will count in place.

 

The final exam is required. There will be no makeup or substitution for the Final exam.

Optional Hands On Participation Attendance Grade - 1 point each day late. -5 points each day absent.

 

 

General
Course

1. It is not hard to get a 100 on almost all assignments - just check to make sure you satisfy all of the grading criteria, which are clearly listed in the syllabus for each assignment.

Notes

2. If you have questions, feel free to visit me during my office hours.

 

3. If absent for class- ask a classmate to give you the missed notes and assignments.

 

4. You may work together, but do not touch a classmate's keyboard or diskette. (-10 pts)

 

5. Only a member of the Computer Science department may cancel class.

 

 

 

See Course Performance Standards at mccfl.edu, Academics

 

Student Services: http://www.mccfl.edu/pages/242.asp

 

Standards of Conduct: Students are expected to abide by all Lancer Student Handbook guidelines.

 

Statement of Plagiarism: Plagiarism is the use of ideas, facts, opinions, illustrative material, data, direct or indirect wording of another scholar and/or writer—professional or student—without giving proper credit. Expulsion, suspension, or any lesser penalty may be imposed for plagiarism.

 

 

 

To borrow Visual Studio CD: http://mcc1.mccfl.edu/MSDNAA/HomePage.cfm

The Visual Studio CD may not be available until after the Drop-Add period.

 

 

 

 Some Code Snippets

 

If IsNumeric(txtHours.Text) And IsNumeric(txtRate.Text) Then...

 

Private Sub txtST_Leave(ByVal sender As Object, ByVal e As System.EventArgs) Handles ...

    txtST.Text = txtST.Text.ToUpper.Substring(0, 2)

End Sub

Also know: txtST.Text = txtST.Trim ' Remove insignificant spaces: x.Text = txtST.Length

 

 

 

Private Sub btnForm2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)...

    Dim objForm2 As New frmForm2()

    objForm2.ShowDialog()  ' This is Modal – it has sole control till closed

End Sub                   ' Close Logon form after you load MainEntry form

Passing Arguments: ByVal (send value) ByRef (send mem. address), – example:

 ' Sending Procedure ByVal - passing a value to another procedure

Private Sub btnBuy_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)...

    Dim Item, Price As String, decPrice As Decimal

    Item = InputBox("Enter Item:", "Item")

    Price = InputBox("Enter price:", "Price")

    decPrice = Decimal.Parse(Price) ' or decPrice = CInt(Price)

    Call DisplayMsg(Item, Price)    ' command Call is optional

End Sub

 ' Receiving: Parameter names can be different than Receiving arguments; type must match

Private Sub DisplayMsg(ByVal It As String, ByVal Price As Integer)

 lblMsg.Text = It & "= " & FormatCurrency(Price) & ", Tax= " & (Price * 0.06).ToString("C")

End Sub

Functions return values (see Function.zip)

Private Sub txtState_Leave(ByVal sender As Object, ByVal e As System.EventArgs) Handles ...

    txtState.Text = AbbrState(txtState.Text)

End Sub

Function AbbrState(ByVal ST As String) ' Note: ST can receive txtState or other value

    Return ST.ToUpper.Substring(0, 2)  ' Capitalize.Characters 0-1 (1st two characters)

End Function

 

 

 

 (see Class.zip)

Public Property Side() As Integer ' Note the keyword "PROPERTY"

    Get 'retrieve the contents of the Private variable associated with the property.

        Return sideMeasurement ' return the contents of the Private variable

    End Get

    Set(ByVal Value As Integer) 'assign to the Private variable a default value

        sideMeasurement = Value ' Note: first word of the property name is an Adjective

    End Set

End Property

Public Sub New() 'METHODS: New()=default constructor: As in Dim objForm2 As New frmForm2()

    sideMeasurement = 0 ' Constructors typically set the default parameter

End Sub

 

 

 

Arrays: Ex: Dim Students(35) As String (see Array-ASCII.zip), row, column, subscript, element, two dimensional Ex: Dim StudentGrade(,) As String = {{"Al", "Bob", "Cindy"}, {"A", "B", "C"}}

 

Structure Friends

    Dim FirstName As String

    Dim FirstName As String

    Dim BirthDate As Date

End Structure

Private Sub Family()

    Dim Relative As Friends

    Relative.FirstName = "Bob"

    Relative.BirthDate = "12/15/00"

End Sub

 

 

 

 

Database, table, record, field, key field, XML, ADO (ActiveX Data Objects), OLE, SQL

1. Connection: link from data file to program [Place an Access database in the \bin folder. View Server Explorer, right-click Data Connections; Provider Tab- select Microsoft Jet 4.0; Connection Tab- select the Access database stored in the \bin folder, Test Connection]

2. Data adapter: passes data back and forth between data file and program [Expand the nodes under the new connection shown in the Server Explorer pane, and drag the desired table to your form. Note how OleDbConnection1 and OleDbDataAdapter1 are added to the Component tray. Note2- you can double-click the table in the Server Explorer pane to see the actual table data.]

3. Dataset: a temporary view or inactive copy of data [right-click OleDbDataAdapter1 and choose Generate Dataset. Note how DataSet11 is added to the Component tray]

4. Fill the dataset [Under Form_Load add the statement: OleDbDataAdapter1.Fill(DataSet11)]

5. Bind or link the data to the program [Add a large DataGrid control from the Toolbox to your form. Click the DataSource property dropdown arrow to select the appropriate Dataset table.] [To bind a single TextBox – add a TextBox, under the TextBox (DataBbindings) Text property, click the dropdown arrow and expand DataSet11 and choose the field to bind.)

6. Run your project to display the data from your Access Database.

(Or simply choose Project, Add Windows Form, Data Form Wizard.)

 

 

 

1. To draw a solid blue circle: in Code Window, choose (Form1_Events) from the Class/Object dropdown and choose Paint from the Methods/Events dropdown. Under Private Sub Form1_Paint enter:

2. Private Sub Form1_Paint(ByVal sender As Object, ByVal e As...

     Dim blueBrush As New SolidBrush(Color.Blue)

     e.Graphics.FillEllipse(blueBrush, 100, 100, 50, 50)

 End Sub