VB Codes

4,848 views

Published on

This presentation is created to guide ICA students in doing their Visual Basic programs in computer.

2 Comments
16 Likes
Statistics
Notes
No Downloads
Views
Total views
4,848
On SlideShare
0
From Embeds
0
Number of Embeds
6
Actions
Shares
0
Downloads
0
Comments
2
Likes
16
Embeds 0
No embeds

No notes for slide

VB Codes

  1. 2. HORIZONTAL SCROLL BAR
  2. 3. CODES
  3. 4. SHOW/HIDE/CHANGE IMAGE
  4. 5. CODES
  5. 6. ADD/REMOVE/CLEAR ITEMS
  6. 7. CODES
  7. 8. CODES
  8. 9. PRELOADING ITEMS
  9. 10. CODES
  10. 11. LIST BOX TO TEXT BOX
  11. 12. CODES
  12. 13. DOUBLE-CLICK TO REMOVE
  13. 14. CODES
  14. 15. CLICK THE REMOVE BUTTON TO DELETE THE ITEMS
  15. 16. CODES
  16. 17. DOUBLE-CLICK TO TRANSFER FROM LIST BOX TO ANOTHER LIST BOX
  17. 18. CODES
  18. 19. DISPLAYING THE ITEMS IN THE LIST BOX AND SHOWING THE DESCRIPTION IN A TEXT BOX
  19. 20. CODES
  20. 21. CODES
  21. 22. THE USE OF COMBO BOX
  22. 23. CODES
  23. 24. CODES
  24. 25. COMBO BOX TO TEXT BOX
  25. 26. CODES
  26. 27. COMBO BOX TO LIST BOX
  27. 28. CODES
  28. 29. USE OF VARIABLES
  29. 30. CODES
  30. 31. CODES
  31. 32. USE OF CONSTANTS
  32. 33. CODES
  33. 34. USE OF VARIABLES - GRADE
  34. 35. CODES
  35. 36. CODES
  36. 37. CODES
  37. 38. CODES
  38. 39. USE OF OPERATORS – GETTING THE DISCOUNT
  39. 40. CODES
  40. 41. CODES
  41. 42. OPERATORS - CALCULATOR
  42. 43. CODES
  43. 44. CODES
  44. 45. CODES
  45. 46. FUNCTIONS
  46. 47. CODES
  47. 48. CODES
  48. 49. CODES
  49. 50. COMMONLY USED FUNCTIONS <ul><li>String Functions – commands used to evaluate string values. </li></ul>
  50. 51. STRING FUNCTIONS <ul><li>Len </li></ul>Syntax: Len(string) Example: Name=“Monica” Result=Len(Name) Output: 6
  51. 52. STRING FUNCTIONS <ul><li>Left </li></ul>Syntax: Left(string, length) Example: Message=“Hello there” Result=Left(Message,5) Output: Hello
  52. 53. STRING FUNCTIONS <ul><li>Right </li></ul>Syntax: Right(string, length) Example: Message=“Hello there” Result=Right(Message,5) Output: there
  53. 54. STRING FUNCTIONS <ul><li>Mid </li></ul>Syntax: Mid(string, starting position, length)
  54. 55. STRING FUNCTIONS Example: Message=“Patience is a virtue” Result=Mid(Message,15,6) Output: virtue
  55. 56. STRING FUNCTIONS <ul><li>UCase </li></ul>Syntax: UCase(string) Example: Warning=“Wet Floor” Result=UCase(Warning) Output: WET FLOOR
  56. 57. STRING FUNCTIONS <ul><li>LCase </li></ul>Syntax: LCase(string) Example: Warning=“Wet Floor” Result=LCase(Warning) Output: wet floor
  57. 58. STRING FUNCTIONS <ul><li>Val </li></ul>Syntax: Val(string) Example: Num = five Result=Val(Num) Output: 5
  58. 59. COMMONLY USED FUNCTIONS 2. Date Functions – commands used to set the date and time.
  59. 60. DATE FUNCTIONS <ul><li>Date </li></ul>Syntax: Date() Example: Dim Cur_Date as String Cur_Date = Date() Output: 07/10/1978
  60. 61. DATE FUNCTIONS <ul><li>Time </li></ul>Syntax: Time() Example: Dim Cur_Time as String Cur_Time = Time() Output: 2:08:34 PM
  61. 62. DATE FUNCTIONS <ul><li>Now </li></ul>Syntax: Now() Example: lbl2.caption = Now() Output: 11/30/2003 8:30:23 PM
  62. 63. DATE FUNCTIONS <ul><li>Format </li></ul>Syntax: Format(string, specified format)
  63. 64. DATE FUNCTIONS Example: Dim Cur_Date as Date lbl2.caption=Format(Cur_Date, “ yyyy-mm-dd”) Output: 2009-05-14
  64. 65. COMMONLY USED FUNCTIONS 3. Number Functions – used to change looks of a value.
  65. 66. NUMBER FUNCTIONS <ul><li>Format </li></ul>Syntax: Format(string, specified format)
  66. 67. NUMBER FUNCTIONS Example: Dim Result as Single Result = 245.6 lbl2.caption=Format(Result,”0000.00”) lbl2.caption=Format(Result,”$00.00”) Output: 0245.60 $24.60
  67. 68. COMMONLY USED FUNCTIONS 4. Input/Output Functions – commands used for accepting user information.
  68. 69. INPUT/OUTPUT FUNCTIONS <ul><li>InputBox </li></ul>Syntax: variable=InputBox(“Prompt”,Title, Default_text, x-position, y-position)
  69. 70. INPUT/OUTPUT FUNCTIONS Example: Dim Add as String Add=InputBox(“What is your Address?”, Add, ”Type here”, 900, 1000) Output:
  70. 71. INPUT/OUTPUT FUNCTIONS <ul><li>MsgBox </li></ul>Syntax: variable=MsgBox(“Prompt”, Style Value, Title)
  71. 72. INPUT/OUTPUT FUNCTIONS Example: Dim Data as String Data=MsgBox(“Password accepted”, 0 ” Accepting”) Output:
  72. 73. Style Value Named Constant 0 vbOK 1 vbOKCancel 2 vbAbortRetryIgnore 3 vbYesNoCancel 4 vbYesNo 5 vbRetryCancel MESSAGE BOX STYLE VALUES
  73. 75. CODES ICONS 16 vbCRITICAL 32 vbQUESTION 48 vbEXCLAMATION 64 vbINFORMATION MESSAGE BOX ICONS

×