Showing posts with label Visual Basic. Show all posts
Showing posts with label Visual Basic. Show all posts

Friday, August 18, 2023

Visual Basics part - 2

 

17.Font Dialog box

 

Label 3 CSC

Private sub check1_click()

If check1.value=1 then

Label3.fontstrikethru=true

Else

Label3.fontstrikethru=false

Endif

End sub

 

Private sub check2_click()

If check2.value=1 then

Label3.fontunderline=true

Else

Label3.fontunderline=false

Endif

End sub

 

Private sub command1_click()

End

End sub

Private sub form_load()

Me.windowstate=2

List1.additem(8)

List1.additem(10)

List1.additem(12)

List1.additem(18)

List1.additem(20)

End sub

 

Private sub list1_click()

Text2=list1.list(list1.listindex)

Label3.fontsize=list1.list(list1.listindex)

End sub

 

Private sub regular_click()

Label3.fontbold=false

Label3.fontitalic=false

Label3.fontunderline=false

Label3.fontstrikethru=false

Text2=”regular”

End sub

 

Private sub bold_click()

Label3.fontbold=true

Label3.fontitalic=false

Label3.fontunderline=false

Text2=”bold”

Label3.fontstrikethru=false

End sub

 

Private sub italic_click()

Label3.fontbold=false

Label3.fontitalic=true

Text2=”italic”

End sub

 

Private sub bolditalic_click()

Label3.fontbold=true

Label3.fontitalic=true

Text2=”bolditalic”

End sub

 

18.Monthly sales details flex grid control

 

Codings

Dim arr(11) as string

Dim item(5) as string

Dim I as integer

 

Private sub combo2_lostfocus()

Text1.text=” “

End sub

 

Private sub form_load()

Me.WindowState = 2

item(0) = "stationaries"

item(1) = "groceries"

item(2) = "household"

item(3) = "toys"

item(4) = "comfectionaries"

item(5) = "milk products"

arr(0) = "jan"

arr(1) = "feb"

arr(2) = "mar"

arr(3) = "apr"

arr(4) = "may"

arr(5) = "june"

arr(6) = "july"

arr(7) = "aug"

arr(8) = "sep"

arr(9) = "oct"

arr(10) = "nov"

arr(11) = "dec"

flex1.Row = 0

For i = 0 To 11

flex1.Col = 0

flex1.Text = arr(i)

Next

flex1.Col = 0

For i = 0 To 5

flex1.Row = i + 1

flex1.Text = item(i)

Next

 

End Sub

End sub

 

Private sub command1_click()

End

End sub

 

Private sub text1_lostfocus()

Dim j as integer

For i=0 to combo1.listindex

For j=0 to combo2.listindex

If combo1.selstart=I and combo2.selstart=j then

Flex1.row=combo1.listindex+1

Flex1.col=combo2.listindex+1

Flex1.text=text1.text

End if

Next

Next

End sub

 

19.MS FlexGrid control

 

Codings

Dim n,i  as integer

Private Sub Form_Load()

Dim colcounter, rowcounter

n = InputBox("Enter table value", "table")

MSFlexGrid1.TextMatrix(0, 0) = "*"

For i = 1 To n

For j = 1 To n

MSFlexGrid1.TextMatrix(0, j) = j

MSFlexGrid1.TextMatrix(j, i) = j & " * " & i & " = " & i * j

Next j

MSFlexGrid1.TextMatrix(i, 0) = i

Next i

End sub

20.Picture box and image box

 

Codings:

Option explicit

Dim file as string

Dim a

 

Private sub command1_click()

Commondialog1.showopen

A=commondialog1.filename

File=right(a,3)

If file=”jpg” or file=”bmp” or file=”gif” then

Picture1.picture=loadpicture(commondialog1.filename)

Else

Msgbox(“open only picture files”)

End if                          

 End sub

 

Private sub command2_click()

Image1.picture=picture1.picture     

End sub

21.Matrix Addition

 

