-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathaddstudent.vb
237 lines (155 loc) · 9.75 KB
/
addstudent.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
234
235
236
237
Imports System.Windows.Forms
Public Class addstudent
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 Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
main()
cmd.CommandText = "select * from addstudent where stdname='" & Trim(Me.TextBox1.Text) & "' and stdsection='" & Trim(Me.TextBox2.Text) & "' and stdadd='" & Trim(Me.TextBox3.Text) & "' and stdemail='" & Trim(Me.TextBox4.Text) & "' and stdnum='" & Trim(Me.TextBox5.Text) & "' and stdfather='" & Trim(Me.TextBox6.Text) & "' and stdmother='" & Trim(Me.TextBox7.Text) & "' and stdgaurdian='" & Trim(Me.TextBox8.Text) & "' and dateofregistration='" & Trim(Me.DateTimePicker1.Text) & "' and timeofregistration='" & Trim(Me.TextBox10.Text) & "'and course='" & Trim(Me.ComboBox1.Text) & "' and specialization='" & Trim(Me.ComboBox2.Text) & "' and stdid='" & Trim(Me.TextBox9.Text) & "' and sem='" & Trim(Me.ComboBox3.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 = ""
TextBox8.Text = ""
TextBox9.Text = ""
TextBox10.Text = ""
ComboBox1.Text = ""
ComboBox2.Text = ""
TextBox9.Text = ""
ComboBox3.Text = ""
Exit Sub
End If
cmd.CommandText = "insert into addstudent(stdname,stdsection,stdadd,stdemail,stdnum,stdfather,stdmother,stdgaurdian,dateofregistration,timeofregistration,course,specialization,stdid,sem)values('" & Trim(Me.TextBox1.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) & "','" & Trim(Me.TextBox8.Text) & "','" & Trim(Me.DateTimePicker1.Text) & "','" & Trim(Me.TextBox10.Text) & "','" & Trim(Me.ComboBox1.Text) & "','" & Trim(Me.ComboBox2.Text) & "','" & Trim(Me.TextBox9.Text) & "','" & Trim(Me.ComboBox3.Text) & "')"
cmd.Connection = conn
cmd.ExecuteNonQuery()
MsgBox("Record Successfully Saved!!", MsgBoxStyle.Information, "GRAPHIC ERA")
Dim frm = New addstudent 'Clear Form' Change the class name if necessary
frm.Show()
Me.Close()
Me.TextBox1.Focus()
End Sub
Private Sub addstudent_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
TextBox10.Text = TimeOfDay
End Sub
Private Sub Label15_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
End Sub
Private Sub DateTimePicker1_ValueChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles DateTimePicker1.ValueChanged
End Sub
Private Sub ComboBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ComboBox1.SelectedIndexChanged
End Sub
Private Sub TextBox9_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox9.TextChanged
End Sub
Private Sub Label2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Label2.Click
End Sub
Private Sub Label3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Label3.Click
End Sub
Private Sub Label4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Label4.Click
End Sub
Private Sub Label5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Label5.Click
End Sub
Private Sub Label6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Label6.Click
End Sub
Private Sub Label7_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Label7.Click
End Sub
Private Sub TextBox1_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox1.TextChanged
End Sub
Private Sub TextBox2_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox2.TextChanged
End Sub
Private Sub TextBox3_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox3.TextChanged
End Sub
Private Sub TextBox4_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox4.TextChanged
End Sub
Private Sub TextBox5_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox5.TextChanged
End Sub
Private Sub Label8_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Label8.Click
End Sub
Private Sub Label9_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Label9.Click
End Sub
Private Sub Label10_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Label10.Click
End Sub
Private Sub Label11_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Label11.Click
End Sub
Private Sub TextBox6_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox6.TextChanged
End Sub
Private Sub TextBox7_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox7.TextChanged
End Sub
Private Sub TextBox8_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox8.TextChanged
End Sub
Private Sub Label12_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Label12.Click
End Sub
Private Sub Label13_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Label13.Click
End Sub
Private Sub Label14_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Label14.Click
End Sub
Private Sub Label16_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Label16.Click
End Sub
Private Sub ComboBox2_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ComboBox2.SelectedIndexChanged
End Sub
Private Sub ComboBox3_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ComboBox3.SelectedIndexChanged
End Sub
Private Sub Label18_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Label18.Click
End Sub
End Class