SlideShare una empresa de Scribd logo
1 de 55
Palitha Baddegama. Divisional Computer Resource Centre Hingurakgoda Visual basic  6.0
Palitha Baddegama , Computer Resource Centre, Hingurakgoda Form Window Title bar Menu Bar Tool Bar Tool Box Code Window Project Window Property Window Layout Window (IDE) I ntegrated  D evelopment  E nvironment
Palitha Baddegama , Computer Resource Centre, Hingurakgoda New Project Dialog Box
Palitha Baddegama , Computer Resource Centre, Hingurakgoda
Control Description Pointer Provides a way to move and resize the controls form PictureBox  Displays icons/bitmaps and metafiles. It displays text or acts as a visual container for other controls. TextBox  Used to display message and enter text. Frame  Serves as a visual and functional container for controls CommandButton  Used to carry out the specified action when the user chooses it. CheckBox  Displays a True/False or Yes/No option. OptionButton  Option Button control which is a part of an option group allows the user to select only one option even it displays multiple choices. ListBox   Displays a list of items from which a user can select one. ComboBox   Contains a Textbox and a List Box. This allows the user to select an item from the dropdown List Box, or to type in a selection in the Textbox.
HScrollBar and VScrollBar   These controls allow the user to select a value within the specified range of values Timer   Executes the timer events at specified intervals of time DriveListBox   Displays the valid disk drives and allows the user to select one of them. DirListBox   Allows the user to select the directories and paths, which  are displayed. FileListBox   Displays a set of files from which a user can select the desired one. Shape  Used to add shape (rectangle, square or circle) to a Form Line   Used to draw straight line to the Form Image   used to display images such as icons, bitmaps and metafiles. But less capability than the Picture Box Data   Enables the use to connect to an existing  database  and display information from it. OLE Used to link or embed an object, display and manipulate  data from other windows based applications. Label Displays a text that the user cannot modify or interact with.
Palitha Baddegama , Computer Resource Centre, Hingurakgoda View Code View Object Toggle Folders Project Name Forms Folder Form & modules
Name Property ,[object Object],[object Object],[object Object],[object Object],Palitha Baddegama , Computer Resource Centre, Hingurakgoda
Hungarian Notation ,[object Object],Palitha Baddegama , Computer Resource Centre, Hingurakgoda Figure 1-10 Object First three Characters  Ex: Form frm frmAddtion Command Button cmd cmdStart Label lbl lblEnd Text Box txt txtFirst Menu mnu mnuExit Check box chk chkChoice Combo box cmb cmbFont
[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],Palitha Baddegama , Computer Resource Centre, Hingurakgoda
Visual Basic's 6 Most Common Programming Statements   Statement type Examples   Declarations  - define the name, type and attributes of all program variables Dim Num as Integer  ' declares a variable "Num" to be an Integer Dim vals(5) as Double   ' declares an array of 5 Doubles named "vals" Assignment  - set values for the variables Num = Num/10  ' after the assignment Num is set to 1/10th of its former value HiString = "Hello " + "World"  '  value of HiString is set to "Hello World" Conditionals  - do operations depending on the value of one or more variables if Num > 0 then Num = Num * 2  ' Basic logic building block Select Case .... End Case  'Case block simplifies GUI programming Iterations  - control looping for repeated operations for i = 1 to 5  'For-loop counts through a precise number of steps while ( val(i) > val(imin) )   'While loops as long as condition remains True Subroutines  - calls on functions and subroutines Private Sub Form_Load()  'A subroutine does not return a value Private Function Digit()  ' A function returns a value Special statements  - used to implement unique features Set MyObject = Your Object  'Set statement assigns object references Print #FileNum, MyObject.Text  'I/O statements like Print, Input Line
Palitha Baddegama , Computer Resource Centre, Hingurakgoda Arithmetic Operators Operator Mathematical function Example ^ Exponential 2^4=16 * Multiplication 4*3=12,   (5*6))2=60 / Division 12/4=3 Mod Modulus(return the remainder from an integer division) 15 Mod 4=3     255 mod 10=5 Integer Division(discards the decimal places) 19=4 + or & String concatenation "Visual"&"Basic"="Visual Basic"
Palitha Baddegama , Computer Resource Centre, Hingurakgoda Conditional Operators Operator Meaning = Equal to > More than < Less Than >= More than and equal <= Less than and equal <> Not Equal to
Palitha Baddegama , Computer Resource Centre, Hingurakgoda Logical Operators Operator Meaning And Both sides must be true or One side or other must be true Xor One side or other must be true but not both Not Negates truth
Palitha Baddegama , Computer Resource Centre, Hingurakgoda ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],Variable  and  Data Types
Data Types ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],Palitha Baddegama , Computer Resource Centre, Hingurakgoda ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Palitha Baddegama , Computer Resource Centre, Hingurakgoda Numeric Data Types Type Storage  Range of Values Byte 1 byte 0 to 255 Integer 2 bytes -32,768 to 32,767 Long  4 bytes -2,147,483,648 to 2,147,483,648 Single 4 bytes -3.402823E+38 to -1.401298E-45 for negative values  1.401298E-45 to 3.402823E+38 for positive values. Double 8 bytes -1.79769313486232e+308 to -4.94065645841247E-324 for negative values  4.94065645841247E-324 to 1.79769313486232e+308 for positive values. Currency 8 bytes -922,337,203,685,477.5808 to 922,337,203,685,477.5807 Decimal 12 bytes +/- 79,228,162,514,264,337,593,543,950,335 if no decimal is use  +/- 7.9228162514264337593543950335 (28 decimal places).
Palitha Baddegama , Computer Resource Centre, Hingurakgoda   Nonnumeric Data Types   Data Type Storage Range String(fixed length) Length of string 1 to 65,400 characters String(variable length) Length + 10 bytes 0 to 2 billion characters Date 8 bytes January 1, 100 to December 31, 9999 Boolean 2 bytes True or False Object 4 bytes Any embedded object Variant(numeric) 16 bytes Any value as large as Double Variant(text) Length+22 bytes Same as variable-length string  
Palitha Baddegama , Computer Resource Centre, Hingurakgoda There are  three levels  of scope:  project-level  (also called &quot;global&quot; or &quot;application&quot; scope; the variable is accessible to all procedures in all modules of the project) module-level  (the variable is accessible to all procedures in the module in which it is declared) local-level   (the variable is accessible only to the procedure in which it is declared) Variable Scope
Variable Scope Palitha Baddegama , Computer Resource Centre, Hingurakgoda Form1    Form2 Dim  Y  as Integer   Dim  Z  as Integer Sub procedure 1 () Dim  A   as Double . . . . End Sub Sub procedure 2 () Static  B  as Double . . . . End Sub Sub procedure 3 () Dim  C  as Double . . . . End Sub Module1 Public  X  as Integer
Palitha Baddegama , Computer Resource Centre, Hingurakgoda MsgBox ( ) Function A=MsgBox(Prompt,  Style Value , Title)  Example:  A =MsgBox( &quot;Click OK to Proceed&quot;,  1 , &quot;Startup Menu&quot;)              A =Msgbox(&quot;Click OK to Proceed&quot;.  vbOkCancel ,&quot;Startup Menu&quot;)
Palitha Baddegama , Computer Resource Centre, Hingurakgoda Style Values Button Layout  Value  Short Description vbOKonly  0  Displays the OK button. vbOKCancel  1  Displays the ok and cancel button. vbAbortRetryIgnore  2  Displays the Abort , Retry , Ignore vbYesNoCancel  3  Displays Yes , No and Cancel button vbYesNo  4  Displays the Yes / No button vbRetryCancel  5  Displays the retry and Cancel buttons
Palitha Baddegama , Computer Resource Centre, Hingurakgoda Return Values and Command Buttons Value Named Constant Button Clicked  1 vbOk Ok button 2 vbCancel Cancel button 3 vbAbort Abort button 4 vbRetry Retry button 5 vbIgnore Ignore button 6 vbYes Yes button 7 vbNo No button
Palitha Baddegama , Computer Resource Centre, Hingurakgoda testmsg = MsgBox(&quot;Click to test&quot;, 1, &quot;Test message&quot;)  testMsg2 = MsgBox(&quot;Click to Test&quot;, vbYesNoCancel + vbExclamation, &quot;Test Message&quot;)
Palitha Baddegama , Computer Resource Centre, Hingurakgoda The Icons displayed in the message box are here   Value Named Constant Icon  16 vbCritical 32 vbQuestion 48 vbExclamation 64 vbInformation
Palitha Baddegama , Computer Resource Centre, Hingurakgoda InputBox( ) Function A=InputBox(Prompt, Title, default_text, x-position, y-position) B= InputBox(&quot;What is your message?&quot;, &quot;Message Entry Form&quot;, &quot;Enter your message here&quot;, 500, 700)
[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],Palitha Baddegama , Computer Resource Centre, Hingurakgoda
[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],Palitha Baddegama , Computer Resource Centre, Hingurakgoda
Palitha Baddegama , Computer Resource Centre, Hingurakgoda Date format Format Syntax Result Format(Now,&quot; m/d/yy&quot; ) 10/02/09 Format(Now,&quot; dddd,mmmm,dd,yyyy &quot;) Friday,October  02, 2009 Format(Now,&quot; d-mmm &quot;) 02-Oct Format(Now,&quot; mmmm-yyyy &quot;) October -2009 Format(Now,&quot; hh:mm  AM/PM&quot;) 09:36 AM Format(Now,&quot; h:mm:ss  a/p&quot;) 09:40 a Format(Now,&quot; d-mmmm h:mm &quot;) 20-October 09:41
Palitha Baddegama , Computer Resource Centre, Hingurakgoda Number format Number = 456.6768 Format Syntax Result Format(Number,&quot;# # # #.# #&quot;) 456.68 Format(Number,&quot;.# #&quot;) 456.68 Format(Number,&quot;0000.00&quot;) 0456.68 Format(Number,&quot;000000.00000&quot;) 000456.67680 Format(Number,&quot;# # # # #.# # # # #&quot;) 456.6768 Format(Number,&quot;# # # # #.0000&quot;) 456.6768
Format (n, &quot;style argument&quot;) ,[object Object],[object Object],[object Object],[object Object],[object Object],Palitha Baddegama , Computer Resource Centre, Hingurakgoda
Control Structures ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],Palitha Baddegama , Computer Resource Centre, Hingurakgoda ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
IF Then Palitha Baddegama , Computer Resource Centre, Hingurakgoda Condition Statement1 True False
IF Then – End IF Palitha Baddegama , Computer Resource Centre, Hingurakgoda Condition Statement 1 Statement 2 Statement 3 Statement 4 …………… .. Statement n True False
IF Then Else – End IF Palitha Baddegama , Computer Resource Centre, Hingurakgoda Condition True False Statement 1 Statement 2 Statement 3 Statement 4 …………… .. Statement n Statement 1 Statement 2 Statement 3 Statement 4 …………… .. Statement n
Palitha Baddegama , Computer Resource Centre, Hingurakgoda Statement  1 Statement  2 Statement  3 …………… .. Statement  n A Statement  1 Statement  2 Statement  3 …………… .. Statement  n B Statement  1 Statement  2 Statement  3 …………… .. Statement  n C IF  <Condition>  Then Else End IF
IF Then Else IF Palitha Baddegama , Computer Resource Centre, Hingurakgoda Condition True False Statement 1 Statement 2 Statement 3 …………… .. Statement n Statement 1 Statement 2 Statement 3 …………… .. Statement n Condition False Statement 1 Statement 2 Statement 3 …………… .. Statement n Statement 1 Statement 2 Statement 3 …………… .. Statement n True
Palitha Baddegama , Computer Resource Centre, Hingurakgoda Statement  1 Statement  2 …………… .. Statement  n A Statement  1 Statement  2 …………… .. Statement  n B Statement  1 Statement  2 …………… .. Statement  n C IF  <Condition>  Then Else End IF Statement  1 Statement  2 …………… .. Statement  n D ElseIF  <Condition>  Then
Nested Loop Palitha Baddegama , Computer Resource Centre, Hingurakgoda Condition True False Statement 1 Statement 2 Statement 3 …………… .. Statement n Statement 1 Statement 2 Statement 3 …………… .. Statement n Condition False Statement 1 Statement 2 Statement 3 …………… .. Statement n Statement 1 Statement 2 Statement 3 …………… .. Statement n True
Palitha Baddegama , Computer Resource Centre, Hingurakgoda Statement  1 Statement  2 …………… .. Statement  n A IF <Condition 2> Then   Statement  1 Statement  2 …………… .. Statement  m Else Statement  1 Statement  2 …………… .. Statement  p B C IF <Condition 1>  Then End IF Statement  1 Statement  2 …………… .. Statement  q D Else
Select Case ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
GoTo Statement ,[object Object],[object Object],[object Object],[object Object],[object Object]
While -Wend Palitha Baddegama , Computer Resource Centre, Hingurakgoda Condition Statement 1 Statement 2 Statement 3 ……………… Statement n True False While  Condition Statement  1 Statement  2 …………… .. Statement  m Wend
Do While - Loop Palitha Baddegama , Computer Resource Centre, Hingurakgoda Condition Statement 1 Statement 2 Statement 3 ……………… Statement n True False Do While  Condition Statement  1 Statement  2 …………… .. Statement  m Loop
Do – Loop While Palitha Baddegama , Computer Resource Centre, Hingurakgoda Condition Statement 1 Statement 2 Statement 3 ……………… Statement n True False Do Statement  1 Statement  2 …………… .. Statement  m Loop While  Condition
Do Until - Loop Palitha Baddegama , Computer Resource Centre, Hingurakgoda Condition Statement 1 Statement 2 Statement 3 ……………… Statement n True False Do Until  Condition Statement  1 Statement  2 …………… .. Statement  m Loop
Do – Loop Until Palitha Baddegama , Computer Resource Centre, Hingurakgoda Condition Statement 1 Statement 2 Statement 3 ……………… Statement n True False Do Statement  1 Statement  2 …………… .. Statement  m Loop Until  Condition
For Next  Palitha Baddegama , Computer Resource Centre, Hingurakgoda For   counter  =  start   To   end  [  Step ]  [ statements 1 ]  [ statements 2 ] [ statements 2 ] Next   [  counter  ] counter   Required in the  For  statement. Numeric variable. The control variable for the loop.  start   Required. Numeric expression.  The initial value of  counter .  end   Required. Numeric expression.  The final value of counter.  step   Optional. Numeric expression. The amount by which  counter  is incremented each time through the loop.  statements   Optional. One or more statements between  For  and  Next  that run the specified number of times.  Next  Required. Terminates the definition of the  For  loop.
Palitha Baddegama , Computer Resource Centre, Hingurakgoda For  i  =  1   To  7   Print  “Visual Basic” Next  i i = 1    Visual Basic i = 2    Visual Basic i = 3    Visual Basic i = 4    Visual Basic i = 5    Visual Basic i = 6    Visual Basic i = 7    Visual Basic For   - for loop  i   - use i as our integer 1   - start value = 1   To  - between start and stop value 7   - stop value = 7 Next  - go to next step (if  i > 7 then end for loop)
Palitha Baddegama , Computer Resource Centre, Hingurakgoda For  i  =  0   To  9   Print  i   Next  i i= 0 i= 1 i= 2 i= 3 i= 4 i= 5 i= 6 i= 7 i= 8 i= 9
Palitha Baddegama , Computer Resource Centre, Hingurakgoda Private Sub Command1_Click() Dim  i  As Integer Dim  j  As Integer For  i = 1 To 5 For  j = 1 To 7 Print i   Next  j Next  i End Sub Inner Loop Outer Loop ; 1 2 3 4 5 14 21 7 28 35
Palitha Baddegama , Computer Resource Centre, Hingurakgoda Private Sub Command1_Click() Dim i As Integer Dim j As Integer For  i = 1 To 5 For  j = 1 To 7 Print j ; Next  j Print Next  i End Sub Inner Loop Outer Loop i=1 j=1 j=2 j=3 j=4 j=5 j=6 j=7 i=2 j=1 j=2 j=3 j=4 j=5 j=6 j=7 i=3 j=1 j=2 j=3 j=4 j=5 j=6 j=7 i=4 j=1 j=2 j=3 j=4 j=5 j=6 j=7 i=5 j=1 j=2 j=3 j=4 j=5 j=6 j=7
Palitha Baddegama , Computer Resource Centre, Hingurakgoda Private Sub Command1_Click() Dim i As Integer Dim j As Integer For  i = 1 To 5 For  j = 1 To 7 Print i ; Next  j Print Next  i End Sub Inner Loop Outer Loop i=1 j=1   i =1 j=2   i =1 j=3   i =1 j=4  i =1 j=5   i =1 j=6   i =1 j=7   i =1 i=2 j=1   i =2 j=2   i =2 j=3   i =2 j=4   i =2 j=5  i =2 j=6  i =2 j=7   i =2 i=3 j=1   i =3 j=2  i =3 j=3  i =3 j=4   i =3 j=5  i =3 j=6   i =3 j=7  i =3 i=4 j=1 i =4 j=2 i =4 j=3 i =4 j=4 i =4 j=5 i =4 j=6 i =4 j=7 i =4 i=5 j=1 i =5 j=2 i =5 j=3 i =5 j=4 i =5 j=5 i =5 j=6 i =5 j=7 i =5
Palitha Baddegama , Computer Resource Centre, Hingurakgoda For  i = 1 To 10 For  j = 1 To 10 Print j ; Next  j Print Next  i For  i = 1 To 10 For  j = 1 To 10 Print i ; Next  j Print Next  i For  i = 1 To 10 For  j = 1 To i Print i ; Next  j Print Next  i For  i = 1 To 10 For  j = 1 To i Print j ; Next  j Print Next  i For  i = 1 To 10 For  j = i To 10 Print j ; Next  j Print Next  i For  i = 1 To 10 For  j = i To 10 Print i ; Next  j Print Next  i
Palitha Baddegama , Computer Resource Centre, Hingurakgoda Working with Menus in VB6

