You are on page 1of 33

s

LEAP YEAR

Dim i, j, k As Integer
Dim sir As String
Private Sub Cmd_reset_Click()
Unload Me
End Sub

Private Sub Cmd_exit_Click()


End
End Sub

Private Sub Form_Load()


List1.AddItem ("jan")
List1.AddItem ("feb")
List1.AddItem ("mar")
List1.AddItem ("apr")
List1.AddItem ("may")
List1.AddItem ("jun")
List1.AddItem ("july")
List1.AddItem ("aug")
List1.AddItem ("sep")
List1.AddItem ("oct")
List1.AddItem ("nov")
List1.AddItem ("dec")
End Sub

Private Sub List1_Click()


i = Val(txt_year.Text) j =
i Mod 4 If j = 0 Then
MsgBox "year" & txt_year.Text & "is a leap year", vbOKOnly, "leap year"

k = List1.ListIndex
If k = 0 Then
txt_days.Text = 31
ElseIf k = 1 Then
txt_days.Text = 29
ElseIf k = 2 Then
txt_days.Text = 31
ElseIf k = 3 Then
txt_days.Text = 30
ElseIf k = 4 Then
txt_days.Text = 31
ElseIf k = 5 Then
txt_days.Text = 30
ElseIf k = 6 Then
txt_days.Text = 31
ElseIf k = 7 Then
txt_days.Text = 31
ElseIf k = 8 Then
txt_days.Text = 30
ElseIf k = 9 Then
txt_days.Text = 31
ElseIf k = 10 Then
txt_days.Text = 30
Else
txt_days.Text= 31
End If
Else
MsgBox "year" & txt_year.Text & "is not a leap year", vbOKOnly, "leap year"
k = List1.ListIndex

If k = 0 Then

txt_days.Text = 31

ElseIf k = 1 Then

txt_days.Text = 28
ElseIf k = 2 Then
txt_days.Text = 31
ElseIf k = 3 Then
txt_days.Text = 30
ElseIf k = 4 Then
txt_days.Text = 31
ElseIf k = 5 Then
txt_days.Text = 30
ElseIf k = 6 Then
txt_days.Text = 31
ElseIf k = 7 Then
txt_days.Text = 31
ElseIf k = 8 Then
txt_days.Text = 30
ElseIf k = 9 Then
txt_days.Text = 31
ElseIf k = 10 Then
txt_days.Text = 30
Else
txt_days.Text= 31
End If
End If
End Sub
OUTPUT
EMPLOYEE DETAILS

Dim con As ADODB.Connection


Dim a As Integer

Private Sub cmd_add_Click()


Adodc1.Recordset.AddNew
Adodc1.Recordset.Fields(0) = Val(txt_emp.Text)
Adodc1.Recordset.Fields(1) = Val(txt_name.Text)
Adodc1.Recordset.Fields(2) = Val(txt_age.Text)
Adodc1.Recordset.Fields(3) = Val(txt_sex.Text)
Adodc1.Recordset.Fields(4) = Val(txt_salary.Text)
End Sub

Private Sub cmd_upd_Click()


Adodc1.Recordset.Update
MsgBox "record updated"
End Sub

Private Sub cmd_search_Click()


a = Val(InputBox("", "search"))
If a <> 0 Then
Adodc1.Recordset.MoveFirst
Adodc1.Recordset.Find "empno=" & a & ""
If Adodc1.Recordset.EOF Then
MsgBox "record not found", vbInformation + vbOKOnly, "search result"
End If
End If
End Sub

Private Sub cmd_del_Click()


If Adodc1.Recordset.EOF = True Then
MsgBox "no more record"
Else
Adodc1.Recordset.Delete
Adodc1.Recordset.MoveNext
End If
End Sub

Private Sub cmd_exit_Click()


End
End Sub
OUTPUT
FOREIGN CURRENCY

Dim i As Integer
Private Sub Form_Load()
List1.AddItem "DOLLAR"
List1.AddItem "YURO"
List1.AddItem "DINAR"
List1.AddItem "DOLLAR1"
End Sub

Private Sub List1_Click()


i = List1.ListIndex
If i = 0 Then
txt_value.Text = 57.3
ElseIf i = 1 Then
txt_value.Text = 34.6
ElseIf i = 2 Then
txt_value.Text = 64.2
ElseIf i = 3 Then
txt_value.Text = 54.1
Else
txt_value.Text=34.6
End If
End Sub
OUTPUT
CALCUATOR

Option Explicit
Dim v1, v2, v3, res, opt, flag As Integer
Private Sub cmd_num_Click(Index As Integer)
If flag = True Then
txt_res.Text = " "
flag=False
End If
txt_res.Text = txt_res.Text & (Index)
End Sub

