Coding in Asp

Download as rtf, pdf, or txt
Download as rtf, pdf, or txt
You are on page 1of 25

Public Class Form1 Dim a, b, c As Double Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click If (TextBox1.

Text = " " Or IsNumeric(TextBox1.Text) = False) Then MsgBox("Pls Enter Value or Only Numeric Value") TextBox1.Focus() Exit Sub End If If (TextBox2.Text = " " Or IsNumeric(TextBox2.Text) = False) Then MsgBox("Pls Enter Value or Only Numeric Value") TextBox2.Focus() Exit Sub End If a = TextBox1.Text b = TextBox2.Text c = a + b TextBox3.Text = c End Sub Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click a = TextBox1.Text b = TextBox2.Text c = a - b TextBox3.Text = c End Sub Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click a = TextBox1.Text b = TextBox2.Text c = a / b TextBox3.Text = c End Sub Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click a = TextBox1.Text b = TextBox2.Text c = a * b TextBox3.Text = c End Sub Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load End Sub End Class

================================================================= ===============

Public Class Form2 Dim n1, n2 As Double Dim op As String Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click, Button2.Click, Button3.Click, Button4.Click, Button5.Click, Button6.Click, Button7.Click, Button8.Click, Button9.Click, Button10.Click Label1.Text += sender.text.ToString End Sub Private Sub Button11_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button11.Click n1 = Val(Label1.Text) op = "+" Label1.Text = "" End Sub Private Sub Button12_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button12.Click n1 = Val(Label1.Text) op = "-" Label1.Text = "" End Sub Private Sub Button13_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button13.Click n1 = Val(Label1.Text) op = "*" Label1.Text = "" End Sub Private Sub Button14_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button14.Click n1 = Val(Label1.Text) op = "/" Label1.Text = "" End Sub Private Sub Button15_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button15.Click n2 = Val(Label1.Text) If (op = "+") Then Label1.Text = n1 + n2 End If If (op = "-") Then

Label1.Text = n1 - n2 End If If (op = "*") Then Label1.Text = n1 * n2 End If If (op = "/") Then Label1.Text = n1 / n2 End If End Sub Private Sub Button16_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button16.Click Label1.Text += "." End Sub Private Sub Button17_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button17.Click Label1.Text = Math.Sqrt(Label1.Text) End Sub Private Sub Button18_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button18.Click Label1.Text = (-1) * Label1.Text End Sub Private Sub Form2_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load End Sub End Class ================================================================= =============== Public Class Form3 Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim i As Integer i = MsgBox("You Want Exit?", MsgBoxStyle.Information + MsgBoxStyle.YesNo + MsgBoxStyle.DefaultButton2, "Exit") If (i = MsgBoxResult.Yes) Then Me.Dispose() End If End Sub Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click MsgBox("Record Successfuly Save.") End Sub

Private Sub Form3_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles Me.KeyDown MsgBox(e.KeyValue) 'If (e.KeyValue = 27) Then '27 for exit ' Button1_Click(sender, e) 'End If 'If (e.KeyValue = 113) Then '113 for f2 key ' Button2_Click(sender, e) 'End If 'If (e.KeyValue = 114) Then ' Form2.Show() 'End If End Sub

