Vbreport

2,387 views

Published on

Published in: Technology, Education
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
2,387
On SlideShare
0
From Embeds
0
Number of Embeds
47
Actions
Shares
0
Downloads
232
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Vbreport

  1. 1. Program 1Printing Series  CodePrivate Sub Form_Click()For k = 1 To 5Print kNextEnd Sub  Output 1|Page
  2. 2. Program 2 Printing Triangle Series  CodePrivate Sub Form_Click()For r = 1 To 5For c = 1 To rPrint c;NextPrintNextEnd Sub  Output 2|Page
  3. 3. Program 3Printing Reverse triangle series  Code Private Sub Form_Click() For r = 5 To 1 Step -1 For c = 1 To r Print c; Next Print Next End Sub  Output 3|Page
  4. 4. Program 4Multiply Two Numbers  CodePrivate Sub Command1_Click()Text3.Text = Val(Text1.Text) * Val(Text2.Text)End SubPrivate Sub Form_Load()Text1.Text = ""Text2.Text = ""Text3.Text = ""End Sub  Output 4|Page
  5. 5. Program 5Printing Pyramid Series  CodePrivate Sub Form_Click()For r = 1 To 5For k = 4 To r Step -1Print " ";NextFor c = 1 To rPrint c;NextFor d = r - 1 To 1 Step -1Print d;NextPrintNextEnd Sub 5|Page
  6. 6.  Output 6|Page
  7. 7. Program 6Simple Calculator  CodePrivate Sub Command1_Click()Text3.Text = Val(Text1.Text) + Val(Text2.Text)End SubPrivate Sub Command2_Click()Text3.Text = Val(Text1.Text) - Val(Text2.Text)End SubPrivate Sub Command3_Click()Text3.Text = Val(Text1.Text) * Val(Text2.Text)End SubPrivate Sub Command4_Click()Text3.Text = Val(Text1.Text) / Val(Text2.Text)End Sub 7|Page
  8. 8.  Output 8|Page
  9. 9. Program 7Timer Control  CodePrivate Sub Timer1_Timer()Command1.Left = Command1.Left + 10If Command1.Left = 9840 ThenTimer1.Enabled = FalseTimer2.Enabled = TrueEnd IfEnd SubPrivate Sub Timer2_Timer()Command1.Top = Command1.Top + 10If Command1.Top = 9000 ThenTimer2.Enabled = FalseTimer3.Enabled = TrueEnd IfEnd SubPrivate Sub Timer3_Timer() 9|Page
  10. 10. Command1.Left = Command1.Left - 10If Command1.Left = 0 ThenTimer3.Enabled = FalseTimer4.Enabled = TrueEnd IfEnd SubPrivate Sub Timer4_Timer()Command1.Top = Command1.Top - 10If Command1.Top = 0 ThenTimer4.Enabled = FalseTimer1.Enabled = TrueEnd IfEnd SubPrivate Sub Timer5_Timer()Command2.Top = Command2.Top + 10If Command2.Top = 9000 ThenTimer5.Enabled = FalseTimer6.Enabled = TrueEnd If 10 | P a g e
  11. 11. End SubPrivate Sub Timer6_Timer()Command2.Left = Command2.Left + 10If Command2.Left = 9840 ThenTimer6.Enabled = FalseTimer7.Enabled = TrueEnd IfEnd SubPrivate Sub Timer7_Timer()Command2.Top = Command2.Top - 10If Command2.Top = 0 ThenTimer7.Enabled = FalseTimer8.Enabled = TrueEnd IfEnd SubPrivate Sub Timer8_Timer()Command2.Left = Command2.Left - 10If Command2.Left = 0 Then 11 | P a g e
  12. 12. Timer8.Enabled = FalseTimer5.Enabled = TrueEnd IfEnd Sub  Output 12 | P a g e
  13. 13. Program 8Chech Box And Option Button  CodePrivate Sub Check1_Click()If Check1.Value = 1 ThenText1.FontBold = TrueElseIf Check1.Value = 0 ThenText1.FontBold = FalseEnd IfEnd SubPrivate Sub Check2_Click()If Check2.Value = 1 ThenText1.FontItalic = TrueElseIf Check2.Value = 0 ThenText1.FontItalic = FalseEnd IfEnd SubPrivate Sub Check3_Click() 13 | P a g e
  14. 14. If Check3.Value = 1 ThenText1.FontUnderline = TrueElseIf Check3.Value = 0 ThenText1.FontUnderline = FalseEnd IfEnd SubPrivate Sub Option1_Click()If Option1.Value = True ThenText1.BackColor = vbBlueEnd IfEnd SubPrivate Sub Option2_Click()If Option2.Value = True ThenText1.BackColor = vbGreenEnd IfEnd SubPrivate Sub Option3_Click()If Option3.Value = True Then 14 | P a g e
  15. 15. Text1.BackColor = vbYellowEnd IfEnd Sub  Output 15 | P a g e
  16. 16. Program 9Combo Box  CodePrivate Sub Combo1_Click()If Combo1.ListIndex = 0 ThenText1.FontName = Combo1.TextElseIf Combo1.ListIndex = 1 ThenText1.FontName = Combo1.TextElseIf Combo1.ListIndex = 2 ThenText1.FontName = Combo1.TextElseIf Combo1.ListIndex = 3 ThenText1.FontName = Combo1.TextElseIf Combo1.ListIndex = 4 ThenText1.FontName = Combo1.TextElseIf Combo1.ListIndex = 5 ThenText1.FontName = Combo1.TextElseIf Combo1.ListIndex = 6 ThenText1.FontName = Combo1.TextEnd IfEnd Sub 16 | P a g e
  17. 17. Private Sub Combo2_Click()If Combo2.ListIndex = 0 ThenText1.FontSize = Combo2.TextElseIf Combo2.ListIndex = 1 ThenText1.FontSize = Combo2.TextElseIf Combo2.ListIndex = 2 ThenText1.FontSize = Combo2.TextElseIf Combo2.ListIndex = 3 ThenText1.FontSize = Combo2.TextElseIf Combo2.ListIndex = 4 ThenText1.FontSize = Combo2.TextElseIf Combo2.ListIndex = 5 ThenText1.FontSize = Combo2.TextElseIf Combo2.ListIndex = 6 ThenText1.FontSize = Combo2.TextElseIf Combo2.ListIndex = 7 ThenText1.FontSize = Combo2.TextElseIf Combo2.ListIndex = 8 ThenText1.FontSize = Combo2.TextEnd If 17 | P a g e
  18. 18. End SubPrivate Sub Form_Load()Combo1.AddItem "Times New Roman"Combo1.AddItem "Arial Black"Combo1.AddItem "Batang"Combo1.AddItem "Century"Combo1.AddItem "Courier New"Combo1.AddItem "impact"Combo1.AddItem "Lucida Console"End Sub  Output 18 | P a g e
  19. 19. Program 10Calculating Student Result  CodePrivate Sub Combo3_Click()If Combo3.ListIndex = 0 ThenLabel3.Caption = "data strcture"Label4.Caption = "visual basic"Label5.Caption = "database"ElseLabel3.Caption = "accounts"Label4.Caption = "MIS"Label5.Caption = "economics"End IfEnd SubPrivate Sub Command1_Click()Label12.Caption = Text1.TextLabel14.Caption = Text2.TextLabel16.Caption = Text4.TextLabel18.Caption = Label3.Caption 19 | P a g e
  20. 20. Label19.Caption = Label4.CaptionLabel20.Caption = Label5.CaptionLabel16.Caption = Label5.CaptionLabel17.Caption = Combo3.TextLabel21.Caption = Text3.TextLabel22.Caption = Text5.TextLabel23.Caption = Text6.TextLabel25.Caption = Val(Text3.Text) + Val(Text5.Text) +Val(Text6.Text)Text7.Text = ((Val(Text3.Text) + Val(Text5.Text) + Val(Text6.Text)) *100) / 300If Val(Text7.Text) >= 80 ThenLabel29.Caption = "merit"ElseIf Val(Text7.Text) >= 60 ThenLabel29.Caption = "firstclass"ElseIf Val(Text7.Text) >= 33 ThenLabel29.Caption = "pass"ElseLabel29.Caption = "fail"End IfEnd Sub 20 | P a g e
  21. 21. Private Sub Form_Load()Text1.Text = ""Text2.Text = ""Text3.Text = ""Text4.Text = ""Text5.Text = ""Text6.Text = ""End Sub  Output 21 | P a g e
  22. 22. Program 11Paint Functions  CodePrivate Sub Command1_Click()Form1.ClsEnd SubPrivate Sub Form_MouseDown(Button As Integer, Shift As Integer,X As Single, Y As Single)Form1.CurrentX = XForm1.CurrentY = YEnd SubPrivate Sub Form_MouseMove(Button As Integer, Shift As Integer,X As Single, Y As Single)If Button = 1 ThenLine (X, Y)-(CurrentX, CurrentY)Circle (X, Y), 700End IfEnd Sub 22 | P a g e
  23. 23.  Output 23 | P a g e
  24. 24. Program 12Puzzle Game  CodePrivate Sub Command1_Click()If Command2.Caption = "" ThenCommand2.Caption = Command1.CaptionCommand1.Caption = ""ElseIf Command4.Caption = "" ThenCommand4.Caption = Command1.CaptionCommand1.Caption = ""End IfEnd SubPrivate Sub Command10_Click()Command1.Caption = 1Command2.Caption = 2Command3.Caption = 3Command4.Caption = 4Command5.Caption = 5Command6.Caption = 6 24 | P a g e
  25. 25. Command7.Caption = 7Command8.Caption = 8Command9.Caption = ""End SubPrivate Sub Command2_Click()If Command1.Caption = "" ThenCommand1.Caption = Command2.CaptionCommand2.Caption = ""ElseIf Command3.Caption = "" ThenCommand3.Caption = Command2.CaptionCommand2.Caption = ""ElseIf Command5.Caption = "" ThenCommand5.Caption = Command2.CaptionCommand2.Caption = ""End IfEnd SubPrivate Sub Command3_Click()If Command2.Caption = "" ThenCommand2.Caption = Command3.Caption 25 | P a g e
  26. 26. Command3.Caption = ""ElseIf Command6.Caption = "" ThenCommand6.Caption = Command3.CaptionCommand3.Caption = ""End IfEnd SubPrivate Sub Command4_Click()If Command1.Caption = "" ThenCommand1.Caption = Command4.CaptionCommand4.Caption = ""ElseIf Command7.Caption = "" ThenCommand7.Caption = Command4.CaptionCommand4.Caption = ""ElseIf Command5.Caption = "" ThenCommand5.Caption = Command4.CaptionCommand4.Caption = ""End IfEnd SubPrivate Sub Command5_Click() 26 | P a g e
  27. 27. If Command2.Caption = "" ThenCommand2.Caption = Command5.CaptionCommand5.Caption = ""ElseIf Command4.Caption = "" ThenCommand4.Caption = Command5.CaptionCommand5.Caption = ""ElseIf Command8.Caption = "" ThenCommand8.Caption = Command5.CaptionCommand5.Caption = ""ElseIf Command6.Caption = "" ThenCommand6.Caption = Command5.CaptionCommand5.Caption = ""End IfEnd SubPrivate Sub Command6_Click()If Command3.Caption = "" ThenCommand3.Caption = Command6.CaptionCommand6.Caption = ""ElseIf Command9.Caption = "" ThenCommand9.Caption = Command6.Caption 27 | P a g e
  28. 28. Command6.Caption = ""End IfEnd SubPrivate Sub Command7_Click()If Command4.Caption = "" ThenCommand4.Caption = Command7.CaptionCommand7.Caption = ""ElseIf Command8.Caption = "" ThenCommand8.Caption = Command7.CaptionCommand7.Caption = ""End IfEnd SubPrivate Sub Command8_Click()If Command7.Caption = "" ThenCommand7.Caption = Command8.CaptionCommand8.Caption = ""ElseIf Command5.Caption = "" ThenCommand5.Caption = Command8.CaptionCommand8.Caption = "" 28 | P a g e
  29. 29. ElseIf Command9.Caption = "" ThenCommand9.Caption = Command8.CaptionCommand8.Caption = ""End IfEnd SubPrivate Sub Command9_Click()If Command8.Caption = "" ThenCommand8.Caption = Command9.CaptionCommand9.Caption = ""ElseIf Command6.Caption = "" ThenCommand6.Caption = Command9.CaptionCommand9.Caption = ""End IfEnd Sub 29 | P a g e
  30. 30.  Output 30 | P a g e
  31. 31. Program 13MENU BAR  CodePrivate Sub Blue_Click()Form1.BackColor = vbBlueEnd SubPrivate Sub Exit_Click()Unload MeEnd SubPrivate Sub Green_Click()Form1.BackColor = vbGreenEnd SubPrivate Sub Maximize_Click()Form1.WindowState = 2End SubPrivate Sub Minimize_Click()Form1.WindowState = 1 31 | P a g e
  32. 32. End SubPrivate Sub Red_Click()Form1.BackColor = vbRedEnd SubPrivate Sub Restore_Click()Form1.WindowState = 0End Sub 32 | P a g e
  33. 33.  Output 33 | P a g e

×