Codings

Option explicit

Dim I,j

 

Private sub command2_click()

List1.clear

List2.clear

List3.clear

End sub

Private sub command1_click()

Dim a (3,3),b(3,3),c(3,3) as integer

For i=1 to 3

For j=1 to 3

A(i,j)=val(inputbox(“Enter A”))

Next j

Next i

For i=1 to 3

For j=1 to 3

B(i,j)=val(inputbox(“Enter B”))

Next j

Next i

For i=1 to 3

For j=1 to 3

C(i,j)=a(I,j)+b(I,j)

Next j

Next i

For i=1 to 3

List1.add item(c(i,1))

Next

For i=1 to 3

List2.additem(c(i,2))

Next

For i=1 to 3

List3.additem(c(i,3))

Next

End sub

 

 

22.EYE Animation

 

private sub Timer1_timer()

If line1.visible=true then

Line2.visible=true

Line1.visible=false

Line2.visible=false

Shape1.visible=true

Shape2.visible=true

Elseif  shape1.visible=true then

Shape2.visible=true

Shape1.visible=false

Shape2.visible=false

Line1.visible=true

Line2.visible=true

End if

 

23.String function

 

Private sub asciivalue_click()

Dim a,s as variant

A=inputbox(“enter any string”)

S=asc(a)

Print”The ascii value is=”&s

End sub

Private sub charr_click()

Dim a,s as variant

A=inputbox(“Enter any number”)

S=chr(a)

Print”The character is =”&s

End sub

 

Private sub end_click()

End

End sub

Private sub instring_click()

Dim a,s,s1 as variant

A=inputbox(“Enter the string”)

S=inputbox(“Enter any substring to identity”)

S1=instr(a,s)

Print”The string is placed at=”&s1

End sub

Private lset_click()

Dim a as string

A=string(20,20)

Print a

Lset a=”welcome”

Print a

End sub

Private sub left_click()

Dim a,s,s1 as variant

A=inputbox(“Enter the string”)

S=inputbox(“Enter any number”)

S1=left(a,s)

Print”The leftside string is=”&s1

End sub

Private sub ltrimm_click()

Dim a,s as variant

A=inputbox(“Enter any string space on left hand side”)

S=ltrim(a)

Print”The Actual string is=”&a

Print “The ltrim string is =”&s

End sub

 

Private sub length_click()

Dim a,s as variant

A=inputbox(“Enter any string”)

S=len(a)

Print “The length of the string is =”&s

End sub

 

Private sub lower_click()

Dim a,s as variant

A=inputbox(“Enter any string in uppercase”)

S=Lcase(a)

Print”The lowercase of the string is =”&s

End sub

 

Private sub middle_click()

Dim a,s,s1 as variant

A=inputbox(“Enter any string”)

S=inputbox(“Enter any number”)

S1=mid(a,s)

Print”The mid string is =”&s1

End sub

 

Private sub rsett_click()

Dim a as string

A=string(20,10)

Print a

Rset a=”welcome”

Print a

End sub

 

Private sub rightt_click()

Dim a,s,s1 as variant

A=inputbox(“Enter any string”)

S=inputbox(“Enter any number”)

S1=right(a,s)

Print”The right string is =”&s1

End sub

 

Private sub rtrimm_click()

Dim a,s as variant

A=inputbox(“Enter any string with space on right hand side”)

S=rtrim(a)

Print”The actual string is =”&a

Print”The rtrim string is =”&s

End sub

Private sub upper_click()

Dim a,s as variant

A=inputbox(“Enter any name in lowercase”)

S=ucase(a)

Print”The uppercase is=”&s

End sub

Private sub space_click()

Dim a as string *20

A=”welcome”

Print instr(a,” ”)

A=space(10)

Print len(a)

Print instr(a,” ”)

Print a & “Our college”

End sub

 

Private sub strcompare_click()

Dim a,s, comp As variant

A=inputbox(“Enter the first string”)

S=inputbox(“Enter the second string”)

Comp=strcomp(a,s,vbbinarycompare)

If comp=0 then

Print”The strings are same”

Else

Print”The strings are not same”

End if

End sub

Private sub stringg_click()

 

Dim a,s,s1 as variant

A=inputbox(“Enter any symbol”)

S=inputbox(“Enter how many time display”)

S1=string(s,a)

Print”The string=”&s1

End sub

 

Private sub trimm_click()

Dim a,s as variant

A=inputbox(“Enter any string with double side space”)

S=trim(a)

Print”The actual string is =”&a

Print”The trim string is=”&s

End sub

 

24.Image list

 

 

Dim a

 

Private Sub Command1_Click()

If Timer2.Enabled = True Then

  Timer2.Enabled = False

  ElseIf Timer2.Enabled = False Then

  Timer2.Enabled = True

End If

 End Sub

 

Private Sub Timer2_Timer()

a=a+1

if a <=imagelist1.listimages.count then

 image3.picture=imagelist1.listimages(a).picture

else

a=0

end if                                                

 

End Sub     

                                                         

25.MDI form creation

Step 1:

 

Menubar->project->add mdi form

Step 2:

Form1->name->myform

                Caption->myform

                Mdi child->true

Step 3:

        Menu editor

        Caption                           name

        File                                  mfile

       

           New                             mnew

           Exit                              mexit

 

Window                                  mwindow

 

Cascade                                   mcascade

Tile &horizontal                     mhorizontal

Tile &vertical                         mvertical

Arrange & icons                     micons

Codings:

Mdi form:

Option explicit

Dim I as integer

Private sub mdiform_load()

I=0

End sub

Private sub mcascade_click()

Mdiform1.arrange vbcascade

End sub

Private sub mhorizontal_click()

Mdiform1.arrange vbtilehorizontal

End sub

Private sub mvertical_click()

Mdiform1.arrange vbtilevertical

End sub

Private sub micons_click()

Mdiform1.arrange vbarrangeicons

End sub

Private sub mnew_click()

Dim myformd as new myform

I=i+1

Myformd.caption=myformd.caption &i

Myformd.show

End sub

 

Visual Basics Part - 1

 

VB Programs

 

Content

1.Arithmetic calculation

2.Control structure

3.Colour palatee

4.Mouse down Event

5.Serial ball moving

6.Image Resize

7.Picture Animation with timer control

8.clock animation using timer

9.Simple and compound interest calculation

10.Fibonacii serial

11.Timer

12.Picture animation

13.DAO Control

14.ADO Control

15.Sub procedure

16. Number puzzle

17.Font Dialog box

18.Monthly sales details flex grid control

19.MS FlexGrid control

20.Picture box and image box

21.Matrix Addition

22.String function 
23.EYE Animation

 

 1.Arithmetic calculation

First Value

Second Value

Text 1

Text2

Text 3

 

Text4

 

Text5

 

Text6

 

Command 1

Command 2

 

Command 3

 

Command 4

 

Coding

Private sub command 1_click()

Text3.text=val(text1.text)+val(text2.text)

End sub

Private sub command 2_click()

Text4.text=val(text1.text)-val(text2.text)

End sub

 

Private sub command 3_click()

Text5.text=val(text1.text)*val(text2.text)

End sub

 

Private sub command 4_click()

Text6.text=val(text1.text)/val(text2.text)

End sub

 

2.       Control structure

          1.If –then  statement

          2.If-then-else statement

          3.IF-Then else if statement

          4.Select case statement

1.IF

 

Private sub form_click()

Dim n as integer

 N=inputbox(“Enter any value”)

If(n>10)then

Msgbox”The ans is =”&n

Endif

Endsub

 

2.If-else

Private sub form_click()

Dim a,b as integer

A=inputbox(“Enter A value”)

B=inputbox(“Enter b value”)

If (a>b) then

Msgbox”A is big”&a

Else

Msgbox”B is big”&b

