Visual Basic 6.0
Slip25
Q.1) Write a VB Program to create a tool bar with four shortcut buttons. [Marks 15]
Solution
Private Sub Form_Load()
Toolbar1.ImageList = ImageList1
Dim button1 As Button
Set b1 = Toolbar1.Buttons.Add
b1.Style = tbrDefault
b1.Caption = “New”
b1.Image = 1
Dim b2 As Button
Set b2 = Toolbar1.Buttons.Add
b2.Style = tbrDefault
b2.Caption = “Open”
b2.Image = 2
Dim b3 As Button
Set b3 = Toolbar1.Buttons.Add
b3.Style = tbrDefault
b3.Caption = “Save”
b3.Image = 3
Dim b4 As Button
Set b4 = Toolbar1.Buttons.Add
b4.Style = tbrDefault
b4.Caption = “Copy”
b4.Image = 4
End Sub
Solution
Dim a(10) As Integer
Dim i As Integer
Private Sub Command1_Click()
MSChart1.ChartData = a
MSChart1.chartType = VtChChartType2dBar
End Sub
Private Sub Command2_Click()
MSChart1.ChartData = a
MSChart1.chartType = VtChChartType2dPie
End Sub
Private Sub Command3_Click()
For i = 0 To 9
a(i) = InputBox("enter element")
Next
End Sub
Output
Tags:
VB 6.0