-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathattendance.vb
233 lines (196 loc) · 10.7 KB
/
attendance.vb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
Imports System.Windows.Forms
Public Class attendance
Private Sub ShowNewForm(ByVal sender As Object, ByVal e As EventArgs)
' Create a new instance of the child form.
Dim ChildForm As New System.Windows.Forms.Form
' Make it a child of this MDI form before showing it.
ChildForm.MdiParent = Me
m_ChildFormNumber += 1
ChildForm.Text = "Window " & m_ChildFormNumber
ChildForm.Show()
End Sub
Private Sub OpenFile(ByVal sender As Object, ByVal e As EventArgs)
Dim OpenFileDialog As New OpenFileDialog
OpenFileDialog.InitialDirectory = My.Computer.FileSystem.SpecialDirectories.MyDocuments
OpenFileDialog.Filter = "Text Files (*.txt)|*.txt|All Files (*.*)|*.*"
If (OpenFileDialog.ShowDialog(Me) = System.Windows.Forms.DialogResult.OK) Then
Dim FileName As String = OpenFileDialog.FileName
' TODO: Add code here to open the file.
End If
End Sub
Private Sub SaveAsToolStripMenuItem_Click(ByVal sender As Object, ByVal e As EventArgs)
Dim SaveFileDialog As New SaveFileDialog
SaveFileDialog.InitialDirectory = My.Computer.FileSystem.SpecialDirectories.MyDocuments
SaveFileDialog.Filter = "Text Files (*.txt)|*.txt|All Files (*.*)|*.*"
If (SaveFileDialog.ShowDialog(Me) = System.Windows.Forms.DialogResult.OK) Then
Dim FileName As String = SaveFileDialog.FileName
' TODO: Add code here to save the current contents of the form to a file.
End If
End Sub
Private Sub ExitToolsStripMenuItem_Click(ByVal sender As Object, ByVal e As EventArgs)
Me.Close()
End Sub
Private Sub CutToolStripMenuItem_Click(ByVal sender As Object, ByVal e As EventArgs)
' Use My.Computer.Clipboard to insert the selected text or images into the clipboard
End Sub
Private Sub CopyToolStripMenuItem_Click(ByVal sender As Object, ByVal e As EventArgs)
' Use My.Computer.Clipboard to insert the selected text or images into the clipboard
End Sub
Private Sub PasteToolStripMenuItem_Click(ByVal sender As Object, ByVal e As EventArgs)
'Use My.Computer.Clipboard.GetText() or My.Computer.Clipboard.GetData to retrieve information from the clipboard.
End Sub
Private Sub CascadeToolStripMenuItem_Click(ByVal sender As Object, ByVal e As EventArgs)
Me.LayoutMdi(MdiLayout.Cascade)
End Sub
Private Sub TileVerticalToolStripMenuItem_Click(ByVal sender As Object, ByVal e As EventArgs)
Me.LayoutMdi(MdiLayout.TileVertical)
End Sub
Private Sub TileHorizontalToolStripMenuItem_Click(ByVal sender As Object, ByVal e As EventArgs)
Me.LayoutMdi(MdiLayout.TileHorizontal)
End Sub
Private Sub ArrangeIconsToolStripMenuItem_Click(ByVal sender As Object, ByVal e As EventArgs)
Me.LayoutMdi(MdiLayout.ArrangeIcons)
End Sub
Private Sub CloseAllToolStripMenuItem_Click(ByVal sender As Object, ByVal e As EventArgs)
' Close all child forms of the parent.
For Each ChildForm As Form In Me.MdiChildren
ChildForm.Close()
Next
End Sub
Private m_ChildFormNumber As Integer
Private Sub attendance_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
End Sub
Private Sub ComboBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ComboBox1.SelectedIndexChanged
If ComboBox1.SelectedItem = 1 Then
Label2.Visible = True
DateTimePicker1.Visible = True
Label3.Visible = True
Label4.Visible = True
Label5.Visible = True
Label6.Visible = True
Label7.Visible = True
Label8.Visible = True
Label9.Visible = True
TextBox1.Visible = True
TextBox2.Visible = True
TextBox3.Visible = True
TextBox4.Visible = True
TextBox5.Visible = True
TextBox6.Visible = True
TextBox7.Visible = True
End If
If ComboBox1.SelectedItem = 2 Then
DateTimePicker2.Visible = True
Label24.Visible = True
Label20.Visible = True
Label11.Visible = True
Label12.Visible = True
Label13.Visible = True
Label14.Visible = True
Label15.Visible = True
DateTimePicker2.Visible = True
TextBox9.Visible = True
TextBox10.Visible = True
TextBox11.Visible = True
TextBox12.Visible = True
TextBox13.Visible = True
TextBox14.Visible = True
End If
If ComboBox1.SelectedItem = 3 Then
Label16.Visible = True
Label17.Visible = True
Label18.Visible = True
Label19.Visible = True
Label21.Visible = True
Label22.Visible = True
Label23.Visible = True
DateTimePicker3.Visible = True
TextBox15.Visible = True
TextBox16.Visible = True
TextBox17.Visible = True
TextBox18.Visible = True
TextBox19.Visible = True
TextBox20.Visible = True
End If
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
main()
If ComboBox1.SelectedItem = 1 Then
cmd.CommandText = "select * from stdattendance1 where stdid='" & Trim(Me.TextBox1.Text) & "' and Date='" & Trim(Me.DateTimePicker1.Text) & "' and Maths='" & Trim(Me.TextBox2.Text) & "' and Cprogramming='" & Trim(Me.TextBox3.Text) & "' and Chemistry='" & Trim(Me.TextBox4.Text) & "' and Electronics='" & Trim(Me.TextBox5.Text) & "' and Environmental='" & Trim(Me.TextBox6.Text) & "' and English='" & Trim(Me.TextBox7.Text) & "'"
cmd.Connection = conn
ds.Tables.Clear()
adp.SelectCommand = cmd
adp.Fill(ds, "tbl")
If (ds.Tables("tbl").Rows.Count > 0) Then
TextBox1.Text = ""
TextBox2.Text = ""
TextBox3.Text = ""
TextBox4.Text = ""
TextBox5.Text = ""
TextBox6.Text = ""
TextBox7.Text = ""
Exit Sub
End If
cmd.CommandText = "insert into stdattendance1(stdid,Date,Maths,Cprogramming,Chemistry,Electronics,Environmental,English)values('" & Trim(Me.TextBox1.Text) & "','" & Trim(Me.DateTimePicker1.Text) & "','" & Trim(Me.TextBox2.Text) & "','" & Trim(Me.TextBox3.Text) & "','" & Trim(Me.TextBox4.Text) & "','" & Trim(Me.TextBox5.Text) & "','" & Trim(Me.TextBox6.Text) & "','" & Trim(Me.TextBox7.Text) & "')"
cmd.Connection = conn
cmd.ExecuteNonQuery()
MsgBox("Record Successfully Saved for 1st semester!!", MsgBoxStyle.Information, "GRAPHIC ERA")
Dim frm = New attendance 'Clear Form' Change the class name if necessary
frm.Show()
Me.Close()
Me.TextBox1.Focus()
End If
If ComboBox1.SelectedItem = 2 Then
cmd.CommandText = "select * from stdattendance2 where stdid='" & Trim(Me.TextBox1.Text) & "' and Date='" & Trim(Me.DateTimePicker2.Text) & "' and Cprogramming='" & Trim(Me.TextBox9.Text) & "' and Maths='" & Trim(Me.TextBox10.Text) & "' and Physics='" & Trim(Me.TextBox11.Text) & "' and Electrical='" & Trim(Me.TextBox12.Text) & "' and HealthPED='" & Trim(Me.TextBox13.Text) & "' and English='" & Trim(Me.TextBox14.Text) & "'"
cmd.Connection = conn
ds.Tables.Clear()
adp.SelectCommand = cmd
adp.Fill(ds, "tbl")
If (ds.Tables("tbl").Rows.Count > 0) Then
TextBox1.Text = ""
TextBox9.Text = ""
TextBox10.Text = ""
TextBox11.Text = ""
TextBox12.Text = ""
TextBox13.Text = ""
TextBox14.Text = ""
Exit Sub
End If
cmd.CommandText = "insert into stdattendance2(stdid,Date,Cprogramming,Maths,Physics,Electrical,HealthPED,English)values('" & Trim(Me.TextBox1.Text) & "','" & Trim(Me.DateTimePicker2.Text) & "','" & Trim(Me.TextBox9.Text) & "','" & Trim(Me.TextBox10.Text) & "','" & Trim(Me.TextBox11.Text) & "','" & Trim(Me.TextBox12.Text) & "','" & Trim(Me.TextBox13.Text) & "','" & Trim(Me.TextBox14.Text) & "')"
cmd.Connection = conn
cmd.ExecuteNonQuery()
MsgBox("Record Successfully Saved for 2nd semester!!", MsgBoxStyle.Information, "GRAPHIC ERA")
Dim frm = New attendance 'Clear Form' Change the class name if necessary
frm.Show()
Me.Close()
Me.TextBox1.Focus()
End If
If ComboBox1.SelectedItem = 3 Then
cmd.CommandText = "select * from stdattendance3 where stdid='" & Trim(Me.TextBox1.Text) & "' and Date='" & Trim(Me.DateTimePicker3.Text) & "' and Logicdesign='" & Trim(Me.TextBox15.Text) & "' and DS='" & Trim(Me.TextBox16.Text) & "' and CPP='" & Trim(Me.TextBox17.Text) & "' and Maths='" & Trim(Me.TextBox18.Text) & "' and CareerSkills='" & Trim(Me.TextBox19.Text) & "' and Software='" & Trim(Me.TextBox20.Text) & "'"
cmd.Connection = conn
ds.Tables.Clear()
adp.SelectCommand = cmd
adp.Fill(ds, "tbl")
If (ds.Tables("tbl").Rows.Count > 0) Then
TextBox15.Text = ""
TextBox16.Text = ""
TextBox17.Text = ""
TextBox18.Text = ""
TextBox19.Text = ""
TextBox20.Text = ""
Exit Sub
End If
cmd.CommandText = "insert into stdattendance3(stdid,Date,Logicdesign,DS,CPP,Maths,CareerSkills,Software)values('" & Trim(Me.TextBox1.Text) & "','" & Trim(Me.DateTimePicker3.Text) & "','" & Trim(Me.TextBox15.Text) & "','" & Trim(Me.TextBox16.Text) & "','" & Trim(Me.TextBox17.Text) & "','" & Trim(Me.TextBox18.Text) & "','" & Trim(Me.TextBox19.Text) & "','" & Trim(Me.TextBox20.Text) & "')"
cmd.Connection = conn
cmd.ExecuteNonQuery()
MsgBox("Record Successfully Saved for 3rd semester!!", MsgBoxStyle.Information, "GRAPHIC ERA")
Dim frm = New attendance 'Clear Form' Change the class name if necessary
frm.Show()
Me.Close()
Me.TextBox1.Focus()
End If
If ComboBox1.SelectedItem = Nothing Then
MsgBox("SELECT SEMESTER FIRST!!", MsgBoxStyle.Critical, "SECURITY")
End If
End Sub
End Class