Endif

End sub

 

3.if else if

Private sub form1_click()

Dim a,b,c as integer

A=inputbox(“Enter a value”)

B=inputbox(“Enter b value”)

C=inputbox(“Enter c value”)

If (a>b)  and(a>c) then

Msgbox “A is big”&a

ElseIf(b>c) then

Msgbox”B is big”&b

Else

Msgbox”c is big”&c

Endif

End sub

 

4.Select Case

Private sub form1_click()

dim n as integer

n=inputbox(“enter the value”)

select case(n)

case 1

msgbox”ONE”

case 2

msgbox”TWO”

case 3

msgbox”THREE”

case else

msgbox”give 1 to 3”

End select

End sub

 

5. Multiplication table

 

Private sub form_click()

dim a,i,s,b as integer

s=1

a=inputbox(“enter the table number”)

b=inputbox(“enter the table limited”)

for s=1 to b

i=s*a

print s;”*”;a;”=”;i

next s

End sub

 3.Colour palatee

 Private sub command1_click()

End

End sub

Private sub form_load()

Hscroll1.max=255

Hscroll1.min=0

Hscroll2.min=0

Hscroll2.max=255

Hscroll3.min=0

Hscroll3.max=255

End sub

 

Private sub HSCROLL1_Change()

Text1.backcolor=RGB(Hscroll1.value,Hscroll2.value,Hscroll3.value)

End sub

Private sub HSCROLL2_Change()

Text1.backcolor=RGB(Hscroll1.value,Hscroll2.value,Hscroll3.value)

End sub

Private sub HSCROLL3_Change()

Text1.backcolor=RGB(Hscroll1.value,Hscroll2.value,Hscroll3.value)

End sub


4.Mouse down Event

 

 

Private sub form_mousedown(Button as integer,shift as integer,x as single, y as single)

Circle (x,y),500,RGB(Rnd*255,Rnd*255,Rnd*255)

End sub

5.Serial ball moving

Private sub command1_click()

End

End sub

Private sub form_load()

Me.windowstate=2

Shape2. visible=false

Shape4.visible=false

Shape6.visible=false

End sub

 

Private sub Timer1_timer()

If shape1.visible=true then

Shape3.visible=true

Shape5.visible=true

Shape1.visible=false

Shape3.visible=false

Shape5.visible=false

Shape2.visible=true

Shape4.visible=true

Shape6.visible=true

Elseif shape2.visible=true then

Shape4.visible=true

Shape6.visible=true

                                 

Shape2.visible=false

Shape4.visible=false

Shape6.visible=false

 

Shape1.visible=true

Shape3.visible=true

Shape5.visible=true

End if

End sub


6.Image Resize

Private sub command1_click()

Me.backcolor=RGB(Hscroll1.value,Rnd*255,Rnd*255)

End sub

 

Private sub command2_click()

Unload me

End sub

Private sub form_load()

Me.windowstate=2

Image1.stretch=true

End sub

Private sub hscroll1_change()

Image1.width=hscroll1.value

Hscroll1.largechange=300

Hscroll1.smallchange=50

Hscroll1.max=2300

Hscroll1.min=100

End sub

 

Private sub vscroll1_change()

Vscroll1.largechange=300

Vscroll1.smallchange=50

Vscroll1.max=2500

Vscroll1.min=300

Image1.height=vscroll1.value

End sub

 

7.Picture Animation with timer control

Timer

 


Private sub form_load()

Timer1.interval=1000

End sub

 Private sub timer1_timer()

Set p=picture1.picture

Picture1.picture=picture2.picture

Picture2.picture=picture3.picture

Picture3.picture=picture4.picture

Picture4.picture=p

End sub

 

8.clock animation using timer

 

 

Private sub form_load()

Me.windowstate=2

Line2.visible=false

Line3.visible=false

Line4.visible=false

Line5.visible=false

Line6.visible=false

Line7.visible=false

Line8.visible=false

Line9.visible=false

