vb file

46
Gurpreet Singh 0702051

description

ok

Transcript of vb file

CODING OF ADODCPrivate Sub Command1_Click()

Adodc1.Recordset.MoveNext

End Sub

Private Sub Command2_Click()

Adodc1.Recordset.MovePrevious

End Sub

Private Sub Command3_Click()

Adodc1.Recordset.MoveLast

End Sub

Private Sub Command4_Click()

Adodc1.Recordset.MoveFirst

End Sub

Private Sub Text1_Change()

Text1.BackColor = vbRed

End Sub

Private Sub Text2_Change()

Text2.BackColor = vbYellow

End Sub

CODING OF FILE CONTROLPrivate Sub Dir1_Change()

File1.Path = Dir1.Path

End Sub

Private Sub Drive1_Change()

Dir1.Path = Drive1.Drive

End Sub

CODING OF MDIFORMPrivate Sub MDIEXIT_Click()

Unload MDIForm1

End

End Sub

Private Sub MDINEW_Click()

Dim WINDEX As Integer

WINDEX = FindFree()

If WINDEX = -1 Then

MsgBox "u mst close doc before_another one cn be opened"

Exit Sub

End If

Load Documentforms(WINDEX)

Load Documentforms(WINDEX).Caption = "new doc"

Documentforms(WINDEX).Tag = WINDEX

Documentforms(WINDEX).Show

End

End Sub

Private Sub MDIOPEN_Click()

MDIForm1.MDIOPEN_Click

End Sub

CODING OF NOTEPAD

Dim color

Private Sub ecopy_Click()

Clipboard.SetText Text1.SelText

End Sub

Private Sub ecut_Click()

Clipboard.SetText Text1.SelText

Text1.SelText = " "

End Sub

P rivate Sub epaste_Click()

If Clipboard.GetFormat(vbCFText) Then

Text1.SelText = Clipboard.GetText

Else

MsgBox "invalid clipboard format"

End If

End Sub

Private Sub fnew_Click()

Text1.Text = " "

End Sub

Private Sub fopen_Click()

CommonDialog1.ShowOpen

FileName = CommonDialog1.FileName

End Sub

Private Sub fsaveas_Click()

CommonDialog1.ShowSave

FileName = CommonDialog1.FileName

End Sub

Private Sub mnucolor_Click()

CommonDialog1.ShowColor

color = CommonDialog1.color

Text1.BackColor = color

End Sub

Private Sub mnufind_Click()

a = InputBox("enter string to be find")

Text1.SelStart = InStr(Text1.Text, a) - 1

Text1.SelLength = Len(a)

End Sub

Private Sub mnufont_Click()

CommonDialog1.Flags = cdlCFBoth

CommonDialog1.ShowFont

Text1.FontName = CommonDialog1.FontName

Text1.FontBold = CommonDialog1.FontBold

Text1.FontItalic = CommonDialog1.FontItalic

Text1.FontSize = CommonDialog1.FontSize

End Sub

Private Sub mnuprinter_Click()

CommonDialog1.ShowPrinter

Copies = CommonDialog1.Copies

ToPage = CommonDialog1.ToPage

FromPage = CommonDialog1.FromPage

End Sub

Private Sub mnureplace_Click()

b = InputBox("enter string to be found")

Text1.SelText = b

End Sub

Private Sub Command1_Click()

Adodc1.Recordset.AddNew

MsgBox "NOW FILL THE NEW RECORD"

End Sub

Private Sub Command2_Click()

Adodc1.Recordset.Update

MsgBox "THE NEW RECORD IS SAVED"

End Sub

Private Sub Command3_Click()

On Error Resume Next

Adodc1.Recordset.Delete

MsgBox "RECORD IS SUCESSFULLY DELETED"

End Sub

Private Sub Command4_Click()

Form3.Show

End Sub

Private Sub Command5_Click()

On Error Resume Next

Adodc1.Recordset.MoveLast

End Sub

Private Sub Command6_Click()

On Error Resume Next

Adodc1.Recordset.MovePrevious

End Sub

Private Sub Command7_Click()

Adodc1.Recordset.MoveFirst

If Data1.Recordset.BOF Then

Data1.Recordset.MovePrevious

End If

End Sub

Private Sub Command8_Click()

On Error Resume Next

Adodc1.Recordset.MoveNext

If Data1.Recordset.EOF Then

Data1.Recordset.MoveLast

End If

End Sub

Private Sub Form_Load()

Form1.WindowState = 2

End Sub

CODING OF PIE CHART

Private Sub Command1_Click()

Dim piedata(10) As Integer

Form1.Cls

For i = 0 To 9

piedata(i) = 20 + Rnd() * 100

total = total + piedata(i)

Next

Form1.DrawWidth = 2

For i = 0 To 9

arc1 = arc2

arc2 = arc1 + 6.28 * piedata(i) / total

If Check1.Value Then

Form1.FillStyle = 2 + (i Mod 5)

Else

Form1.FillStyle = 0

End If

If Check2.Value Then

Form1.FillColor = QBColor(8 + (i Mod 6))

Else

Form1.FillColor = QBColor(9)

End If

Form1.Circle (Form1.ScaleWidth / 2, Form1.ScaleHeight / 2), _

Form1.ScaleHeight / 2.5, , -arc1, -arc2

Next

End Sub

CODING OF SELECT CASEPrivate Sub Command1_Click()

marks = Text1.Text

Select Case marks

Case Is >= 90

MsgBox "Grade A"

Case Is >= 80

MsgBox "GRADE B"

Case Is >= 70

MsgBox "GRADE C"

Case Is >= 60

MsgBox "GRADE D"

Case Is >= 50

MsgBox "GRADE E"

Case Else

MsgBox "FAIL"

End Select

End Sub

Private Sub Command2_Click()

Text1.Text = ""

End Sub

Gurpreet Singh

0702051