Private Sub cmd_opr_Click(Index As Integer)


v1 = Val(txt_res.Text)
opt = Index txt_res.Text = " "
End Sub

Private Sub cmd_sin_Click()


txt_res.Text = Sin(txt_res.Text)
End Sub

Private Sub cmd_cos_Click()


txt_res.Text= Cos(txt_res.Text)
End Sub

Private Sub cmd_tan_Click()


txt_res.Text = Tan(txt_res.Text)
End Sub

Private Sub cmd_inv_Click()


txt_res.Text = 1 / Val(txt_res.Text)
End Sub
Private Sub cmd_log_Click()
txt_res.Text = Log(txt_res.Text)
End Sub

Private Sub cmd_dot_Click()


text_res = txt_res & "."
End Sub

Private Sub cmd_eql_Click()


v2 = Val(txt_res.Text)
Select Case opt
Case 0:
res = v1 + v2
Case 1:
res = v1 - v2
Case 2:
res = v1 * v2
Case 3:
res = v1 / v2
End Select
txt_res = res
flag = True
End Sub

Private Sub cmd_sqr_Click()


txt_res.Text=val (txt_res.Text) * val (txt_res.Text)
End Sub

Private Sub cmd_sqrt_Click()


Dim a As Variant
a = Math.Sqr(txt_res.Text)
txt_res.Text = a
End Sub
Private Sub plormin_Click()
txt_res.Text = -Val(txt_res.Text)
End Sub

Private Sub cmd_clear_Click()


txt_res.Text = " "
End Sub
OUTPUT
SCREEN SERVER

Dim a(10) As Variant


Private Sub Form_Load()
Me.Left = 0
Me.Top = 0
Me.Width = Screen.Width
Me.Height = Screen.Height
Image1.Width = Me.Width
Image1.Height = Me.Height
a(0) ="E:\vbprogram\ss\Chrysanthemum.jpg"
a(1) = "E:\vbprogram\ss\Desert.jpg"
a(2) = "E:\vbprogram\ss\Hydrangeas.jpg"
a(3) = "E:\vbprogram\ss\images (4).jpg"
a(4) = "E:\vbprogram\ss\images (5).jpg"
a(5) = "E:\vbprogram\ss\images (6).jpg"
a(6) = "E:\vbprogram\ss\Jellyfish.jpg"
a(7) = "E:\vbprogram\ss\Koala.jpg"
a(8) = "E:\vbprogram\ss\Lighthouse.jpg"
a(9) = "E:\vbprogram\ss\Penguins.jpg"
End Sub

Private Sub Timer1_Timer()


i = Math.Round(Rnd() * 3)
Image1.Picture = LoadPicture(a(i))
i=i+1
If
i = 1 Then i = 0
End If
End Sub
OUTPUT
BANK DETAILS

Dim con As ADODB.Connection


Dim rs As ADODB.Recordset
Dim com As ADODB.Command

Private Sub CMD_ADD_Click()


Adodc1.Recordset.AddNew
Adodc1.Recordset.Fields(0) = Val(txt_accno.Text)
Adodc1.Recordset.Fields(1) = Now
Adodc1.Recordset.Fields(2) = Trim(txt_name.Text)
Adodc1.Recordset.Fields(3) = Val(txt_bal.Text)
Adodc1.Recordset.Fields(4) = Trim(com_mode.Text)
Adodc1.Recordset.Fields(5) = Val(txt_trnamt.Text)
Adodc1.Recordset.Fields(6) = Val(txt_curramt.Text)
Adodc1.Recordset.Fields(7) = Val(txt_int.Text)
End Sub

Private Sub CMD_CALA_Click()


Dim temp As Integer
txt_int.Text = Val(txt_bal.Text) * (2 / 100)
If com_mode.Text = "withdraw" Then
temp = Val(txt_bal.Text) - Val(txt_trnamt.Text) + Val(txt_int.Text)
If temp >= 500 Then
txt_curramt.Text = temp
Else
MsgBox "maintain the mininum balance of rupees 500"
End If
Else
txt_curramt.Text = Val(txt_bal.Text) + Val(txt_trnamt.Text) + Val(txt_int.Text)

End If
Adodc1.Recordset.Fields(3) = txt_curramt.Text
End Sub

Private Sub CMD_UPDATE_Click()


Adodc1.Recordset.Update
MsgBox "record updated"
End Sub

Private Sub CMD_REP_Click()


DataReport1.Show
End Sub

Private Sub CMD_DEL_Click()


Adodc1.Recordset.Delete
MsgBox "record delete"
End Sub

Private Sub CMD_EXIT_Click()


End
End Sub
OUTPUT
BLOOD BANK

Dim con As ADODB.Connection