Private Sub Form3_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load End Sub Private Sub Form3_MouseEnter(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.MouseEnter Me.BackColor = Color.Crimson End Sub Private Sub Form3_MouseLeave(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.MouseLeave Me.BackColor = Color.Chocolate End Sub End Class ================================================================= ============== Public Class Form4 Private Sub TextBox1_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles TextBox1.KeyPress Dim i As Integer i = Asc(e.KeyChar) If (i = 8) Then Exit Sub End If If i = 13 Then SendKeys.Send("{Tab}") Exit Sub End If If (i < 47 Or i > 58) Then MsgBox("only 0 to 9 enter") e.Handled = True

End If End Sub Private Sub TextBox2_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles TextBox2.KeyPress Dim i As Integer i = Asc(e.KeyChar) End Sub Private Sub Form4_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load End Sub End Class ================================================================= ============= Public Class Form6 Private Sub Button1_MouseEnter(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.MouseEnter Button1.ForeColor = Color.Red End Sub Private Sub Button1_MouseLeave(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.MouseLeave Button1.ForeColor = Color.Black End Sub Private Sub CheckBox1_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckBox1.CheckedChanged If CheckBox1.Checked = True Then MsgBox("You Select " & CheckBox1.Text) End If End Sub Private Sub CheckBox2_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckBox2.CheckedChanged If CheckBox2.Checked = True Then MsgBox("You Select " & CheckBox2.Text) End If End Sub Private Sub Form6_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load End Sub End Class

================================================================= =============== Public Class Form7 Private Sub RadioButton1_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RadioButton1.CheckedChanged If RadioButton1.Checked = True Then TextBox2.Text = TextBox1.Text * 5 / 100 End If End Sub Private Sub RadioButton2_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RadioButton2.CheckedChanged If RadioButton2.Checked = True Then TextBox2.Text = TextBox1.Text * 10 / 100 End If End Sub Private Sub RadioButton3_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RadioButton3.CheckedChanged If RadioButton3.Checked = True Then TextBox2.Text = TextBox1.Text * 15 / 100 End If End Sub Private Sub RadioButton4_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RadioButton4.CheckedChanged If RadioButton4.Checked = True Then TextBox2.Text = TextBox1.Text * 20 / 100 End If End Sub Private Sub Form7_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load End Sub End Class ================================================================= ============== Public Class Form8 Private Sub TextBox1_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles TextBox1.KeyPress

Dim i As Integer i = Asc(e.KeyChar) If (i = 8 Or i = 32) Then Exit Sub End If If (i = 13) Then SendKeys.Send("{Tab}") Exit Sub End If If (i >= 65 And i <= 90) Or (i >= 97 And i <= 122) Then e.Handled = False Else e.Handled = True End If End Sub Private Sub TextBox1_(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox1.TextChanged End Sub Private Sub Form8_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Me.Text = "Validiation Form" End Sub End Class ================================================================= =============== Public Class Form9 Private Sub TextBox1_GotFocus(ByVal sender As Object, ByVal e As System.EventArgs) Handles TextBox1.GotFocus, TextBox2.GotFocus, TextBox3.GotFocus sender.BackColor = Color.Yellow sender.ForeColor = Color.Red End Sub Private Sub TextBox1_LostFocus(ByVal sender As Object, ByVal e As System.EventArgs) Handles TextBox1.LostFocus, TextBox2.LostFocus, TextBox3.LostFocus sender.BackColor = Color.White sender.ForeColor = Color.Black End Sub Private Sub Form9_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load End Sub End Class

================================================================= =============== Public Class Form11 Private Sub Form11_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load ComboBox1.Items.Add("Dinesh") ComboBox1.Items.Add("Subhash") ComboBox1.Items.Add("Tarun") ComboBox1.Items.Add("Vikas") ComboBox1.Items.Add("Vishal") End Sub Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click ComboBox1.Items.Add(TextBox1.Text) End Sub Private Sub ComboBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ComboBox1.SelectedIndexChanged 'TextBox1.Text = ComboBox1.SelectedItem TextBox1.Text = ComboBox1.Items(ComboBox1.SelectedIndex) End Sub Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click TextBox1.Text = ComboBox1.SelectedIndex End Sub Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click TextBox1.Text = ComboBox1.Items.Count End Sub Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click Dim i As Integer i = MsgBox("You want Delete?", MsgBoxStyle.Question + MsgBoxStyle.YesNo, "Delete") If (i = MsgBoxResult.Yes) Then ComboBox1.Items.RemoveAt(ComboBox1.SelectedIndex) End If End Sub Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click ComboBox1.Items.Clear() End Sub End Class

================================================================= =============== Public Class Form12 Private Sub Form12_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load ListBox1.Items.Add("Dinesh") ListBox1.Items.Add("Vijay") ListBox1.Items.Add("Tarun") ListBox1.Items.Add("Rakesh") ListBox1.Items.Add("Subhash") ListBox1.Items.Add("Vikram") ListBox1.Items.Add("Ajay") ListBox1.Items.Add("Deepak") ListBox1.Items.Add("Amer") ListBox1.Items.Add("Alok") ListBox1.Items.Add("Chandresh") ListBox1.Items.Add("Dharmesh") ListBox1.Items.Add("Pradeep") End Sub Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click If (ListBox1.SelectedIndex = -1) Then MsgBox("Please Select Item", MsgBoxStyle.Critical, "Error") Exit Sub End If ListBox2.Items.Add(ListBox1.Items(ListBox1.SelectedIndex) ) ListBox1.Items.RemoveAt(ListBox1.SelectedIndex) End Sub Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim i As Integer For i = 0 To ListBox1.Items.Count - 1 ListBox2.Items.Add(ListBox1.Items(i)) Next ListBox1.Items.Clear() End Sub Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click ListBox1.Items.Add(ListBox2.Items(ListBox2.SelectedIndex) ) ListBox2.Items.RemoveAt(ListBox2.SelectedIndex) End Sub Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click

Dim i As Integer For i = 0 To ListBox2.Items.Count - 1 ListBox1.Items.Add(ListBox2.Items(i)) Next ListBox2.Items.Clear() End Sub End Class ================================================================= =============== Public Class Form13 Private Sub Form13_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load ListBox1.Items.Add("Ram") ListBox1.Items.Add("Shyam") ListBox1.Items.Add("Mohan") ListBox1.Items.Add("Ganesh") ListBox1.Items.Add("Shiva") ListBox1.Items.Add("Mahesh") ListBox1.Items.Add("Krishna") ListBox1.Items.Add("Govind") ListBox1.Items.Add("Bharat") ListBox1.Items.Add("Rohan") ListBox1.Items.Add("Pratap") End Sub Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim i As Integer Dim flag As Integer flag = 0 For i = 0 To ListBox1.Items.Count - 1 If (ListBox1.Items(i).ToString = TextBox1.Text) Then flag = 1 Exit For End If Next If (flag = 0) Then ListBox1.Items.Add(TextBox1.Text) Else MsgBox("Dulicate Entry Try again.........") End If End Sub End Class ================================================================= =============== Public Class Form14

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim ename As String If (RadioButton1.Checked = True) Then ename = "Mr. " + TextBox1.Text ElseIf (RadioButton2.Checked = True And CheckBox1.Checked = True) Then ename = "Mrs. " + TextBox1.Text Else ename = "Miss. " + TextBox1.Text End If ListBox1.Items.Add(ename) End Sub Private Sub Form14_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load End Sub End Class ================================================================= =============== Public Class Form15 Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim i As Integer For i = 0 To CheckedListBox1.Items.Count - 1 If CheckedListBox1.GetItemChecked(i) = True Then CheckedListBox2.Items.Add(CheckedListBox1.Items(i )) End If Next End Sub Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click Dim i As Integer For i = 0 To CheckedListBox1.Items.Count - 1 CheckedListBox1.SetItemChecked(i, True) Next End Sub Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click Dim i As Integer For i = 0 To CheckedListBox1.Items.Count - 1 CheckedListBox1.SetItemChecked(i, False) Next End Sub Private Sub Button5_Click(ByVal sender As System.Object,

ByVal e As System.EventArgs) Handles Button5.Click Dim i As Integer For i = 0 To CheckedListBox1.Items.Count - 1 If CheckedListBox1.GetItemChecked(i) = True Then CheckedListBox1.SetItemChecked(i, False) Else CheckedListBox1.SetItemChecked(i, True) End If Next End Sub Private Sub Form15_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load End Sub End Class ================================================================= =============== Public Class Form16 Private Sub LinkLabel1_LinkClicked(ByVal sender As System.Object, ByVal e As System.Windows.Forms.LinkLabelLinkClickedEventArgs) Handles LinkLabel1.LinkClicked System.Diagnostics.Process.Start("http://www.visualinfote ch.net") End Sub Private Sub DateTimePicker1_ValueChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles DateTimePicker1.ValueChanged TextBox1.Text = Format(DateTimePicker1.Value.Date, "ddMMM-yyyy") End Sub Private Sub MonthCalendar1_DateChanged(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DateRangeEventArgs) Handles MonthCalendar1.DateChanged TextBox2.Text = MonthCalendar1.SelectionRange.Start.Date TextBox3.Text = MonthCalendar1.SelectionRange.End.Date End Sub Private Sub Form16_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load End Sub End Class

================================================================= ============== Public Class Form17 'Private Sub ExitToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ExitToolStripMenuItem.Click ' Me.Dispose() 'End Sub 'Private Sub NewToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles NewToolStripMenuItem.Click ' RichTextBox1.Text = "" ' RichTextBox1.Focus() 'End Sub 'Private Sub CutToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CutToolStripMenuItem.Click ' RichTextBox1.Cut() 'End Sub 'Private Sub CopyToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CopyToolStripMenuItem.Click ' RichTextBox1.Copy() 'End Sub 'Private Sub PasteToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PasteToolStripMenuItem.Click ' RichTextBox1.Paste() 'End Sub 'Private Sub UndoToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles UndoToolStripMenuItem.Click ' RichTextBox1.Undo() 'End Sub 'Private Sub RedoToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RedoToolStripMenuItem.Click ' RichTextBox1.Redo() 'End Sub Private Sub SaveToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SaveToolStripMenuItem.Click SaveFileDialog1.ShowDialog() RichTextBox1.SaveFile(SaveFileDialog1.FileName)

End Sub 'Private Sub OpenToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles OpenToolStripMenuItem.Click ' OpenFileDialog1.ShowDialog() ' RichTextBox1.LoadFile(OpenFileDialog1.FileName) 'End Sub Private Sub FontToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles FontToolStripMenuItem.Click FontDialog1.ShowDialog() RichTextBox1.SelectionFont = FontDialog1.Font End Sub 'Private Sub BackColorToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BackColorToolStripMenuItem.Click ' ColorDialog1.ShowDialog() ' RichTextBox1.SelectionBackColor = ColorDialog1.Color 'End Sub 'Private Sub ForeColorToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ForeColorToolStripMenuItem.Click ' ColorDialog1.ShowDialog() ' RichTextBox1.SelectionColor = ColorDialog1.Color 'End Sub Private Sub BulltesToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BulltesToolStripMenuItem.Click RichTextBox1.SelectionBullet = Not RichTextBox1.SelectionBullet End Sub Private Sub AligmenetToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles AligmenetToolStripMenuItem.Click RichTextBox1.SelectionAlignment = HorizontalAlignment.Left End Sub Private Sub CenterToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CenterToolStripMenuItem.Click RichTextBox1.SelectionAlignment = HorizontalAlignment.Center End Sub

Private Sub RightToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RightToolStripMenuItem.Click RichTextBox1.SelectionAlignment = HorizontalAlignment.Right End Sub Private Sub PrintDocument1_PrintPage(ByVal sender As System.Object, ByVal e As System.Drawing.Printing.PrintPageEventArgs) Handles PrintDocument1.PrintPage e.Graphics.DrawString(RichTextBox1.Text, Font, Brushes.Black, 300, 150) End Sub Private Sub PrintPreviewToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PrintPreviewToolStripMenuItem.Click PrintPreviewDialog1.Document = PrintDocument1 PrintPreviewDialog1.Show() End Sub Private Sub PrintToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PrintToolStripMenuItem.Click PrintDialog1.Document = PrintDocument1 PrintDialog1.ShowDialog() End Sub Private Sub PrintSetupToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PrintSetupToolStripMenuItem.Click PageSetupDialog1.Document = PrintDocument1 PageSetupDialog1.ShowDialog() End Sub Private Sub HelpToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles HelpToolStripMenuItem.Click Form18.Show() End Sub Private Sub BoldToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BoldToolStripMenuItem.Click RichTextBox1.SelectionFont = New Font(RichTextBox1.Font, FontStyle.Bold) End Sub Private Sub ItalicToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ItalicToolStripMenuItem.Click

RichTextBox1.SelectionFont = New Font(RichTextBox1.Font, FontStyle.Italic) End Sub Private Sub Form17_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load End Sub Private Sub ToolStripButton1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripButton1.Click SaveToolStripMenuItem_Click(sender, e) End Sub Private Sub ToolStripComboBox1_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripComboBox1.Click End Sub Private Sub ToolStripComboBox1_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles ToolStripComboBox1.SelectedIndexChanged RichTextBox1.SelectionFont = New Font(RichTextBox1.SelectionFont.Size, ToolStripComboBox1.SelectedItem) End Sub Private Sub RichTextBox1_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RichTextBox1.TextChanged End Sub End Class ================================================================= ============= Public Class Form18 Private Sub TextBox1_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox1.TextChanged End Sub End Class ================================================================= ============== Public Class Form19

Dim flag As Integer Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick Label1.Visible = Not Label1.Visible If flag = 0 Then Me.BackColor = Color.Azure flag = 1 ElseIf flag = 1 Then Me.BackColor = Color.Beige flag = 2 ElseIf flag = 2 Then Me.BackColor = Color.Cyan flag = 0 End If End Sub Private Sub Timer2_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer2.Tick Label2.Text = Format(Now, "hh:mm:ss") End Sub Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Timer2.Enabled = False End Sub Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click Timer2.Enabled = True End Sub Private Sub Form19_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load End Sub End Class ================================================================= ============== Public Class Form20 Dim i As Integer Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick If (i > ImageList1.Images.Count) Then i = 0 End If PictureBox1.Image = ImageList1.Images(i) i = i + 1 End Sub

Private Sub PictureBox1_MouseEnter(ByVal sender As Object, ByVal e As System.EventArgs) Handles PictureBox1.MouseEnter Timer1.Enabled = False End Sub Private Sub PictureBox1_MouseLeave(ByVal sender As Object, ByVal e As System.EventArgs) Handles PictureBox1.MouseLeave Timer1.Enabled = True End Sub Private Sub Form20_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load End Sub End Class =\=============================================================== =============== Public Class Form21 Dim i As Integer Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick If i > 100 Then Timer1.Enabled = False Form2.Show() Me.Hide() Exit Sub End If ProgressBar1.Value = i i = i + 1 End Sub Private Sub Form21_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load End Sub End Class ================================================================= ============= Public Class Form22 Private Sub TextBox2_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox2.TextChanged End Sub End Class

Public Class Form23 Private Sub Form23_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load End Sub Private Sub TabPage1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TabPage1.Click End Sub End Class

Imports System.Data.OleDb Public Class Form24 Dim OleDbCon As New OleDbConnection Private Sub Form24_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Dim conStr As String conStr = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=D:\student project\VyasProject\employee.mdb" OleDbCon.ConnectionString = conStr OleDbCon.Open() End Sub Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim sqlStr As String Dim OleDbCmd As OleDbCommand Dim tEmpNo, tDeptNo As Integer Dim tSal As Double Dim tEName, tDoj As String tEmpNo = TextBox1.Text tEName = TextBox2.Text tDoj = Format(DateTimePicker1.Value.Date, "MM/dd/yyyy") tDeptNo = TextBox3.Text tSal = TextBox4.Text sqlStr = "INSERT INTO emp VALUES(" & tEmpNo & ",'" & tEName & "','" & tDoj & "'," & tDeptNo & "," & tSal & ")" OleDbCmd = New OleDbCommand(sqlStr, OleDbCon) OleDbCmd.ExecuteNonQuery() MsgBox("Record Successfuly Save") OleDbCmd.Dispose() End Sub Private Sub Button2_Click(ByVal sender As System.Object,

ByVal e As System.EventArgs) Handles Button2.Click Dim tEmpNo, tDeptNo As Integer Dim tSal As Double Dim tEName, tDoj As String tEmpNo = TextBox1.Text tEName = TextBox2.Text tDoj = Format(DateTimePicker1.Value.Date, "MM/dd/yyyy") tDeptNo = TextBox3.Text tSal = TextBox4.Text Dim sqlStr As String Dim OleDbCmd As OleDbCommand sqlStr = "UPDATE emp SET ename='" & tEName & "', doj='" & tDoj & "', deptno=" & tDeptNo & ",sal=" & tSal & " WHERE empno=" & tEmpNo OleDbCmd = New OleDbCommand(sqlStr, OleDbCon) OleDbCmd.ExecuteNonQuery() MsgBox("Record Successfuly Updae") OleDbCmd.Dispose() End Sub Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click Dim tEmpNo As Integer tEmpNo = TextBox1.Text Dim sqlStr As String Dim OleDbCmd As OleDbCommand sqlStr = "DELeTE FROM emp WHERE empno=" & tEmpNo OleDbCmd = New OleDbCommand(sqlStr, OleDbCon) OleDbCmd.ExecuteNonQuery() MsgBox("Record Successfuly Deleted") OleDbCmd.Dispose() End Sub Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click Dim tEmpNo As Integer Dim sqlStr As String Dim OleDbCmd As OleDbCommand Dim OleDbRead As OleDbDataReader tEmpNo = TextBox1.Text sqlStr = "SELECT * FROM emp WHERE empno=" & tEmpNo OleDbCmd = New OleDbCommand(sqlStr, OleDbCon) OleDbRead = OleDbCmd.ExecuteReader If (OleDbRead.HasRows) Then OleDbRead.Read() TextBox2.Text = OleDbRead.Item("ename") DateTimePicker1.Value = OleDbRead.Item("doj") TextBox3.Text = OleDbRead.Item("deptno")

TextBox4.Text = OleDbRead.Item("sal") Else MsgBox("Record not found") End If OleDbCmd.Dispose() OleDbRead.Close() End Sub End Class

Imports System.Data.OleDb Public Class Form25 Dim OleDbcon As New OleDbConnection Private Sub Form25_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Dim constr As String constr = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source = D:\student project\VyasProject\student.mdb" OleDbcon.ConnectionString = constr OleDbcon.Open() MsgBox("connection done")

End Sub Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BTR.Click Dim oleDbcmd As OleDbCommand Dim sql As String Dim OleDbread As OleDbDataReader Dim rollno As Integer rollno = Val(TB1.Text) sql = " select * from stud where rollno = " & rollno & "" oleDbcmd = New OleDbCommand(sql, OleDbcon) OleDbread = oleDbcmd.ExecuteReader If OleDbread.HasRows Then OleDbread.Read() TB1.Text = OleDbread.Item("rollno") TB2.Text = OleDbread.Item("sname") TB4.Text TB5.Text TB6.Text TB7.Text TB8.Text TB9.Text = = = = = = OleDbread.Item("S1") OleDbread.Item("S2") OleDbread.Item("S2") OleDbread.Item("tot") OleDbread.Item("per") OleDbread.Item("div")

TB10.Text = OleDbread.Item("res") MsgBox("record succcessfully found")

End If End Sub Private Sub Label2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Label2.Click End Sub Private Sub Button8_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BTN.Click deepak_()

End Sub Private Sub deepak_() TB1.Text = "" TB2.Text = "" TB4.Text = "" TB5.Text = "" TB6.Text = "" TB7.Text = "" TB8.Text = "" TB9.Text = "" TB10.Text = "" End Sub Private Sub TextBox2_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TB2.TextChanged End Sub Private Sub BTS_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BTS.Click Dim oleDbcmd As OleDbCommand Dim sql As String Dim rollno, s1, s2, s3, tot As Integer Dim sname, div, res As String Dim per As Double rollno = TB1.Text sname = TB2.Text

s1 = TB4.Text s2 = TB5.Text s3 = TB6.Text tot = TB7.Text per = TB8.Text div = TB9.Text res = TB10.Text sql = "Insert into stud values(" & rollno & ",'" & sname & "'," & s1 & "," & s2 & "," & s3 & "," & tot & "," & per & ",'" & div & "','" & res & "' )" oleDbcmd = New OleDbCommand(sql, OleDbcon) oleDbcmd.ExecuteNonQuery() oleDbcmd.Dispose() Call deepak_() End Sub

Private Sub Button1_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click End Sub Private Sub Button1_Enter(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Enter End Sub Private Sub BTD_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BTD.Click Dim oleDbcmd As OleDbCommand Dim sql As String Dim rollno As Integer rollno = TB1.Text If TB1.Text = ("") Then MsgBox("pls enter rollno") End If sql = "delete * from Stud where rollno = " & rollno & "" oleDbcmd = New OleDbCommand(sql, OleDbcon) oleDbcmd.ExecuteNonQuery() MsgBox("record delete ") oleDbcmd.Dispose() Call deepak_() End Sub End Class

Imports System.Data.SqlClient Public Class Form26 Dim sqlCon As New SqlConnection Private Sub Form26_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Dim conStr As String conStr = "Data Source=.;Initial Catalog=Vyas;Integrated Security=True" sqlCon.ConnectionString = conStr sqlCon.Open() MsgBox("Connection Open...!!!!") End Sub Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim sqlStr As String Dim sqlCmd As SqlCommand Dim tEmpNo, tDeptNo As Integer Dim tSal As Double Dim tEName, tDoj As String tEmpNo = TextBox1.Text tEName = TextBox2.Text tDoj = Format(DateTimePicker1.Value.Date, "MM/dd/yyyy") tDeptNo = TextBox3.Text tSal = TextBox4.Text sqlStr = "INSERT INTO emp VALUES(" & tEmpNo & ",'" & tEName & "','" & tDoj & "'," & tDeptNo & "," & tSal & ")" sqlCmd = New SqlCommand(sqlStr, sqlCon) sqlCmd.ExecuteNonQuery() MsgBox("Record Successfuly Save") sqlCmd.Dispose() End Sub Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click Dim tEmpNo As Integer Dim sqlStr As String Dim sqlCmd As SqlCommand Dim sqlRead As SqlDataReader tEmpNo = TextBox1.Text sqlStr = "SELECT * FROM emp WHERE empno=" & tEmpNo sqlCmd = New SqlCommand(sqlStr, sqlCon) sqlRead = sqlCmd.ExecuteReader If (sqlRead.HasRows) Then sqlRead.Read() TextBox2.Text = sqlRead.Item("ename") DateTimePicker1.Value = sqlRead.Item("doj") TextBox3.Text = sqlRead.Item("deptno")

TextBox4.Text = sqlRead.Item("sal") Else MsgBox("Record not found") End If sqlCmd.Dispose() sqlRead.Close() End Sub End Class

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy