Dim Operand1, Operand2 As DoubleDim Operator As StringDim ClearDisplay As BooleanPrivate Sub ClearBttn_Click() Display.Caption = ""End SubPrivate Sub Digits_Click(Index As Integer) If ClearDisplay Then Display.Caption = "" ClearDisplay = False End If Display.Caption = Display.Caption + Digits(Index).CaptionEnd SubPrivate Sub Div_Click() Operand1 = Val(Display.Caption) Operator = "/" Display.Caption = ""End SubPrivate Sub DotBttn_Click() If ClearDisplay Then Display.Caption = "" ClearDisplay = False End If If InStr(Display.Caption, ".") Then Exit Sub Else Display.Caption = Display.Caption + "." End IfEnd SubPrivate Sub Minus_Click() Operand1 = Val(Display.Caption) Operator = "-" Display.Caption = ""End Sub
Private Sub Over_Click() If Val(Display.Caption) <> 0 Then Display.Caption = 1 / Val(Display.Caption)End Sub
Private Sub Plus_Click() Operand1 = Val(Display.Caption)
Program No. : - 1Name: - Gaurav Saxena Roll No. : - 1308727Class: - MCA (3rd Sem.) Page No. :-_______Statement: - Write a program to design a calculator using Control Array.
Operator = "+" Display.Caption = ""End Sub
Private Sub PlusMinus_Click() Display.Caption = -Val(Display.Caption)End Sub
Private Sub Times_Click() Operand1 = Val(Display.Caption) Operator = "*" Display.Caption = ""End Sub
INPUT AND OUTPUT:-
Private Sub Command1_Click()Dim a As Single, b As Singlea = CSng(Text1.Text)If (Option1.Value = True) ThenIf (Option5.Value = True) Thena = aText2.Text = aElseIf (Option6.Value = True) Thenb = a / 46Text2.Text = bElseIf (Option7.Value = True) Thenb = a / 55Text2.Text = bElseIf (Option8.Value = True) Thenb = a / 70Text2.Text = bEnd IfEnd IfEnd IfEnd IfEnd IfIf (Option2.Value = True And Option5.Value = True) Thenb = a * 46Text2.Text = bEnd IfIf (Option2.Value = True And Option6.Value = True) Thenb = aText2.Text = bEnd IfIf (Option2.Value = True And Option7.Value = True) Thenb = a * 1.19Text2.Text = bEnd IfIf (Option2.Value = True And Option8.Value = True) Thenb = a * 1.34Text2.Text = bEnd If
Program No. : - 2Name: - Gaurav Saxena Roll No. : - 1308727Class: - MCA (3rd Sem.) Page No. :-_______Statement: - Write a Program to design an interface using option buttons & frame control for Currency Conversion System.
If (Option3.Value = True And Option5.Value = True) Thenb = a * 55Text2.Text = bEnd IfIf (Option3.Value = True And Option6.Value = True) Thenb = a / 1.19Text2.Text = bEnd IfIf (Option3.Value = True And Option7.Value = True) Thenb = aText2.Text = bEnd IfIf (Option3.Value = True And Option8.Value = True) Thenb = a / 1.21Text2.Text = bEnd IfIf (Option4.Value = True And Option5.Value = True) Thenb = a * 70Text2.Text = bEnd IfIf (Option4.Value = True And Option6.Value = True) Thenb = a * 1.32Text2.Text = bEnd IfIf (Option4.Value = True And Option7.Value = True) Thenb = a * 1.21Text2.Text = bEnd IfIf (Option4.Value = True And Option8.Value = True) Thenb = aText2.Text = bEnd IfEnd Sub
Private Sub Command2_Click()Text1.Text = " "Text2.Text = " "End Sub
Private Sub Command3_Click()EndEnd Sub
Output:-
Private Sub Form_Load()Combo1.AddItem "Pascal"Combo1.AddItem "Fortran"Combo1.AddItem "Basic"Combo1.AddItem "C"Combo1.AddItem "C++"Combo1.AddItem "Visual Basic"Combo1.AddItem "Visual C++"Combo1.AddItem "Java"Combo1.Text = "Front End Tools"Combo2.AddItem "MS-Access"Combo2.AddItem "Oracle"Combo2.AddItem "SQL Server"Combo2.AddItem "Sybase"Combo2.AddItem "Ingres"Combo2.AddItem "Unify"Combo2.AddItem "IBM DB2"Combo2.AddItem "MY SQL"Combo2.Text = "Back End Tools"End Sub
Private Sub Combo1_Click()List1.AddItem Combo1.List(Combo1.ListIndex)End Sub
Private Sub Combo2_Click()List1.AddItem Combo2.List(Combo2.ListIndex)End Sub
Private Sub Command1_Click()If List1.ListCount = 0 Then MsgBox "List Box 1 is Empty" Exit SubEnd If
Program No. : - 3Name: - PANKAJ Roll No. : - 1308755Class: - MCA (3rd Sem.) Page No. :-_______Statement: - Write a Program to design an interface having two list box and perform the following operations on the box:-
1. Shift item from one list to another.2. Shift all items from one list to another.3. Copy any selected item to another list box.4. Copy all items to another list box.5. Drag items from one list box to another.
If List1.ListIndex < 0 Then MsgBox "Please Select Any Item from List1"Else List2.AddItem List1.List(List1.ListIndex) List1.RemoveItem List1.ListIndexEnd IfEnd Sub
Private Sub Command2_Click() If List1.ListCount = 0 Then MsgBox "List Box 1 is Empty" Exit Sub End If
While List1.ListCount <> 0 List2.AddItem List1.List(List1.Selected(0)) List1.RemoveItem List1.Selected(0) WendEnd Sub
Private Sub Command3_Click()If List2.ListCount = 0 Then MsgBox "List Box 2 is Empty" Exit SubEnd If
If List2.ListIndex < 0 Then MsgBox "Please Select Any Item from List2"Else List1.AddItem List2.List(List2.ListIndex) List2.RemoveItem List2.ListIndexEnd IfEnd Sub
Private Sub Command4_Click() If List2.ListCount = 0 Then MsgBox "List Box 2 is Empty" Exit Sub End If
While List2.ListCount <> 0 List1.AddItem List2.List(List2.Selected(0)) List2.RemoveItem List2.Selected(0) WendEnd Sub
Output
Output:-
Dim cn As ADODB.ConnectionDim rs As ADODB.RecordsetDim rs1 As ADODB.RecordsetPrivate Sub cmdadd_Click()txtroll.Text = " "txtname.Text = " "txtmarks.Text = " "txtroll.SetFocusEnd SubSub display()txtroll.Text = rs.Fields(0)txtname.Text = rs.Fields(1)txtmarks.Text = rs.Fields(2)End Sub
Private Sub cmddelete_Click()Dim sql As StringDim s As Integers = InputBox("enter the roll no to be deleted")sql = "delete from student719 where rollno=" & CInt(s)cn.Execute (sql)MsgBox "1 record deleted"Call recordset_refreshEnd Sub
Private Sub cmdexit_Click()EndEnd Sub
Private Sub cmdfirst_Click()rs.MoveFirstCall displayEnd Sub
Program No. : -11 Name: - Gaurav Saxena Roll No. : - 1308727Class: - MCA (3rd Sem.) Page No. :-_______Statement: - Design an application which display following information of a student(using oracle) like stud_rollno, stud_regno, stud_name, stud_address, stud_contactno, stud_class, marks in 5 different subjects, total and percentage. Also perform following operations using ADODB:
a) Insert a new record.b) Delete a record.c) Modify/update a record.d) Search a record.
Private Sub cmdlast_Click()rs.MoveLastCall displayEnd Sub
Private Sub cmdmodify_Click()Dim i As Integeri = InputBox("enter the roll no to be deleted")rs.MoveFirstWhile rs.EOFIf rs.Fields(0) = i Thenmodify1Exit SubEnd Ifrs.MoveNextWendEnd Sub
Private Sub cmdnext_Click()rs.MoveNextIf rs.EOF Thenrs.MovePreviousEnd IfCall displayEnd Sub
Private Sub cmdprev_Click()rs.MovePreviousIf rs.BOF Then rs.MoveFirstCall displayEnd Sub
Private Sub cmdsave_Click()Dim sql As Stringsql = "insert into student719 values(" & CInt(txtroll.Text) & ",'" & txtname.Text & "'," & CSng(txtmarks.Text) & ")"cn.Execute (sql)MsgBox "1 record created"Call recordset_refreshtxtroll.Text = " "txtname.Text = " "txtmarks.Text = " "txtroll.SetFocusEnd Sub
Private Sub Form_Load()Set cn = New ADODB.Connectioncn.ConnectionString = "provider=msdaora.1;password=tiger;user id=scott;data source=oracle"cn.OpenCall recordset_refreshMsgBox "connection created"End SubSub recordset_refresh()Set rs = New ADODB.Recordsetrs.Open "select * from student719", cn, adOpenKeyset, adLockOptimisticEnd SubSub modify1()txtroll.Text = rs.Fields(0)txtname.Text = rs.Fields(1)txtmarks.Text = rs.Fields(2)End Sub
Output:-
Private Sub Command1_Click()Text11.Text = (Val(Text7.Text) + Val(Text8.Text) / 100 + Val(Text8.Text) / 100) - Val(Text10.Text)Text12.Text = Val(Text10.Text) * 20 / 100End Sub
Private Sub Command2_Click()Data1.Recordset.MoveFirstText8.Text = ""Text9.Text = ""Text10.Text = ""Text11.Text = ""Text12.Text = ""End Sub
Private Sub Command3_Click()Data1.Recordset.MovePreviousIf Data1.Recordset.BOF = True ThenData1.Recordset.MoveLastEnd IfText8.Text = ""Text9.Text = ""Text10.Text = ""Text11.Text = ""Text12.Text = ""End Sub
Private Sub Command4_Click()Data1.Recordset.MoveNextIf Data1.Recordset.EOF = True ThenData1.Recordset.MoveFirst
Program No. : - 10Name: - Gaurav Saxena Roll No. : - 1308727Class: - MCA (3rd Sem.) Page No. :-_______Statement: - : Use DAO(Data Access Object) to connect the applications with database(in MS ACCESS) named ‘employee’ having table ‘emp_info’ with fields emp_id, emp_name, basic_salary, house rent allowance, provident fund, dearance allowance, net_salary,tax. Also performs operations as given below:
a) Insert a new record.b) Delete a record.c) Modify/update a record.d) Move on first, next, previous and last record.
End IfText8.Text = ""Text9.Text = ""Text10.Text = ""Text11.Text = ""Text12.Text = ""End Sub
Private Sub Command5_Click()Data1.Recordset.MoveLastText8.Text = ""Text9.Text = ""Text10.Text = ""Text11.Text = ""Text12.Text = ""End Sub
Private Sub Command6_Click()Data1.Recordset.AddNewText8.Text = ""Text9.Text = ""Text10.Text = ""Text11.Text = ""Text12.Text = ""End Sub
Private Sub Command7_Click()Data1.Recordset.UpdateMsgBox ("Record Successfully Update")End Sub
Private Sub Command8_Click()Data1.Recordset.DeleteMsgBox ("Record Successfully Deleted")End Sub
Private Sub Command9_Click()EndEnd Sub
Private Sub Command10_Click()EndEnd Sub
Output:-
Dim con As ADODB.ConnectionDim rs As ADODB.Recordset
Private Sub Form_Load()Set cn = New ADODB.ConnectionSet rs = New ADODB.Recordsetcn.ConnectionString = "provider=microsoft.jet.oledb.4.0;Data Source=d:\book.mdb"cn.Openrs.Open "Select * from book1", cn, adOpenStatic, adLockOptimisticr = 1MSFlexGrid1.TextMatrix(0, 1) = "Book Code"MSFlexGrid1.TextMatrix(0, 2) = "Book Name"MSFlexGrid1.TextMatrix(0, 3) = "publisher"MSFlexGrid1.TextMatrix(0, 4) = "Price"MSFlexGrid1.TextMatrix(0, 5) = "Subject"MSFlexGrid1.TextMatrix(0, 6) = "Edition"
While Not rs.EOF For f = 0 To 5 MSFlexGrid1.TextMatrix(r, f + 1) = rs.Fields(f) Next rs.MoveNext r = r + 1 WendEnd Sub
Program No. : - 12Name: - Gaurav Saxena Roll No. : - 1308727Class: - MCA (3rd Sem.) Page No. :-_______Statement: - Write a program to create book database and prepare report using Microsoft flex grid
control.
OUTPUT:
Form1
Private Sub Command1_Click()CommonDialog1.Filter = "Text files(*.txt)|*.txt"CommonDialog1.ShowOpenRichTextBox1.FileName = CommonDialog1.FileNameRichTextBox1.SetFocusExit SubEnd Sub
Private Sub Command2_Click()test = MsgBox("You Really Want To Save File ?", _vbYesNo + vbQuestion, "Acknowledgement")If test = vbYes ThenCommonDialog1.DefaultExt = "txt"'CommonDialog1.Filter = "Text files(*.txt)|*.txt"CommonDialog1.ShowSaveRichTextBox1.SaveFile (CommonDialog1.FileName)End IfRichTextBox1.SetFocusEnd Sub
Private Sub Command3_Click()CommonDialog1.Flags = cdlCFBoth + cdlCFEffectsCommonDialog1.ShowFontRichTextBox1.SelFontName = CommonDialog1.FontNameRichTextBox1.SelFontSize = CommonDialog1.FontSizeRichTextBox1.SelBold = CommonDialog1.FontBoldRichTextBox1.SelItalic = CommonDialog1.FontItalicRichTextBox1.SetFocusEnd Sub
Private Sub Command4_Click()CommonDialog1.ShowColorRichTextBox1.SelColor = CommonDialog1.ColorRichTextBox1.SetFocusEnd Sub
Private Sub Command5_Click()Unload MeEnd Sub
Program No. : - 4Name: - Gaurav Saxena Roll No. : - 1308727Class: - MCA (3rd Sem.) Page No. :-_______Statement: - Design a notepad applications using common dialog control with complete menus coding.
Private Sub Copy_Click()Clipboard.SetText Common_Dialog.RichTextBox1.SelTextPaste.Enabled = TrueEnd Sub
Private Sub Cut_Click()Clipboard.SetText Common_Dialog.RichTextBox1.SelTextCommon_Dialog.RichTextBox1.SelText = ""Paste.Enabled = TrueEnd Sub
Private Sub Exit_Click()EndEnd Sub
Private Sub Fomt_Click()CommonDialog1.Flags = cdlCFBoth + cdlCFEffectsCommonDialog1.ShowFontRichTextBox1.SelFontName = CommonDialog1.FontNameRichTextBox1.SelFontSize = CommonDialog1.FontSizeRichTextBox1.SelBold = CommonDialog1.FontBoldRichTextBox1.SelItalic = CommonDialog1.FontItalicRichTextBox1.SetFocusEnd Sub
Private Sub Open_Click()CommonDialog1.Filter = "Text files(*.txt)|*.txt"CommonDialog1.ShowOpenRichTextBox1.FileName = CommonDialog1.FileNameRichTextBox1.SetFocusExit SubEnd Sub
Private Sub Paste_Click()Common_Dialog.RichTextBox1 = Clipboard.GetTextEnd Sub
Private Sub Save_Click()test = MsgBox("You Really Want To Save File ?", _vbYesNo + vbQuestion, "Acknowledgement")If test = vbYes ThenCommonDialog1.DefaultExt = "txt"CommonDialog1.Filter = "Text files(*.txt)|*.txt"CommonDialog1.ShowSaveRichTextBox1.SaveFile (CommonDialog1.FileName)
End IfRichTextBox1.SetFocusEnd Sub
Private Sub Saveas_Click()CommonDialog1.ShowSaveEnd Sub
Output
Dim rtitems As VariantPrivate Sub Command1_Click()rtitems = rtitems + 1Load Gaurav(rtitems)Gaurav(rtitems).Caption = "dynamic menu item#" & Str(rtitems)End Sub
Private Sub Command2_Click()If rtitems = 0 ThenMsgBox "menu is already empty"ElseUnload Gaurav(rtitems)rtitems = rtitems - 1End IfEnd Sub
Private Sub fillmenu()Dim i As IntegerCall emptymenuFor i = 1 To 3Load mnufileslist(i)mnufileslist(i).Caption = "file" & iNext imnufileslist(0).Visible = FalseEnd Sub
Private Sub emptymenu()Dim i As Integermnufileslist(0).Visible = TrueFor i = 1 To mnufileslist.UBoundUnload mnufileslist(i)Next iEnd Sub
Private Sub exit1_Click()Unload MeEnd Sub
Program No. : - 5Name: - Gaurav Saxena Roll No. : - 1308727Class: - MCA (3rd Sem.) Page No. :-_______Statement: - Write a program to demonstrate dynamic menus appearance (i.e. add and remove the menus at runtime).
Output:-
Dim a As IntegerPrivate Sub Form_Load()Timer2.Enabled = Falsea = 0End Sub
Private Sub Timer1_Timer()If a <= 5 Thensb1.Panels(1) = Time()a = a + 1Else
sb1.Panels(1) = ""Timer1.Enabled = Falsea = 0Timer2.Enabled = TrueEnd IfEnd Sub
Private Sub Timer2_Timer()If a <= 5 Thensb1.Panels(2) = Datea = a + 1Else
sb1.Panels(2) = ""Timer1.Enabled = Truea = 0Timer2.Enabled = FalseEnd IfEnd Sub
Program No. : - 9Name: - Gaurav Saxena Roll No. : - 1308727Class: - MCA (3rd Sem.) Page No. :-_______Statement: - Write a program to display date and time in a panel of status bar alternatively with an interval of 5 seconds using timer control.
Output:-
Dim a As Double, l As Integer, m As DoubleDim temp As StringPrivate Sub once(x As Double)Select Case (x)Case 1: ch = "One "Case 2: ch = "Two "Case 3: ch = "Three "Case 4: ch = "Four "Case 5: ch = "Five "Case 6: ch = "Six "Case 7: ch = "Seven "Case 8: ch = "Eight "Case 9: ch = "Nine "Case 10: ch = "Ten "Case 11: ch = "Eleven "Case 12: ch = "Twelve "Case 13: ch = "Thirteen "Case 14: ch = "Fourteen "Case 15: ch = "Fifteen "Case 16: ch = "Sixteen "Case 17: ch = "Seventeen "Case 18: ch = "Eighteen "
Program No. : - 6Name: - Gaurav Saxena Roll No. : - 1308727Class: - MCA (3rd Sem.) Page No. :-_______Statement: - Write a program to convert a number into its text form.
Case 19: ch = "Nineteen "End SelectText2.Text = Text2.Text & chEnd Sub
Private Sub tens(x As Double)Select Case (x)Case 2: ch = "Twenty "Case 3: ch = "Thirty "Case 4: ch = "Fourty "Case 5: ch = "Fifty "Case 6: ch = "Sixty "Case 7: ch = "Seventy "Case 8: ch = "Eighty "Case 9: ch = "Ninety "End SelectText2.Text = Text2.Text & chEnd Sub
Private Sub gets(mm As Double)If mm <= 19 Then Call once(mm)Else Call tens(Mid(mm, 1, 1)) Call once(Mid(mm, 2, 1))End IfEnd Sub
Private Sub Command1_Click()a = Text1.TextText1.Text = al = Len(Text1.Text)
If a > 10000000 Then MsgBox "Please Enter Upto 1 Crore" Text1.Text = Empty
Text2.Text = Empty Exit SubElseIf a = 10000000 Then Text2.Text = "1 Crore" Exit SubEnd If
abc:Select Case (l)Case 7: m = Left(a, 2) gets (m) message (6) a = Mid(a, 3, 5) temp = a l = Len(temp) GoTo abc Case 6: Call once(Left(a, 1)) message (6) a = Mid(a, 2, 5) temp = a l = Len(temp) GoTo abc Case 5: m = Left(a, 2) gets (m) message (4) a = Mid(a, 3, 3) temp = a l = Len(temp) GoTo abc Case 4: Call once(Left(a, 1)) message (4) a = Mid(a, 2, 3) temp = a l = Len(temp) GoTo abc Case 3: Call once(Left(a, 1)) Call message(3)
m = Mid(a, 2, 2) gets (m) Case 2: gets (a) Case 1: Call once(a) End Select End Sub
Private Sub message(i As Integer)Select Case (i)Case 6: Text2.Text = Text2.Text & "Lakhs "Case 4: Text2.Text = Text2.Text & "Thousand "Case 3: Text2.Text = Text2.Text & "Hundred "End SelectEnd Sub
Private Sub Command2_Click()Text1.Text = EmptyText2.Text = EmptyText1.SetFocusEnd Sub
Output:-
Top Related