Dim rs As ADODB.Recordset
Dim cm As ADODB.Command

Private Sub cmd_add_Click()


Adodc1.Recordset.AddNew
Adodc1.Recordset.Fields(0) = Trim(txt_name.Text)
Adodc1.Recordset.Fields(1) = Trim(txt_city.Text)
Adodc1.Recordset.Fields(2) = Trim(txt_blood.Text)
Adodc1.Recordset.Fields(3) = Val(txt_age.Text)
Adodc1.Recordset.Fields(4) = Trim(txt_sex.Text)
End Sub

Private Sub cmd_upd_Click()


Adodc1.Recordset.Update
MsgBox "record updated"
End Sub

Private Sub cmd_report_Click()


DataReport1.Show
End Sub

Private Sub cmd_delete_Click()


Adodc1.Recordset.Delete
MsgBox "record delete"
End Sub

Private Sub cmd_exit_Click()


End
End Sub
OUTPUT
ACTIVEX CONTROL

'Default Property Values:


Const m_def_Enabled = 0
Const m_def_BackStyle = 0 Const
m_def_BorderStyle = 0 'Property
Variables:
Dim m_Enabled As Boolean
Dim m_Font As Font
Dim m_BackStyle As Integer
Dim m_BorderStyle As Integer
'Event Declarations:
Event Click()
Event DblClick()
Event KeyDown(KeyCode As Integer, Shift As Integer)
Event KeyPress(KeyAscii As Integer)
Event KeyUp(KeyCode As Integer, Shift As Integer)
Event MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
Event MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
Event MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)

Private Sub txt_num_KeyPress(KeyAscii As Integer)


If Not (KeyAscii >= 48 And KeyAscii <= 57) Then
KeyAscii = 0
MsgBox ("Accept Only No")
End If
End Sub
'WARNING! DO NOT REMOVE OR MODIFY THE FOLLOWING COMMENTED LINES!
'MappingInfo=txt_num,txt_num,-1,BackColor
Public Property Get BackColor() As OLE_COLOR
BackColor = txt_num.BackColor
End Property
Public Property Let BackColor(ByVal New_BackColor As OLE_COLOR)
txt_num.BackColor() = New_BackColor
PropertyChanged "BackColor"
End Property

'WARNING! DO NOT REMOVE OR MODIFY THE FOLLOWING COMMENTED LINES!


'MappingInfo=txt_num,txt_num,-1,ForeColor
Public Property Get ForeColor() As OLE_COLOR
ForeColor = txt_num.ForeColor
End Property

Public Property Let ForeColor(ByVal New_ForeColor As OLE_COLOR)


txt_num.ForeColor() = New_ForeColor
PropertyChanged "ForeColor"
End Property

'WARNING! DO NOT REMOVE OR MODIFY THE FOLLOWING COMMENTED LINES!


'MemberInfo=0,0,0,0
Public Property Get Enabled() As Boolean
Enabled = m_Enabled
End Property

Public Property Let Enabled(ByVal New_Enabled As Boolean)


m_Enabled = New_Enabled PropertyChanged "Enabled"
End Property

'WARNING! DO NOT REMOVE OR MODIFY THE FOLLOWING COMMENTED LINES!


'MemberInfo=6,0,0,0
Public Property Get Font() As Font
Set Font = m_Font
End Property

Public Property Set Font(ByVal New_Font As Font)


Set m_Font = New_Font
PropertyChanged "Font"
End Property

'WARNING! DO NOT REMOVE OR MODIFY THE FOLLOWING COMMENTED LINES!


'MemberInfo=7,0,0,0
Public Property Get BackStyle() As Integer
BackStyle = m_BackStyle
End Property

Public Property Let BackStyle(ByVal New_BackStyle As Integer)


m_BackStyle = New_BackStyle
PropertyChanged "BackStyle"
End Property

'WARNING! DO NOT REMOVE OR MODIFY THE FOLLOWING COMMENTED LINES!


'MemberInfo=7,0,0,0
Public Property Get BorderStyle() As Integer
BorderStyle = m_BorderStyle
End Property

Public Property Let BorderStyle(ByVal New_BorderStyle As Integer)


m_BorderStyle = New_BorderStyle
PropertyChanged "BorderStyle"
End Property

'WARNING! DO NOT REMOVE OR MODIFY THE FOLLOWING COMMENTED LINES!


'MemberInfo=5
Public Sub Refresh()
End Sub
'Initialize Properties for User Control
Private Sub UserControl_InitProperties()
m_Enabled = m_def_Enabled Set
m_Font = Ambient.Font
m_BackStyle = m_def_BackStyle
m_BorderStyle = m_def_BorderStyle
End Sub

'Load property values from storage