Line10.visible=false

Line11.visible=false

Line12.visible=false

End sub

 

Private Sub Timer1_timer()

If line1.visible=true then

Line1.visible=false

Line2.visible=true

 

Elseif line2.visible=true then

Line2.visible=false

Line3.visible=true

 

Elseif line3.visible=true then

Line3.visible=false

Line4.visible=true

 

Elseif line4.visible=true then

Line4.visible=false

Line5.visible=true

 

Elseif line5.visible=true then

Line5.visible=false

Line6.visible=true

 

Elseif line6.visible=true then

Line6.visible=false

Line7.visible=true

 

Elseif line7.visible=true then

Line7.visible=false

Line8.visible=true

Elseif line8.visible=true then

Line8.visible=false

Line9.visible=true

 

Elseif line9.visible=true then

Line9.visible=false

Line10.visible=true

 

Elseif line10.visible=true then

Line10.visible=false

Line11.visible=true

 

Elseif line11.visible=true then

Line11.visible=false

Line12.visible=true

 

Elseif line12.visible=true then

Line12.visible=false

Line1.visible=true

End if

End sub

 

9.Simple and compound interest calculation

 

Dim p as integer

Dim n as double

Dim r as variant

Dim si,ci As variant

Private sub command1_click()

P=val(text1.text)

N=val(text2.text)

R=val(text3.text)

Si=(p*n*r)/100

Msgbox “The simple interest=”&si

End sub

Private sub command2_click()

P=val(text1.text)

N=val(text2.text)

R=val(text3.text)

Ci=((p*1+r/100)^n-p)

Msgbox”The compound interest=”&ci

End sub

 

10.Fibonacii serial

Private sub form_click()

A=-1

B=1

V=val(text1+text2)

For i=0 to 10

C=a+b

Print c

A=b

B=c

Next i

End sub

 

 

11.Timer

 

Private sub form_load()

Me.windowstate=2

Shape2.visible=false

Shape4.visible=false

End sub

 

Private sub timer1()

If shape1.visible=true then

Shape3.visible=true

Shape1.visible=false

Shape3.visible=false

Shape2.visible=true

Shape4.visible=true

Elseif shape2.visible=true then

Shape4.visible=true

Shape2.visible=false

Shape4.visible=false

Shape1.visible=true

Shape3.visible=true

End if

End sub

 

12.Picture animation

 

Private sub command1_click()

Picture1.width=picture1.width+100

Picture1.height=picture1.height+100

End sub

 

 Private sub command2_click()

Picture1.width=picture1.width-100

Picture1.height=picture1.height-100

End sub

 

Private sub command3_click()

Picture1.top=picture1.top-100

End sub

 

Private sub command4_click()

Picture1.top=picture1.top+100

End sub

 

Private sub command5_click()

Picture1.left=picture1.left+100

End sub

 

Private sub command6_click()

Picture1.left=picture1.left-100

End sub

 

 13.DAO Control

ODBC-Open database connectivity

DAO-Data Access objects

 

 

C1-MOVEFIRST

C2-MOVEPREVIOUS

C3-MOVE END NEXT

C4-MOVE LAST

C5-ADD

C6-DELETE

C7-UPDATE

Database connectivity

Step 1

Menubar

Add ins

 


Click-Visual data manager

   

New –microsoft Access->Version 7.0 MDB

 


File name CSCDB->Save

 


Properties ->Right click-> New table

 


Table name:CSCTABLE->ADD FIELD

 


Name  : student name    type: text

Place   : splace      type:text

 


Close

 


Click-> Build the Table

 


Table name->CSCTABLE->Right click->Open

 


Add->Student name   :XXXX

          Splace               :YYYY

         

Update->Add->close

Step-II

Data contral->Right click->Properties

 


Database Name  :CSCDB->Record source  : CSCTABLE

Step-III

Text1->Data source : data1->data field : Student name

Text2->Data source : data1->data field :splace

Coadings

