Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...
Vb file
1.
2. CODING
Private Sub Command1_Click()
Frame1.Visible = True
Text7.Text = Text1.Text
Text8.Text = Text2.Text
Text9.Text = Text3.Text
Text10.Text = Text4.Text
Text11.Text = Text5.Text
Text12.Text = Text6.Text
End Sub
Private Sub Command2_Click()
Text1.Text = " "
Text2.Text = " "
Text3.Text = " "
Text4.Text = " "
Text5.Text = " "
Text6.Text = " "
Text7.Text = " "
Text8.Text = " "
Text9.Text = " "
Text10.Text = " "
Text11.Text = " "
Text12.Text = " "
End Sub
Private Sub Command3_Click()
End
End Sub
Private Sub text6_change()
Text1.Text = (Text7.Text)
End Sub
3.
4. CODING
Private Sub Check1_Click()
If Check1.Enabled = True Then
frame3.Visible = True
End If
End Sub
Private Sub Command1_Click()
MsgBox ("successfully registered")
End Sub
Private Sub Command2_Click()
Text1.Text = ""
Text2.Text = ""
Text3.Text = ""
Text4.Text = ""
Text5.Text = ""
Text6.Text = ""
Text7.Text = ""
Check1.Value = False
Check2.Value = False
Check3.Value = False
Check4.Value = False
Check5.Value = False
Check6.Value = False
Check7.Value = False
End Sub
Private Sub Command3_Click()
End
End Sub
Private Sub Option6_Click()
If Option6.Value = True Then
Frame1.Visible = True
Frame2.Visible = False
End If
End Sub
Private Sub Option7_Click()
If Option7.Value = True Then
Frame1.Visible = False
Frame2.Visible = True
End If
End Sub
5. Dim AMT As Integer
Dim TOTALAMT As Integer
Private Sub Command1_Click()
AMT = PRICE.Text * QUANTITY.Text
TOTALAMT = AMT - (0.15 * AMT)
AMOUNT.Text = AMT
DISCOUNT.Text = TOTALAMT
End Sub
Private Sub Command2_Click()
BOOK_TITLE.Text = ""
PRICE.Text = ""
QUANTITY.Text = ""
AMOUNT.Text = ""
DISCOUNT.Text = ""
End Sub
Private Sub Command3_Click()
End
End Sub
6. Dim reading, a As Double
Private Sub Command1_Click()
reading = Val(Text7.Text) - Val(Text6.Text)
a = (Val(Text8.Text) * 15) + (reading * 0.5)
Text9.Text = reading
Text10.Text = a
End Sub
Private Sub Command2_Click()
Text1.Text = ""
Text2.Text = ""
Text3.Text = ""
Text4.Text = ""
Text5.Text = ""
Text6.Text = ""
Text7.Text = ""
Text8.Text = ""
Text9.Text = ""
Text10.Text = ""
End Sub
Private Sub Command3_Click()
End
End Sub
7. Private Sub Command1_Click()
Text5.Text = 900 + (Text2.Text)
Text6.Text = Text5.Text * 0.18
Text7.Text = Text5.Text - Text6.Text
Text8.Text = Text7.Text * 0.3
Text9.Text = Text7.Text * 0.15
Text3.Text = Text7.Text * 0.5
Text4.Text = Text7.Text * 0.05
End Sub
Private Sub Command2_Click()
Text1.Text = ""
Text2.Text = ""
Text3.Text = ""
Text4.Text = ""
Text5.Text = ""
Text6.Text = ""
Text7.Text = ""
Text8.Text = ""
Text9.Text = ""
End Sub
Private Sub Command3_Click()
End
End Sub
8. Private Sub Command1_Click()
If Combo1.Text = "" Then
MsgBox ("enter a valid name")
Else
Combo1.AddItem Combo1.Text
End If
End Sub
Private Sub Command2_Click()
Combo1.RemoveItem Combo1.ListIndex
End Sub
Private Sub Command3_Click()
MsgBox "all items will be deleted"
Combo1.Clear
End Sub
Private Sub Command4_Click()
MsgBox ("you have choosen" & Combo1.Text)
End Sub
Private Sub Command5_Click()
End
End Sub
9. Private Sub Form_Load()
List1.AddItem "NOIDA"
List1.AddItem "DELHI"
List1.AddItem "GURGAON"
List1.AddItem "GREATER NOIDA"
List1.AddItem "FARIDABAD"
End Sub
Private Sub List1_Click()
If List1.ListIndex = 0 Then
Label4.Caption = "spice cinemas:"
Label5.Caption = "TMK"
ElseIf List1.ListIndex = 1 Then
Label4.Caption = "olsen:"
Label5.Caption = "action replay"
ElseIf List1.ListIndex = 2 Then
Label4.Caption = "TGIP:"
Label5.Caption = "GOLMAAL 3"
ElseIf List1.ListIndex = 3 Then
Label4.Caption = "CSM:"
Label5.Caption = "BREAK KE BAAD"
ElseIf List1.ListIndex = 4 Then
Label4.Caption = "PVR SAKET:"
Label5.Caption = "GUZAARISH"
End If
End Sub
10. Private Sub Command1_Click()
Label3.Caption = Text1.Text
Label4.Caption = Text2.Text
Label5.Caption = List1.Text
Label6.Caption = combo1.Text
End Sub
Private Sub Command2_Click()
Text1.Text = ""
Text2.Text = ""
Label3.Caption = ""
Label4.Caption = ""
11. Label5.Caption = ""
Label6.Caption = ""
End Sub
Private Sub Command3_Click()
End
End Sub
Private Sub Form_Load()
List1.AddItem "computer"
List1.AddItem "business"
List1.AddItem "humanities"
List1.AddItem "Commerce"
List1.AddItem "Medical"
List1.AddItem "Engineering"
combo1.AddItem "ABC"
combo1.AddItem "Amity"
End Sub
12. 10.
Public Function fib(n As Integer) As Integer
If n = 1 Then
fib = 0
ElseIf n = 2 Then
fib = 1
Else
fib = fib(n - 1) + fib(n - 2)
End If
End Function
13. Private Sub Command1_Click()
Dim n As Integer
Dim fibo As Integer
n = Val(Text1.Text)
fibo = fib(n)
Text2.Text = fibo
End Sub
Private Sub Command2_Click()
Text1.Text = ""
Text2.Text = ""
End Sub
Private Sub Command3_Click()
End
End Sub
14. 11.WAP ,using recursive function to calculate Nth Fibonacci Series.
Private Sub Command2_Click()
Dim n, i, sum, r As Double
Dim rev As Double
sum = 0
n = Text1.Text
While n <> 0
r = n Mod 10
rev = (rev * 10) + r
n = n 10
sum = sum + r
Wend
Text2.Text = sum
Text3.Text = rev
End Sub
16. 13.WAP ,using recursive function to calculate GCD of a number .
Private Sub Command1_Click()
Dim n As Integer
Dim p As Integer
Dim i As Integer
Dim result As Integer
result = 1
n = Text1.Text
p = Text2.Text
For i = 1 To p Step 1
result = result * n
Next i
Text3.Text = result
End Sub
Private Sub Command2_Click()
Text1.Text = ""
Form2.Cls
End Sub
Private Sub Command3_Click()
End
End Sub
17. 14.WAP to division of two numbers. Also shows divide by zero error .
Private Sub Command1_Click()
Dim a, b, remainder, quotient As Double
a = Val(Text1.Text)
b = Val(Text2.Text)
If b = 0 Then
MsgBox ("invalid divisor")
Else
quotient = a / b
remainder = a Mod b
Text3.Text = quotient
End If
If remainder = 0 Then
MsgBox ("there is no reminder")
Text4.Text = remainder
Else
Text4.Text = remainder
End If
End Sub
Private Sub Command2_Click()
18. Text1.Text = ""
Text2.Text = ""
label5.Caption = ""
label6.Caption = ""
End Sub
Private Sub Command3_Click()
End
End Sub
19. 15. WAP to check whether a given number is prime or not .
Private Sub Label2_Click()
End Sub
Dim a, b, c As Integer
Private Sub Command1_Click()
a = Val(Text1.Text)
b=0
For i = 1 To a Step 1
c = a Mod i
If c = 0 Then
b=b+1
End If
Next i
If b = 2 Then
MsgBox ("no. is prime")
End If
End Sub
Private Sub Command2_Click()
Text1.Text = ""
End Sub
Private Sub Command3_Click()
End
End Sub
20. 16.WAP to generate first 10 prime number .
Private Sub Command1_Click()
Dim i As Integer
Dim j As Integer
Dim num As Integer
Dim cnt As Integer
i=0
j=0
cnt = 0
num = Val(Text1.Text)
While j < 10
For i = 1 To num
If num Mod i = 0 Then
cnt = cnt + 1
End If
Next i
If cnt = 2 Then
j=j+1
21. List1.AddItem j & ") " & num
End If
cnt = 0
num = num + 1
Wend
End Sub
Private Sub Command2_Click()
Text1.Text = ""
List1.Clear
End Sub
Private Sub Command3_Click()
End
End Sub
22. 17.WAP to check wether a given string is palindrome or not .
Private Sub Command1_Click()
Dim a As String
Dim b As String
a = Text1.Text
b = StrReverse(a)
If a = b Then
MsgBox ("That is a palindrome!")
Else
MsgBox ("No, it is not a palindrome!")
End If
End Sub
Private Sub Command2_Click()
Text1.Text = ""
End Sub
Private Sub Command3_Click()
End
End Sub
23. 18.WAP to swap two numbers by :
a)Call by value
b)Call by reference
Private Function swap(ByVal a As Integer, ByVal b As Integer) As Integer
c=a
a=b
b=c
End Function
Private Function swapref(ByRef a As Integer, ByRef b As Integer) As Integer
c=a
a=b
b=c
End Function
Private Sub Command2_Click()
a = Val(Text1.Text)
b = Val(Text2.Text)
Call swap(a, b)
Label3.Caption = a
Label4.Caption = b
End Sub
24. Private Sub Command1_Click()
Dim a As Integer
Dim b As Integer
a = Val(Text1.Text)
b = Val(Text2.Text)
Call swapref(a, b)
Label3.Caption = a
Label4.Caption = b
End Sub
Private Sub Command3_Click()
Text1.Text = ""
Text2.Text = ""
Label3.Caption = ""
Label4.Caption = ""
End Sub
Private Sub Command4_Click()
End
End Sub
25. 21. WAP to check wether the given string is in upper case or lower case and also convert
it’s case .
Private Sub Command1_Click()
Dim STR As String
STR = Val(Text1.Text)
If Text1.Text = UCase(Text1.Text) Then
MsgBox ("IT IS IN UPPERCASE")
End If
If Text1.Text = LCase(Text1.Text) Then
MsgBox ("IT IS IN LOWER CASE")
End If
End Sub
Private Sub Command2_Click()
If Text1.Text = UCase(Text1.Text) Then
Text1.Text = LCase(Text1.Text)
End If
End Sub
Private Sub Command3_Click()
Text1.Text = ""
End Sub
Private Sub Command4_Click()
End
End Sub