Más contenido relacionado

La actualidad más candente

Visual basic ppt for tutorials computer
Visual basic ppt for tutorials computerVisual basic ppt for tutorials computer
Visual basic ppt for tutorials computersimran153
 
Asp.net state management
Asp.net state managementAsp.net state management
Asp.net state managementpriya Nithya
 
Visual programming lecture
Visual programming lecture Visual programming lecture
Visual programming lecture AqsaHayat3
 
Visual basic 6.0
Visual basic 6.0Visual basic 6.0
Visual basic 6.0Aarti P
 
Control structures in java
Control structures in javaControl structures in java
Control structures in javaVINOTH R
 
Visual basic 6.0
Visual basic 6.0Visual basic 6.0
Visual basic 6.0sanket1996
 
Validation Controls in asp.net
Validation Controls in asp.netValidation Controls in asp.net
Validation Controls in asp.netDeep Patel
 
Windows 7 Unit A PPT
Windows 7 Unit A PPTWindows 7 Unit A PPT
Windows 7 Unit A PPTokmomwalking
 
Visual Basic Programming
Visual Basic ProgrammingVisual Basic Programming
Visual Basic ProgrammingOsama Yaseen
 
Introduction to Visual Basic 6.0 Fundamentals
Introduction to Visual Basic 6.0 FundamentalsIntroduction to Visual Basic 6.0 Fundamentals
Introduction to Visual Basic 6.0 FundamentalsSanay Kumar
 
