0% found this document useful (0 votes)
66 views11 pages

Visual Basic Programming Guide

This document contains code snippets for several Visual Basic programs, including: 1) A Fibonacci series generator that prints the terms of the Fibonacci sequence up to a given number. 2) A factorial function that calculates and returns the factorial of a given integer. 3) A multiplication table generator that prints the multiplication table for a given number. 4) A basic calculator program that calculates sine, cosine, and tangent functions. 5) An employee details form that adds new records to an employee database table.

Uploaded by

Alana Peterson
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
66 views11 pages

Visual Basic Programming Guide

This document contains code snippets for several Visual Basic programs, including: 1) A Fibonacci series generator that prints the terms of the Fibonacci sequence up to a given number. 2) A factorial function that calculates and returns the factorial of a given integer. 3) A multiplication table generator that prints the multiplication table for a given number. 4) A basic calculator program that calculates sine, cosine, and tangent functions. 5) An employee details form that adds new records to an employee database table.

Uploaded by

Alana Peterson
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

FIBONARIC SERIES

Private Sub Command1_Click() Dim x, g, n, i, sum As Integer n = Val([Link]) x=0 y=1 Print x Print y For i = 3 To n sum = x + y Print sum x=y y = sum y = sum Next i End Sub

OUTPUT

FACTORIAL

Private Sub Command1_Click() Dim j, i as Integer i = CInt([Link]) [Link] = facts(i) End Sub Private Function facts(i) F=1 For j = 1 To i F=F*j facts = F Next j End Function

OUTPUT

MULITIPLICATION TABLE

Dim a, n, i As Integer Private Sub Command1_Click() n = Val([Link]) For i = 1 To 10 a=n*i [Link] n & "*" & i & " = " & a Next i End Sub

OUTPUT

CALCULATOR

Private Sub Command1_Click(index As Integer) Select Case index Dim x As Double Case 0 x = Val([Link]) [Link] = Round((Sin(x * 3.14159265 / 180)), 4) Case 1 x = Val([Link]) [Link] = Round((Cos(x * 3.14159265 / 180)), 4) Case 2 x = Val([Link]) [Link] = Round((Tan(x * 3.14159265 / 180)), 4) End Select End Sub

OUTPUT

EMPLOYEE DETAILS

Private Sub Command1_Click() Call createConnection With rs .ActiveConnection = cnn .LockType = adLockOptimistic .CursorType = adOpenDynamic .Source = "Select*From emp" .Open End With [Link] [Link](0) = CInt([Link]) [Link](1) = [Link] [Link](2) = [Link] [Link](3) = [Link] [Link](4) = [Link] [Link] [Link] Call clear [Link] End Sub

OUTPUT

VISUAL BASIC LAB

You might also like