Private Sub UserControl_ReadProperties(PropBag As PropertyBag)
txt_num.BackColor = PropBag.ReadProperty("BackColor", &H80000005)
txt_num.ForeColor = PropBag.ReadProperty("ForeColor", &H80000008)
m_Enabled = PropBag.ReadProperty("Enabled", m_def_Enabled)
Set m_Font = PropBag.ReadProperty("Font", Ambient.Font)
m_BackStyle = PropBag.ReadProperty("BackStyle", m_def_BackStyle)
m_BorderStyle = PropBag.ReadProperty("BorderStyle", m_def_BorderStyle)
End Sub

'Write property values to storage


Private Sub UserControl_WriteProperties(PropBag As PropertyBag)

Call PropBag.WriteProperty("BackColor", txt_num.BackColor, &H80000005)


Call PropBag.WriteProperty("ForeColor", txt_num.ForeColor, &H80000008)
Call PropBag.WriteProperty("Enabled", m_Enabled, m_def_Enabled)
Call PropBag.WriteProperty("Font", m_Font, Ambient.Font)
Call PropBag.WriteProperty("BackStyle", m_BackStyle, m_def_BackStyle)
Call PropBag.WriteProperty("BorderStyle", m_BorderStyle, m_def_BorderStyle)
End Sub
OUTPUT
ACTIVEX DLL

Dim s As String
Dim no As Integer
Dim r As Integer
Dim ano As Integer
Public Property Get ams() As String Static s As Integer
s=0
no = InputBox("Enter The Number","ArmstrongNumber")
ano = Val(no) Do While (Val(no) > 0) r = Val(no) Mod 10
s = s + (r ^ 3) no = Fix(Val(no) / 10)
Loop
If (ano = s) Then
ams = ano & " Is An Armstrong Number " Else
ams = ano & " Is Not An Armstrong Number"
End If
End Property

Public Property Get fact() As String


Dim stemp As String
Dim i, f, n As Integer
f= 1
n = InputBox("Enter The Number", "Factorial")
For i = 1 To n Step 1 f = f * i stemp = f
fact = "The Factorial Is" & stemp
Next
End Property
Public Property Get perfect() As String
Dim i, n, s As Integer
n = InputBox("Enter The Number", "Perfect Number")
For i = 1 To n - 1 Step 1
If (n Mod i = 0) Then
s= s + i End If
Next i
If n=s Then
perfect = "The Given Number" & n & " Is a Perfect Number:" Else
perfect = "The Given Number" & n & " Is a Not Perfect Number:"
End If

End Property
Public Property Get sdigits() As String Dim
no, s, i, r As Integer
no = InputBox("Enter The Number", "Sum Of Digits")
Do While
(no > 0) r = no Mod 10 no = Fix(no / 10) s =s + r
Loop
sdigits = "The Sum Of Digits" & s
End Property

Dim obj As New Class1


Private Sub Cmd_armstorng_Click()
stemp = obj.ams
MsgBox stemp, vbOKOnly, "Armstrong Number"
End Sub

Private Sub Cmd_factorial_Click()


Dim stemp As String
stemp = obj.fact
MsgBox stemp, vbOKOnly, "Factorial Number"
End Sub

Private Sub Cmd_perfect_Click()


Dim stemp As String
stemp=obj.perfect
MsgBox stemp, vbOKOnly, "Perfect Number"
End Sub
Private Sub Cmd_digits_Click() Dim stemp As String stemp=obj.sdigits
MsgBox stemp, vbOKOnly, "Sum Of Digits "
End Sub

Private Sub Cmd_exit_Click()


End
End Sub
OUTPUT
NOTEPAD

Private Sub mnucopy_Click()

Clipboard.SetText (RichTextBox1.SetText)

End Sub

Private Sub mnucut_Click()

Clipboard.setTextRichTextBox1.SetText)

Clipboard.SetText (RichTextBox1.SetText)

End Sub

Private Sub mnudelete_Click()

RichTextBox1.Text = ""

End Sub

Private Sub mnunew_Click()

RichTextBox1.Text = ""

End Sub

Private Sub mnuopen_Click()

CommonDialog1.ShowOpen

RichTextBox1.FileName = CommonDialog1.FileName

End Sub

Private Sub mnuPaste_Click()

RichTextBox1.SetText = Clipboard.SetText

End Sub

Private Sub mnureplace_Click()

s1 = Trim(RichTextBox1.Text)
s2 = InputBox("find what", "search")

s3 = InputBox("replace with?", "replace")

RichTextBox1.Text = Replace(s1, s2, s3)

End Sub

Private Sub mnusave_Click()

CommonDialog1.ShowSave

RichTextBox1.SaveFile CommonDialog1.FileName

End Sub
OUTPUT

You might also like