introduction to visual basic PPT.pptx
introduction to visual basic PPT.pptxintroduction to visual basic PPT.pptx
introduction to visual basic PPT.pptxclassall
 

La actualidad más candente (20)

4. listbox
4. listbox4. listbox
4. listbox
 
Visual basic ppt for tutorials computer
Visual basic ppt for tutorials computerVisual basic ppt for tutorials computer
Visual basic ppt for tutorials computer
 
Asp.net state management
Asp.net state managementAsp.net state management
Asp.net state management
 
Visual programming lecture
Visual programming lecture Visual programming lecture
Visual programming lecture
 
Visual basic 6.0
Visual basic 6.0Visual basic 6.0
Visual basic 6.0
 
VB.net
VB.netVB.net
VB.net
 
Visual basic
Visual basicVisual basic
Visual basic
 
Control structures in java
Control structures in javaControl structures in java
Control structures in java
 
PL/SQL TRIGGERS
PL/SQL TRIGGERSPL/SQL TRIGGERS
PL/SQL TRIGGERS
 
Visual basic 6.0
Visual basic 6.0Visual basic 6.0
Visual basic 6.0
 
VB6 Using ADO Data Control
VB6 Using ADO Data ControlVB6 Using ADO Data Control
VB6 Using ADO Data Control
 
