Grade
How do I use Grade
Below are practical examples compiled from projects for learning and reference purposes
Featured Snippets
File name: Form1.cs
Copy
212 protected override void OnLoad(System.EventArgs e)
213 {
214 base.OnLoad(e);
215 string sPath = Application.ExecutablePath;
216 sPath = System.IO.Path.GetDirectoryName(sPath);
217
218 if (sPath.EndsWith("\\bin"))
219 {
220 sPath = sPath.Substring(0, sPath.Length - 4);
221 }
222
223 gradeclass.DataModule = new gradeclass(sPath);
224
225 }
File name: Form1.cs
Copy
228 public void Button5_Click(System.Object sender, System.EventArgs e)
229 {
230 newgrade = gradeclass.DataModule.GetLoad();
231 DataGridView1.DataSource = newgrade;
232 DataGridView1.DataMember = "grade1";
233
234 }
File name: Form1.cs
Copy
236 public void Button4_Click(System.Object sender, System.EventArgs e)
237 {
238
239 string strmessage = default(string);
240 DialogResult dgrResult;
241
242 strmessage = "Are you sure you want to save data?";
243 dgrResult = MessageBox.Show(strmessage, "Save data", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1);
244
245
246 if (dgrResult == System.Windows.Forms.DialogResult.Yes)
247 {
248
249 newgrade = gradeclass.DataModule.SaveItem();
250 }
251
252 }
File name: Form1.cs
Copy
254 public void NavRecords()
255 {
256
257 STUDID.Text = (string) (dsgrade.Tables["grade1"].Rows[inc][1]);
258 TextBox1.Text = (string) (dsgrade.Tables["grade1"].Rows[inc][2]);
259 TextBox2.Text = (string) (dsgrade.Tables["grade1"].Rows[inc][3]);
260 TextBox3.Text = (string) (dsgrade.Tables["grade1"].Rows[inc][4]);
261 TextBox4.Text = (string) (dsgrade.Tables["grade1"].Rows[inc][5]);
262 TextBox5.Text = (string) (dsgrade.Tables["grade1"].Rows[inc][6]);
263 TextBox6.Text = (string) (dsgrade.Tables["grade1"].Rows[inc][7]);
264 TextBox7.Text = (string) (dsgrade.Tables["grade1"].Rows[inc][8]);
265 TextBox8.Text = (string) (dsgrade.Tables["grade1"].Rows[inc][9]);
266 TextBox9.Text = (string) (dsgrade.Tables["grade1"].Rows[inc][10]);
267 TextBox10.Text = (string) (dsgrade.Tables["grade1"].Rows[inc][11]);
268 TextBox11.Text = (string) (dsgrade.Tables["grade1"].Rows[inc][12]);
269 TextBox12.Text = (string) (dsgrade.Tables["grade1"].Rows[inc][13]);
270 TextBox13.Text = (string) (dsgrade.Tables["grade1"].Rows[inc][14]);
271 TextBox14.Text = (string) (dsgrade.Tables["grade1"].Rows[inc][15]);
272 TextBox15.Text = (string) (dsgrade.Tables["grade1"].Rows[inc][16]);
273 TextBox16.Text = (string) (dsgrade.Tables["grade1"].Rows[inc][17]);
274 TextBox17.Text = (string) (dsgrade.Tables["grade1"].Rows[inc][18]);
275 TextBox18.Text = (string) (dsgrade.Tables["grade1"].Rows[inc][19]);
276 TextBox19.Text = (string) (dsgrade.Tables["grade1"].Rows[inc][20]);
277
278 }
File name: Form1.cs
Copy
282 public void FRST_Click(System.Object sender, System.EventArgs e)
283 {
284 dsgrade = gradeclass.DataModule.navigate();
285 if (inc != 0)
286 {
287 inc = 0;
288 NavRecords();
289 MessageBox.Show("First Record");
290 }
291 }
File name: Form1.cs
Copy
293 public void PREV_Click(System.Object sender, System.EventArgs e)
294 {
295
296 dsgrade = gradeclass.DataModule.navigate();
297 if (inc > 0)
298 {
299 inc--;
300 NavRecords();
301 }
302 else if (inc == -1)
303 {
304 MessageBox.Show("No Records Yet");
305 }
306 else if (inc == 0)
307 {
308 MessageBox.Show("First Record");
309 }
310
311
312 }
File name: Form1.cs
Copy
314 public void LAST_Click(System.Object sender, System.EventArgs e)
315 {
316 dsgrade = gradeclass.DataModule.navigate();
317 MaxRows = dsgrade.Tables["grade1"].Rows.Count;
318 if (inc != MaxRows)
319 {
320 inc = MaxRows - 1;
321 NavRecords();
322 }
323 else
324 {
325 MessageBox.Show("Last Record");
326 }
327 }
File name: Form1.cs
Copy
329 public void NXT_Click(System.Object sender, System.EventArgs e)
330 {
331 dsgrade = gradeclass.DataModule.navigate();
332 try
333 {
334 if (inc != MaxRows - 1)
335 {
336 inc++;
337 NavRecords();
338 }
339 }
340 catch (Exception)
341 {
342 MessageBox.Show("No More Rows");
343 }
344 }
File name: Form1.cs
Copy
373 public void Button11_Click(System.Object sender, System.EventArgs e)
374 {
375 string strmessage = default(string);
376 DialogResult dgrResult;
377
378 strmessage = "Are you sure you want to Delete this record?";
379 dgrResult = MessageBox.Show(strmessage, "Delete Record", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1);
380
381
382 if (dgrResult == System.Windows.Forms.DialogResult.Yes)
383 {
384
385 dsgrade = gradeclass.DataModule.deldata();
386
387 }
388
389
390
391 }
File name: Form1.cs
Copy
393 public void Button7_Click(System.Object sender, System.EventArgs e)
394 {
395 dsgrade = gradeclass.DataModule.updtedata();
396 }
Download file with original file name:Grade
Grade 168 lượt xem
Gõ tìm kiếm nhanh...