Presentation is loading. Please wait.

Presentation is loading. Please wait.

Introduction to MIS1 Copyright © 1998-2002 by Jerry Post Introduction to MIS Appendix 12 Visual Basic.

Similar presentations


Presentation on theme: "Introduction to MIS1 Copyright © 1998-2002 by Jerry Post Introduction to MIS Appendix 12 Visual Basic."— Presentation transcript:

1 Introduction to MIS1 Copyright © 1998-2002 by Jerry Post Introduction to MIS Appendix 12 Visual Basic

2 Introduction to MIS2 Appendix: Visual Basic  Programming Logic  Computations  Variables  Internal functions  Conditions  Loops  Input  Output Math functions AbsAbsolute value AtnArc Tangent CosCosine ExpExponential FixReturns integer portion IntConverts to integer LogLogarithm RndRandom number SgnSignum (-1, 0, 1) SinSine SqrSquare root TanTangent String functions StrCompCompare two strings LCase, UCaseConvert to lowercase or uppercase LenFind length of a string FormatFormat a string InStr, Left, LTrim Mid, Right, RTrim, TrimManipulate strings.

3 Introduction to MIS3 VB: Conditions If (condition) Then statements if true Else statements if false End If If (Sales > 1000) Then Bonus = 100 Else Bonus = 0 End If Select Case Customer Case Customer = ‘Corporate’ Discount = 0.05 Case Customer = ‘Government’ Discount = 0.10 Case Else Discount = 0.01 End Select

4 Introduction to MIS4 VB: Loops total = 0 For month = 1 To 12 total = total + SalesForMonth(month) Next month month = 1 sales = 0 Do Until (sales > 100000) sales = sales + SalesForMonth(month) month = month + 1 Loop

5 Introduction to MIS5 VB: Input and Output Could use: InputBox, MsgBox, and Printer object. Generally just use data in the application. In this example, the form collects the data and displays the result.

6 Introduction to MIS6 VBA: Excel Example Sub Macro1() ' Keyboard Shortcut: Ctrl+Shift+U For Each c In Selection c.Value = PCase(c.Value) Next c End Sub Function PCase(txt) ' Convert a text value to proper case Dim i As Integer txt = LCase(txt) Mid(txt, 1, 1) = UCase(Mid(txt, 1, 1)) i = 2 Do While (i > 0) And (i < Len(txt)) i = InStr(i, txt, " ") If (i > 0) And (i < Len(txt)) Then Mid(txt, i + 1, 1) = UCase(Mid(txt, i + 1, 1)) i = i + 1 End If Loop PCase = txt End Function


Download ppt "Introduction to MIS1 Copyright © 1998-2002 by Jerry Post Introduction to MIS Appendix 12 Visual Basic."

Similar presentations


Ads by Google