Visual Basic Controls ppt
Visual Basic Controls pptVisual Basic Controls ppt
Visual Basic Controls ppt
 
Vb introduction.
Vb introduction.Vb introduction.
Vb introduction.
 
Validation Controls in asp.net
Validation Controls in asp.netValidation Controls in asp.net
Validation Controls in asp.net
 
Windows 7 Unit A PPT
Windows 7 Unit A PPTWindows 7 Unit A PPT
Windows 7 Unit A PPT
 
Visual Basic Programming
Visual Basic ProgrammingVisual Basic Programming
Visual Basic Programming
 
Introduction to c#
Introduction to c#Introduction to c#
Introduction to c#
 
Introduction to Visual Basic 6.0 Fundamentals
Introduction to Visual Basic 6.0 FundamentalsIntroduction to Visual Basic 6.0 Fundamentals
Introduction to Visual Basic 6.0 Fundamentals
 
Applets in java
Applets in javaApplets in java
Applets in java
 
introduction to visual basic PPT.pptx
introduction to visual basic PPT.pptxintroduction to visual basic PPT.pptx
introduction to visual basic PPT.pptx
 

Destacado

Control Structures in Visual Basic
Control Structures in  Visual BasicControl Structures in  Visual Basic
Control Structures in Visual BasicTushar Jain
 
Presentation on visual basic 6 (vb6)
Presentation on visual basic 6 (vb6)Presentation on visual basic 6 (vb6)
Presentation on visual basic 6 (vb6)pbarasia
 
visual basic 6.0
visual basic 6.0visual basic 6.0
visual basic 6.0lesly53
 
visual basic for the beginner
visual basic for the beginnervisual basic for the beginner
visual basic for the beginnerSalim M
 
Visual Basic Codes And Screen Designs
Visual Basic Codes And Screen DesignsVisual Basic Codes And Screen Designs
Visual Basic Codes And Screen Designsprcastano
 
Pemrograman Komputer 2 (visual basic)
Pemrograman Komputer  2 (visual basic)Pemrograman Komputer  2 (visual basic)
Pemrograman Komputer 2 (visual basic)jayamartha
 
Presentasi pai semester 3 kel 4
Presentasi pai semester 3 kel 4Presentasi pai semester 3 kel 4
Presentasi pai semester 3 kel 4desinurlayla
 
Functions 1
Functions 1Functions 1
Functions 1Spy Seat
 
Creating the Timer on visual basic
Creating the Timer on visual basicCreating the Timer on visual basic
Creating the Timer on visual basicHayley Ip
 
toolbox and its properties in the visual basic
toolbox and its properties in the visual basictoolbox and its properties in the visual basic
toolbox and its properties in the visual basicadarsh-kaul
 
Visual basics Express Project
Visual basics Express ProjectVisual basics Express Project
Visual basics Express ProjectIftikhar Ahmed
 
Specification of a Visual Programming Language by Example
Specification of a Visual Programming Language by ExampleSpecification of a Visual Programming Language by Example
Specification of a Visual Programming Language by ExampleMaximilian Fellner
 
Visual basic coding
Visual basic codingVisual basic coding
Visual basic codingSara Corpuz
 

Destacado (20)

Visual Basic 6.0
Visual Basic 6.0Visual Basic 6.0
Visual Basic 6.0
 
Visual basic 6.0
Visual basic 6.0Visual basic 6.0
Visual basic 6.0
 
Visual Basic 6.0
Visual Basic 6.0Visual Basic 6.0
Visual Basic 6.0
 
Control Structures in Visual Basic
Control Structures in  Visual BasicControl Structures in  Visual Basic
Control Structures in Visual Basic
 
Presentation on visual basic 6 (vb6)
Presentation on visual basic 6 (vb6)Presentation on visual basic 6 (vb6)
Presentation on visual basic 6 (vb6)
 
visual basic 6.0
visual basic 6.0visual basic 6.0
visual basic 6.0
 
visual basic for the beginner
visual basic for the beginnervisual basic for the beginner
visual basic for the beginner
 
Visual Basic Codes And Screen Designs
Visual Basic Codes And Screen DesignsVisual Basic Codes And Screen Designs
Visual Basic Codes And Screen Designs
 
Hard ware
Hard wareHard ware
Hard ware
 
Pemrograman Komputer 2 (visual basic)
Pemrograman Komputer  2 (visual basic)Pemrograman Komputer  2 (visual basic)
Pemrograman Komputer 2 (visual basic)
 
Presentasi pai semester 3 kel 4
Presentasi pai semester 3 kel 4Presentasi pai semester 3 kel 4
Presentasi pai semester 3 kel 4
 
