Nested IF

This is the basic Code for Nested IF Structure in vb6

Dim Adrian, Panoy As Integer

Adrian = Val(Text1.Text)'holds the value of text1
Panoy = Val(Text2.Text)'holds the value of text2

    If Adrian = 100 Then ' if  Adrian=100 then it will  to the next if

        If Panoy = 100 Then 'if Panoy=100 then msgbox Prompt

            MsgBox "You Got it"

        End If

    End If
           
End Sub

Happy Coding
Continue Reading with Borgy's Blog »
These icons link to social bookmarking sites where readers can share and discover new web pages.
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Google
  • Furl
  • Reddit
  • Spurl
  • StumbleUpon
  • Technorati

Do Loop Until

This the Basic code of Do Loop Until in Vb6

Private Sub Command1_Click()

Dim Adrian As Integer 'holds the Value of 1 to 10

    Adrian = 1'set the value to 1

    Do

        Print Adrian ' print the value

            Adrian = Adrian + 1 ' increment by 1 from original value

    Loop Until Adrian = 10 'end after Adrian=10
   
'this will print the numbers 1-9

End Sub

Happy Coding
Continue Reading with Borgy's Blog »
These icons link to social bookmarking sites where readers can share and discover new web pages.
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Google
  • Furl
  • Reddit
  • Spurl
  • StumbleUpon
  • Technorati

Do While Loop Structure

this is the basic code of Do While Loop Structure in VB6
this structure is similar to Do Loop While Structure

Private Sub Command1_Click()

Dim co As Integer

        co = 1'set co to 1

              Do While co <= 10

                   Print co 'print the value of co
                   co = co + 1'increment by 1

              Loop
   
End Sub

Happy Coding
Continue Reading with Borgy's Blog »
These icons link to social bookmarking sites where readers can share and discover new web pages.
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Google
  • Furl
  • Reddit
  • Spurl
  • StumbleUpon
  • Technorati

Do Loop While Structure

This is the Basic way on how to do the coding of Do Loop While Structure in VB6

this condition will print vertically 1 through 10

Private Sub Command1_Click()
   Dim co As Integer

      co = 1 'set the value of co to 1

            Do

                 Print co 'print the value of co
                 
                          co = co + 1 'co increment by 1

            Loop While co <= 10'exit if <=10
    
End Sub

Happy Coding
Continue Reading with Borgy's Blog »
These icons link to social bookmarking sites where readers can share and discover new web pages.
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Google
  • Furl
  • Reddit
  • Spurl
  • StumbleUpon
  • Technorati

Select Case Structure

this is the basic code of Selection Structure

Dim Adrian as Integer
Adrian=Text1.Text

Select Case Adrian

   Case Val(Adrian) > 100 
        MsgBox"You Enter Greater than 100"
   Case Else
       MsgBox"You Enter less than 100"

End Select

Happy Coding
Continue Reading with Borgy's Blog »
These icons link to social bookmarking sites where readers can share and discover new web pages.
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Google
  • Furl
  • Reddit
  • Spurl
  • StumbleUpon
  • Technorati

IF Then Else Selection Structure in Vb6

A selection structure is used yo choose among alternative courses of action or instruction.
Like for Example the if the Required Number is greater than 50,so we can coded it like
this:

If NumberOfPeople >50 then
  MsgBox"You Meet the Number of People"
   Else
   MsgBox"Sorry!,You Did Not Meet the Number of People"
End If

the  pseudo-code of this is

If the number of people is greater than 50
    display that you meet the number of people
Else
    display that you did not meet the number of people
End If

Happy Coding
Continue Reading with Borgy's Blog »
These icons link to social bookmarking sites where readers can share and discover new web pages.
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Google
  • Furl
  • Reddit
  • Spurl
  • StumbleUpon
  • Technorati

Copyright @ Codes-47.Blogspot.Com. Powered by Blogger.