Private sub command5_click()

Data1.Recordset.Addnew

End sub

Private sub command6_click()

Data1.Recordset.delete

Msgbox”Record delete”

Data1.Recordset.movenext

If data1.Recordset.EOF=true then

Data1.Recordset.moveprevious

End If

End sub

 

Private sub command3_click()

Data1.recordset.movefirst

Msgbox(“This is the first Record”)

End sub

 

Private  sub command4_click()

Data1.Recordset.movelast

Msgbox(“This is the last Record”)

End sub

 

Private sub command2_click()

On Error Resume next

If(Data1.Recordset.EOF) then

Msgbox(“No more Records”)

Else

Data1.Recordset.movenext

End if

End sub

 

Private sub command1_click()

On Error Resume next

If(data1.Recordset.BOF) then

Msgbox(“No previous Record”)

Else

Data1.Recordset.moveprevious

End if

End sub

 

Private sub command7_click()

Data1.UpdateRecord

Msgbox(“Record updated”)

End sub

 

14.ADO Control

 

Project-> components->microsoft ADO  Data control 6.0 (OLEDB)

Connectivity steps

Step 1

Menubar

Add ins

 


Click-Visual data manager

   

New –microsoft Access->Version 7.0 MDB

 


File name CSCDB->Save

 


Properties ->Right click-> New table

 


Table name:CSCTABLE->ADD FIELD

 


Name  : student name    type: text

Place   : splace      type:text

 


Close

 


Click-> Build the Table

 


Table name->CSCTABLE->Right click->Open

 


Add->Student name   :XXXX

          Splace               :YYYY

         

Update->Add->close

Step 2

 

Adodc1->Right click->ADODC properties

 


Property pages->Use connecting string->Build

 


Data link properties-> Microsoft jet 4.0 OLEDB provider->next

 


Select or Enter a database name:CSCDB

Test connection->ok->ok

 


Proper pages->Record source->command type : 2-adcmdtable

                                      Table or stored produre Name:CSCTABLE

 

 


Apply->ok

Step-III

text 1->Datasource:Adodc1->Data Filed : name

text2->Datasource:Adodc1->Data Field:place

 

Program coadings:-

Private sub command5_click()

Adodc1.Recordset.Addnew

End sub

 

Private sub command6_click()

Adodc1.Recordset.delete

Msgbox”Record deleted”

Adodc1.Recordset.movenext

If Adodc1.Recordset.EOF= true then

Adodc1.Recordset.moveprevious

End if

End Sub

 

Private sub command3_click()

Adodc1.Recordset.movefirst

Msgbox”This is the first record”

End sub

 

Private sub command4_click()

Adodc1.Recordset.movelast

Msgbox”This is last Record”

End sub

 

Private sub command2_click()

On Error Resume next

If (Adodc1.Recordset.EOF) then

Msgbox(“No more Records”)

Else

Adodc1.Recordset.movenext

End if

       End sub

 

Private sub command1_click()

On error resume next

If(Adodc1.Recordset.BOF) then

Msgbox(“No previous record”)

Else

Adodc1.Recordset.moveprevious

End if

End sub

 

Private sub command7_click()

Adodc1.recordset.update

Msgbox(“Record updated”)        

End sub

15.Sub procedure

 

Codings

Option Explicit

Private sub command1_click()

Timer1.Enabled=true     

End sub

 

Private sub  Timer1_timer()

Color

End sub

 

Private sub color()

If form1.backcolor=vbred then

Form1.backcolor=vbgreen

Elseif form1.backcolor=vbgreen then

Form1.backcolor=vbyellow

Elseif form1.backcolor=vbyellow then

Form1.backcolor=vbred

End if                                

End sub

 

16. Number puzzle

 

Private sub command1_click()

If command2.caption=” “ then

T=command1.caption

Command1.caption=command2.caption

Command2.caption=t

Elseif command4.caption=” “ then

T=command1.caption

Command1.caption=command4.caption

Command4.caption=t