ملخص البرمجة المرئية - الوحدة الرابعة
ملخص البرمجة المرئية - الوحدة الرابعةملخص البرمجة المرئية - الوحدة الرابعة
ملخص البرمجة المرئية - الوحدة الرابعة
 
Functions 1
Functions 1Functions 1
Functions 1
 
Creating the Timer on visual basic
Creating the Timer on visual basicCreating the Timer on visual basic
Creating the Timer on visual basic
 
toolbox and its properties in the visual basic
toolbox and its properties in the visual basictoolbox and its properties in the visual basic
toolbox and its properties in the visual basic
 
Vb
VbVb
Vb
 
Visual basics Express Project
Visual basics Express ProjectVisual basics Express Project
Visual basics Express Project
 
Specification of a Visual Programming Language by Example
Specification of a Visual Programming Language by ExampleSpecification of a Visual Programming Language by Example
Specification of a Visual Programming Language by Example
 
Visual basic coding
Visual basic codingVisual basic coding
Visual basic coding
 
Visual basic 6
Visual basic 6Visual basic 6
Visual basic 6
 

Similar a Visual Basic 6.0

COM 211 PRESENTATION.pptx
COM 211 PRESENTATION.pptxCOM 211 PRESENTATION.pptx
COM 211 PRESENTATION.pptxAnasYunusa
 
Introduction To Csharp
Introduction To CsharpIntroduction To Csharp
Introduction To Csharpg_hemanth17
 
Introduction to-csharp-1229579367461426-1
Introduction to-csharp-1229579367461426-1Introduction to-csharp-1229579367461426-1
Introduction to-csharp-1229579367461426-1Sachin Singh
 
Introduction to CSharp
Introduction to CSharpIntroduction to CSharp
Introduction to CSharpMody Farouk
 
Introduction to csharp
Introduction to csharpIntroduction to csharp
Introduction to csharpRaga Vahini
 
Introduction to csharp
Introduction to csharpIntroduction to csharp
Introduction to csharpSatish Verma
 
Introduction to csharp
Introduction to csharpIntroduction to csharp
Introduction to csharpsinghadarsh
 
ADBMS ASSIGNMENT
ADBMS ASSIGNMENTADBMS ASSIGNMENT
ADBMS ASSIGNMENTLori Moore
 
Project: Call Center Management
Project: Call Center ManagementProject: Call Center Management
Project: Call Center Managementpritamkumar
 
Advisor Jumpstart: JavaScript
Advisor Jumpstart: JavaScriptAdvisor Jumpstart: JavaScript
Advisor Jumpstart: JavaScriptdominion
 
06 chapter03 04_control_logix_tags_memory_structure_fa16
06 chapter03 04_control_logix_tags_memory_structure_fa1606 chapter03 04_control_logix_tags_memory_structure_fa16
06 chapter03 04_control_logix_tags_memory_structure_fa16John Todora
 
Clean code _v2003
 Clean code _v2003 Clean code _v2003
Clean code _v2003R696
 

Similar a Visual Basic 6.0 (20)

COM 211 PRESENTATION.pptx
COM 211 PRESENTATION.pptxCOM 211 PRESENTATION.pptx
COM 211 PRESENTATION.pptx
 
PRELIM-Lesson-2.pdf
PRELIM-Lesson-2.pdfPRELIM-Lesson-2.pdf
PRELIM-Lesson-2.pdf
 
Introduction To Csharp
Introduction To CsharpIntroduction To Csharp
Introduction To Csharp
 
Introduction to-csharp-1229579367461426-1
Introduction to-csharp-1229579367461426-1Introduction to-csharp-1229579367461426-1
Introduction to-csharp-1229579367461426-1
 
Introduction to CSharp
Introduction to CSharpIntroduction to CSharp
Introduction to CSharp
 
Introduction to csharp
Introduction to csharpIntroduction to csharp
Introduction to csharp
 
Introduction to csharp
Introduction to csharpIntroduction to csharp
Introduction to csharp
 
Introduction to csharp
Introduction to csharpIntroduction to csharp
Introduction to csharp
 
ADBMS ASSIGNMENT
ADBMS ASSIGNMENTADBMS ASSIGNMENT
ADBMS ASSIGNMENT
 
CRUD with Dojo
CRUD with DojoCRUD with Dojo
CRUD with Dojo
 
Project: Call Center Management
Project: Call Center ManagementProject: Call Center Management
Project: Call Center Management
 
Advisor Jumpstart: JavaScript
Advisor Jumpstart: JavaScriptAdvisor Jumpstart: JavaScript
Advisor Jumpstart: JavaScript
 
Visualbasic tutorial
Visualbasic tutorialVisualbasic tutorial
Visualbasic tutorial
 
C Programming Unit-1
C Programming Unit-1C Programming Unit-1
C Programming Unit-1
 
06 chapter03 04_control_logix_tags_memory_structure_fa16
06 chapter03 04_control_logix_tags_memory_structure_fa1606 chapter03 04_control_logix_tags_memory_structure_fa16
06 chapter03 04_control_logix_tags_memory_structure_fa16
 
Chapter 2
Chapter 2Chapter 2
Chapter 2
 
Clean code _v2003
 Clean code _v2003 Clean code _v2003
Clean code _v2003
 
c++ referesher 1.pdf
c++ referesher 1.pdfc++ referesher 1.pdf
c++ referesher 1.pdf
 
CP 04.pptx
CP 04.pptxCP 04.pptx
CP 04.pptx
 
lecture 2.pptx
lecture 2.pptxlecture 2.pptx
lecture 2.pptx
 

Último

Unit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptxUnit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptxVishalSingh1417
 
How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17Celine George
 
Python Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxPython Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxRamakrishna Reddy Bijjam
 
Dyslexia AI Workshop for Slideshare.pptx
Dyslexia AI Workshop for Slideshare.pptxDyslexia AI Workshop for Slideshare.pptx
Dyslexia AI Workshop for Slideshare.pptxcallscotland1987
 
Sociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning ExhibitSociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning Exhibitjbellavia9
 
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...ZurliaSoop
 
Making communications land - Are they received and understood as intended? we...
Making communications land - Are they received and understood as intended? we...Making communications land - Are they received and understood as intended? we...
Making communications land - Are they received and understood as intended? we...Association for Project Management
 
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxBasic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxDenish Jangid
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfAdmir Softic
 
How to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POSHow to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POSCeline George
 
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptxMaritesTamaniVerdade
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdfQucHHunhnh
 
Application orientated numerical on hev.ppt
Application orientated numerical on hev.pptApplication orientated numerical on hev.ppt
Application orientated numerical on hev.pptRamjanShidvankar
 
