17.Font Dialog box
Label 3 CSC
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
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
0 comments:
Post a Comment