End if

End sub

Private sub command2.click()

If command1.caption=” “ then

T=command2.caption

Command2.caption=command1.caption

Command1.caption=t

 

Elseif command5.caption=” “ then

T=command2.caption

Command2.caption=command5.caption

Command5.caption=t+

 

Elseif command3.caption=” “ then

T=command2.caption

Command2.caption=command3.caption

Command3.caption=t

End if

End sub

 

Private  sub command3_click()

If command2.caption=” “ then

T=command3.caption

Command3.caption=command2.caption

Command2.caption=t

Elseif command6.caption=” “ then

T=command3.caption=command6.caption

Command6.caption=t

 

Elseif command4.caption=” “ then

T=command3.caption

Command3.caption=command4.caption

Command4.caption=t

End if

End sub

 

Private sub command4_click()

If command1.caption=” “ then

T=command4.caption

Command4.caption=command1.caption

Command1.caption=t

 

Elseif command5.caption=” “ then

T=command4.caption

Command4.caption=command5.caption

Command5.caption=t

 

Elseif command7.caption= “ “ then

T=command4.caption

Command4.caption=command7.caption

Command7.caption=t

 

Elseif command3.caption=”” then

T=command4.caption

Command4.caption=command3.caption

Command3.caption=t

End if

End sub

 

Private sub command5_click()

If command2.caption=” “ then

T=command5.caption

Command5.caption=command2.caption

Command2.caption=t

 

Elseif command4.caption=” “ then

T=command5.caption

Command5.caption=command4.caption

Command4.caption=t

 

Elseif command6.caption=” “ then

T=command5.caption

Command5.caption=command6.caption

Command6.caption=t

 

Elseif command8.caption=” “ then

T=command5.caption

Command5.caption=command8.caption

Command8.caption=t

End if

End sub

 

Private sub command6_click()

If command3.caption=” “ then

T=command6.caption

Command6.caption=command3.caption

Command3.caption=t

 

Elseif command5.caption=” “ then

T=command6.caption

Command6.caption=command5.caption

Command5.caption=t

 

Elseif command9.caption=” “ then

T=command6.caption

Command6.caption=command9.caption

Command9.caption=t

End if

End sub

 

Private sub command7_click()

If command4.caption=” “  then

T=command7.caption

Command7.caption=command4.caption

Command4.caption=t

 

Elseif command8.caption=” “ then

T=command7.caption

Command7.caption=command8.caption

Command8.caption=t

End if

End sub

 

Private sub command8_click()

If command7.caption=” “ then

T=command8.caption

Command8.caption=command7.caption

Command7.caption=t

 

Elseif command5.caption=” “ then

T=command8.caption

Command8.caption=command5.caption

Command5.caption=t

 

Elseif command9.caption=” “ then

T=command8.caption

Command8.caption=command9.caption

Command9.caption=t

End if

End sub

 

Private sub command9_click()

If command8.caption=” “ then

T=command9.caption

Command9.caption=command8.caption

Command8.caption=t

 

Elseif command6.caption=” “ then

T=command9.caption

Command9.caption=command6.caption

Command6.caption=t

End if

End sub

 

Private sub command10_click()

T=command4.caption

Command4.caption=command6.caption

Command6.caption=command8.caption

Command8.caption=command3.caption

Command3.caption=command5.caption

Command5.caption=command2.caption

Command2.caption=command1.caption

Command1.caption=command7.caption

Command7.caption=command9.caption

Command9.caption=t

End sub

 

Private sub form_load()

Me.windowstate=2

End sub              

 

Private sub command11_click()

If Command1.Caption=”1” And Command2.Caption=”2”

And Command3.Caption=”3” And

Command4.Caption=”4” And

Command5.Caption=”5” And

Command6.Caption=”6” And

Command7.Caption=”7” And

Command8.Caption=”8” And

Command9.Caption=”9 "then

Msgbox”winner”

Else

Msgbox”looser”

End if

End sub