Understanding Accommodations and Modifications
Understanding  Accommodations and ModificationsUnderstanding  Accommodations and Modifications
Understanding Accommodations and ModificationsMJDuyan
 
How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17Celine George
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsTechSoup
 
The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxheathfieldcps1
 
Single or Multiple melodic lines structure
Single or Multiple melodic lines structureSingle or Multiple melodic lines structure
Single or Multiple melodic lines structuredhanjurrannsibayan2
 
On National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsOn National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsMebane Rash
 

Último (20)

Unit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptxUnit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptx
 
How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17
 
Python Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxPython Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docx
 
Dyslexia AI Workshop for Slideshare.pptx
Dyslexia AI Workshop for Slideshare.pptxDyslexia AI Workshop for Slideshare.pptx
Dyslexia AI Workshop for Slideshare.pptx
 
Sociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning ExhibitSociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning Exhibit
 
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
 
Making communications land - Are they received and understood as intended? we...
Making communications land - Are they received and understood as intended? we...Making communications land - Are they received and understood as intended? we...
Making communications land - Are they received and understood as intended? we...
 
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxBasic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdf
 
How to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POSHow to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POS
 
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
 
Application orientated numerical on hev.ppt
Application orientated numerical on hev.pptApplication orientated numerical on hev.ppt
Application orientated numerical on hev.ppt
 
Understanding Accommodations and Modifications
Understanding  Accommodations and ModificationsUnderstanding  Accommodations and Modifications
Understanding Accommodations and Modifications
 
Spatium Project Simulation student brief
Spatium Project Simulation student briefSpatium Project Simulation student brief
Spatium Project Simulation student brief
 
How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The Basics
 
The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptx
 
Single or Multiple melodic lines structure
Single or Multiple melodic lines structureSingle or Multiple melodic lines structure
Single or Multiple melodic lines structure
 
On National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsOn National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan Fellows
 

Visual Basic 6.0

  • 1. Palitha Baddegama. Divisional Computer Resource Centre Hingurakgoda Visual basic 6.0
  • 2. Palitha Baddegama , Computer Resource Centre, Hingurakgoda Form Window Title bar Menu Bar Tool Bar Tool Box Code Window Project Window Property Window Layout Window (IDE) I ntegrated D evelopment E nvironment
  • 3. Palitha Baddegama , Computer Resource Centre, Hingurakgoda New Project Dialog Box
  • 4. Palitha Baddegama , Computer Resource Centre, Hingurakgoda
  • 5. Control Description Pointer Provides a way to move and resize the controls form PictureBox Displays icons/bitmaps and metafiles. It displays text or acts as a visual container for other controls. TextBox Used to display message and enter text. Frame Serves as a visual and functional container for controls CommandButton Used to carry out the specified action when the user chooses it. CheckBox Displays a True/False or Yes/No option. OptionButton Option Button control which is a part of an option group allows the user to select only one option even it displays multiple choices. ListBox Displays a list of items from which a user can select one. ComboBox Contains a Textbox and a List Box. This allows the user to select an item from the dropdown List Box, or to type in a selection in the Textbox.
  • 6. HScrollBar and VScrollBar These controls allow the user to select a value within the specified range of values Timer Executes the timer events at specified intervals of time DriveListBox Displays the valid disk drives and allows the user to select one of them. DirListBox Allows the user to select the directories and paths, which are displayed. FileListBox Displays a set of files from which a user can select the desired one. Shape Used to add shape (rectangle, square or circle) to a Form Line Used to draw straight line to the Form Image used to display images such as icons, bitmaps and metafiles. But less capability than the Picture Box Data Enables the use to connect to an existing database and display information from it. OLE Used to link or embed an object, display and manipulate data from other windows based applications. Label Displays a text that the user cannot modify or interact with.
  • 7. Palitha Baddegama , Computer Resource Centre, Hingurakgoda View Code View Object Toggle Folders Project Name Forms Folder Form & modules
  • 8.
  • 9.
  • 10.
  • 11. Visual Basic's 6 Most Common Programming Statements Statement type Examples Declarations - define the name, type and attributes of all program variables Dim Num as Integer ' declares a variable &quot;Num&quot; to be an Integer Dim vals(5) as Double ' declares an array of 5 Doubles named &quot;vals&quot; Assignment - set values for the variables Num = Num/10 ' after the assignment Num is set to 1/10th of its former value HiString = &quot;Hello &quot; + &quot;World&quot; ' value of HiString is set to &quot;Hello World&quot; Conditionals - do operations depending on the value of one or more variables if Num > 0 then Num = Num * 2 ' Basic logic building block Select Case .... End Case 'Case block simplifies GUI programming Iterations - control looping for repeated operations for i = 1 to 5 'For-loop counts through a precise number of steps while ( val(i) > val(imin) ) 'While loops as long as condition remains True Subroutines - calls on functions and subroutines Private Sub Form_Load() 'A subroutine does not return a value Private Function Digit() ' A function returns a value Special statements - used to implement unique features Set MyObject = Your Object 'Set statement assigns object references Print #FileNum, MyObject.Text 'I/O statements like Print, Input Line
  • 12. Palitha Baddegama , Computer Resource Centre, Hingurakgoda Arithmetic Operators Operator Mathematical function Example ^ Exponential 2^4=16 * Multiplication 4*3=12,   (5*6))2=60 / Division 12/4=3 Mod Modulus(return the remainder from an integer division) 15 Mod 4=3     255 mod 10=5 Integer Division(discards the decimal places) 19=4 + or & String concatenation &quot;Visual&quot;&&quot;Basic&quot;=&quot;Visual Basic&quot;
  • 13. Palitha Baddegama , Computer Resource Centre, Hingurakgoda Conditional Operators Operator Meaning = Equal to > More than < Less Than >= More than and equal <= Less than and equal <> Not Equal to
  • 14. Palitha Baddegama , Computer Resource Centre, Hingurakgoda Logical Operators Operator Meaning And Both sides must be true or One side or other must be true Xor One side or other must be true but not both Not Negates truth
  • 15.
  • 16.
  • 17. Palitha Baddegama , Computer Resource Centre, Hingurakgoda Numeric Data Types Type Storage  Range of Values Byte 1 byte 0 to 255 Integer 2 bytes -32,768 to 32,767 Long  4 bytes -2,147,483,648 to 2,147,483,648 Single 4 bytes -3.402823E+38 to -1.401298E-45 for negative values 1.401298E-45 to 3.402823E+38 for positive values. Double 8 bytes -1.79769313486232e+308 to -4.94065645841247E-324 for negative values 4.94065645841247E-324 to 1.79769313486232e+308 for positive values. Currency 8 bytes -922,337,203,685,477.5808 to 922,337,203,685,477.5807 Decimal 12 bytes +/- 79,228,162,514,264,337,593,543,950,335 if no decimal is use +/- 7.9228162514264337593543950335 (28 decimal places).
  • 18. Palitha Baddegama , Computer Resource Centre, Hingurakgoda   Nonnumeric Data Types   Data Type Storage Range String(fixed length) Length of string 1 to 65,400 characters String(variable length) Length + 10 bytes 0 to 2 billion characters Date 8 bytes January 1, 100 to December 31, 9999 Boolean 2 bytes True or False Object 4 bytes Any embedded object Variant(numeric) 16 bytes Any value as large as Double Variant(text) Length+22 bytes Same as variable-length string  
  • 19. Palitha Baddegama , Computer Resource Centre, Hingurakgoda There are three levels of scope: project-level (also called &quot;global&quot; or &quot;application&quot; scope; the variable is accessible to all procedures in all modules of the project) module-level (the variable is accessible to all procedures in the module in which it is declared) local-level (the variable is accessible only to the procedure in which it is declared) Variable Scope
  • 20. Variable Scope Palitha Baddegama , Computer Resource Centre, Hingurakgoda Form1 Form2 Dim Y as Integer Dim Z as Integer Sub procedure 1 () Dim A as Double . . . . End Sub Sub procedure 2 () Static B as Double . . . . End Sub Sub procedure 3 () Dim C as Double . . . . End Sub Module1 Public X as Integer
  • 21. Palitha Baddegama , Computer Resource Centre, Hingurakgoda MsgBox ( ) Function A=MsgBox(Prompt, Style Value , Title) Example: A =MsgBox( &quot;Click OK to Proceed&quot;, 1 , &quot;Startup Menu&quot;)             A =Msgbox(&quot;Click OK to Proceed&quot;. vbOkCancel ,&quot;Startup Menu&quot;)
  • 22. Palitha Baddegama , Computer Resource Centre, Hingurakgoda Style Values Button Layout Value Short Description vbOKonly 0 Displays the OK button. vbOKCancel 1 Displays the ok and cancel button. vbAbortRetryIgnore 2 Displays the Abort , Retry , Ignore vbYesNoCancel 3 Displays Yes , No and Cancel button vbYesNo 4 Displays the Yes / No button vbRetryCancel 5 Displays the retry and Cancel buttons
  • 23. Palitha Baddegama , Computer Resource Centre, Hingurakgoda Return Values and Command Buttons Value Named Constant Button Clicked  1 vbOk Ok button 2 vbCancel Cancel button 3 vbAbort Abort button 4 vbRetry Retry button 5 vbIgnore Ignore button 6 vbYes Yes button 7 vbNo No button
  • 24. Palitha Baddegama , Computer Resource Centre, Hingurakgoda testmsg = MsgBox(&quot;Click to test&quot;, 1, &quot;Test message&quot;) testMsg2 = MsgBox(&quot;Click to Test&quot;, vbYesNoCancel + vbExclamation, &quot;Test Message&quot;)
  • 25. Palitha Baddegama , Computer Resource Centre, Hingurakgoda The Icons displayed in the message box are here Value Named Constant Icon  16 vbCritical 32 vbQuestion 48 vbExclamation 64 vbInformation
  • 26. Palitha Baddegama , Computer Resource Centre, Hingurakgoda InputBox( ) Function A=InputBox(Prompt, Title, default_text, x-position, y-position) B= InputBox(&quot;What is your message?&quot;, &quot;Message Entry Form&quot;, &quot;Enter your message here&quot;, 500, 700)
  • 27.
  • 28.
  • 29. Palitha Baddegama , Computer Resource Centre, Hingurakgoda Date format Format Syntax Result Format(Now,&quot; m/d/yy&quot; ) 10/02/09 Format(Now,&quot; dddd,mmmm,dd,yyyy &quot;) Friday,October 02, 2009 Format(Now,&quot; d-mmm &quot;) 02-Oct Format(Now,&quot; mmmm-yyyy &quot;) October -2009 Format(Now,&quot; hh:mm AM/PM&quot;) 09:36 AM Format(Now,&quot; h:mm:ss a/p&quot;) 09:40 a Format(Now,&quot; d-mmmm h:mm &quot;) 20-October 09:41
  • 30. Palitha Baddegama , Computer Resource Centre, Hingurakgoda Number format Number = 456.6768 Format Syntax Result Format(Number,&quot;# # # #.# #&quot;) 456.68 Format(Number,&quot;.# #&quot;) 456.68 Format(Number,&quot;0000.00&quot;) 0456.68 Format(Number,&quot;000000.00000&quot;) 000456.67680 Format(Number,&quot;# # # # #.# # # # #&quot;) 456.6768 Format(Number,&quot;# # # # #.0000&quot;) 456.6768
  • 31.
  • 32.
  • 33. IF Then Palitha Baddegama , Computer Resource Centre, Hingurakgoda Condition Statement1 True False
  • 34. IF Then – End IF Palitha Baddegama , Computer Resource Centre, Hingurakgoda Condition Statement 1 Statement 2 Statement 3 Statement 4 …………… .. Statement n True False
  • 35. IF Then Else – End IF Palitha Baddegama , Computer Resource Centre, Hingurakgoda Condition True False Statement 1 Statement 2 Statement 3 Statement 4 …………… .. Statement n Statement 1 Statement 2 Statement 3 Statement 4 …………… .. Statement n
  • 36. Palitha Baddegama , Computer Resource Centre, Hingurakgoda Statement 1 Statement 2 Statement 3 …………… .. Statement n A Statement 1 Statement 2 Statement 3 …………… .. Statement n B Statement 1 Statement 2 Statement 3 …………… .. Statement n C IF <Condition> Then Else End IF
  • 37. IF Then Else IF Palitha Baddegama , Computer Resource Centre, Hingurakgoda Condition True False Statement 1 Statement 2 Statement 3 …………… .. Statement n Statement 1 Statement 2 Statement 3 …………… .. Statement n Condition False Statement 1 Statement 2 Statement 3 …………… .. Statement n Statement 1 Statement 2 Statement 3 …………… .. Statement n True
  • 38. Palitha Baddegama , Computer Resource Centre, Hingurakgoda Statement 1 Statement 2 …………… .. Statement n A Statement 1 Statement 2 …………… .. Statement n B Statement 1 Statement 2 …………… .. Statement n C IF <Condition> Then Else End IF Statement 1 Statement 2 …………… .. Statement n D ElseIF <Condition> Then
  • 39. Nested Loop Palitha Baddegama , Computer Resource Centre, Hingurakgoda Condition True False Statement 1 Statement 2 Statement 3 …………… .. Statement n Statement 1 Statement 2 Statement 3 …………… .. Statement n Condition False Statement 1 Statement 2 Statement 3 …………… .. Statement n Statement 1 Statement 2 Statement 3 …………… .. Statement n True
  • 40. Palitha Baddegama , Computer Resource Centre, Hingurakgoda Statement 1 Statement 2 …………… .. Statement n A IF <Condition 2> Then Statement 1 Statement 2 …………… .. Statement m Else Statement 1 Statement 2 …………… .. Statement p B C IF <Condition 1> Then End IF Statement 1 Statement 2 …………… .. Statement q D Else
  • 41.
  • 42.
  • 43. While -Wend Palitha Baddegama , Computer Resource Centre, Hingurakgoda Condition Statement 1 Statement 2 Statement 3 ……………… Statement n True False While Condition Statement 1 Statement 2 …………… .. Statement m Wend
  • 44. Do While - Loop Palitha Baddegama , Computer Resource Centre, Hingurakgoda Condition Statement 1 Statement 2 Statement 3 ……………… Statement n True False Do While Condition Statement 1 Statement 2 …………… .. Statement m Loop
  • 45. Do – Loop While Palitha Baddegama , Computer Resource Centre, Hingurakgoda Condition Statement 1 Statement 2 Statement 3 ……………… Statement n True False Do Statement 1 Statement 2 …………… .. Statement m Loop While Condition
  • 46. Do Until - Loop Palitha Baddegama , Computer Resource Centre, Hingurakgoda Condition Statement 1 Statement 2 Statement 3 ……………… Statement n True False Do Until Condition Statement 1 Statement 2 …………… .. Statement m Loop
  • 47. Do – Loop Until Palitha Baddegama , Computer Resource Centre, Hingurakgoda Condition Statement 1 Statement 2 Statement 3 ……………… Statement n True False Do Statement 1 Statement 2 …………… .. Statement m Loop Until Condition
  • 48. For Next Palitha Baddegama , Computer Resource Centre, Hingurakgoda For counter = start To end [  Step ] [ statements 1 ] [ statements 2 ] [ statements 2 ] Next [  counter  ] counter Required in the For statement. Numeric variable. The control variable for the loop. start Required. Numeric expression. The initial value of counter . end Required. Numeric expression. The final value of counter. step Optional. Numeric expression. The amount by which counter is incremented each time through the loop. statements Optional. One or more statements between For and Next that run the specified number of times. Next Required. Terminates the definition of the For loop.
  • 49. Palitha Baddegama , Computer Resource Centre, Hingurakgoda For i = 1 To 7 Print “Visual Basic” Next i i = 1 Visual Basic i = 2 Visual Basic i = 3 Visual Basic i = 4 Visual Basic i = 5 Visual Basic i = 6 Visual Basic i = 7 Visual Basic For - for loop  i - use i as our integer 1 - start value = 1  To - between start and stop value 7 - stop value = 7 Next - go to next step (if i > 7 then end for loop)
  • 50. Palitha Baddegama , Computer Resource Centre, Hingurakgoda For i = 0 To 9 Print i Next i i= 0 i= 1 i= 2 i= 3 i= 4 i= 5 i= 6 i= 7 i= 8 i= 9
  • 51. Palitha Baddegama , Computer Resource Centre, Hingurakgoda Private Sub Command1_Click() Dim i As Integer Dim j As Integer For i = 1 To 5 For j = 1 To 7 Print i Next j Next i End Sub Inner Loop Outer Loop ; 1 2 3 4 5 14 21 7 28 35
  • 52. Palitha Baddegama , Computer Resource Centre, Hingurakgoda Private Sub Command1_Click() Dim i As Integer Dim j As Integer For i = 1 To 5 For j = 1 To 7 Print j ; Next j Print Next i End Sub Inner Loop Outer Loop i=1 j=1 j=2 j=3 j=4 j=5 j=6 j=7 i=2 j=1 j=2 j=3 j=4 j=5 j=6 j=7 i=3 j=1 j=2 j=3 j=4 j=5 j=6 j=7 i=4 j=1 j=2 j=3 j=4 j=5 j=6 j=7 i=5 j=1 j=2 j=3 j=4 j=5 j=6 j=7
  • 53. Palitha Baddegama , Computer Resource Centre, Hingurakgoda Private Sub Command1_Click() Dim i As Integer Dim j As Integer For i = 1 To 5 For j = 1 To 7 Print i ; Next j Print Next i End Sub Inner Loop Outer Loop i=1 j=1 i =1 j=2 i =1 j=3 i =1 j=4 i =1 j=5 i =1 j=6 i =1 j=7 i =1 i=2 j=1 i =2 j=2 i =2 j=3 i =2 j=4 i =2 j=5 i =2 j=6 i =2 j=7 i =2 i=3 j=1 i =3 j=2 i =3 j=3 i =3 j=4 i =3 j=5 i =3 j=6 i =3 j=7 i =3 i=4 j=1 i =4 j=2 i =4 j=3 i =4 j=4 i =4 j=5 i =4 j=6 i =4 j=7 i =4 i=5 j=1 i =5 j=2 i =5 j=3 i =5 j=4 i =5 j=5 i =5 j=6 i =5 j=7 i =5
  • 54. Palitha Baddegama , Computer Resource Centre, Hingurakgoda For i = 1 To 10 For j = 1 To 10 Print j ; Next j Print Next i For i = 1 To 10 For j = 1 To 10 Print i ; Next j Print Next i For i = 1 To 10 For j = 1 To i Print i ; Next j Print Next i For i = 1 To 10 For j = 1 To i Print j ; Next j Print Next i For i = 1 To 10 For j = i To 10 Print j ; Next j Print Next i For i = 1 To 10 For j = i To 10 Print i ; Next j Print Next i
  • 55. Palitha Baddegama , Computer Resource Centre, Hingurakgoda Working with Menus in VB6