Records
How do I use Records
Below are practical examples compiled from projects for learning and reference purposes
Featured Snippets
Line | Code | Ex.. |
---|---|---|
254 | public void NavRecords() | 1 |
288 | NavRecords(); | 2 |
300 | NavRecords(); | 3 |
321 | NavRecords(); | 4 |
337 | NavRecords(); | 5 |
32 | public void navigate_records(int inc) | 6 |
177 | navigate_records(inc); | 7 |
188 | navigate_records(inc); | 8 |
199 | navigate_records(inc); | 9 |
229 | navigate_records(inc); | 10 |
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: frmItems.cs
Copy
32 public void navigate_records(int inc)
33 {
34 config.singleResult("SELECT * FROM `tblitems`");
35 txtitemid.Text =config.dt.Rows[inc].Field
36 txtname.Text = config.dt.Rows[inc].Field
37 txtdescription.Text = config.dt.Rows[inc].Field
38 txtprice.Text = config.dt.Rows[inc].Field
39 cbotype.Text = config.dt.Rows[inc].Field
40 //txtqty.Text = config.dt.Rows[inc].Field
41 //cbounit.Text = config.dt.Rows[inc].Field
42
43
44 }
File name: frmItems.cs
Copy
172 private void btnfirst_Click(object sender, EventArgs e)
173 {
174 inc = 1;
175 lblinc.Text = inc.ToString();
176 inc = 0;
177 navigate_records(inc);
178 }
File name: frmItems.cs
Copy
180 private void btnlast_Click(object sender, EventArgs e)
181 {
182 select_navigation("SELECT ITEMID FROM tblitems");
183 if(inc!= maxrow)
184 {
185 inc = maxrow;
186 lblinc.Text = inc.ToString();
187 inc = maxrow - 1;
188 navigate_records(inc);
189 }
190 }
File name: frmItems.cs
Copy
192 private void btnprev_Click(object sender, EventArgs e)
193 {
194 int lbl_inc=0;
195
196 if(inc > 0)
197 {
198 inc = inc - 1;
199 navigate_records(inc);
200
201
202 lbl_inc = int.Parse(lblinc.Text) - 1;
203
204 lblinc.Text = lbl_inc.ToString();
205 }
206 else if(inc == 0)
207 {
208 navigate_records(inc);
209 lbl_inc = 1;
210 lblinc.Text = lbl_inc.ToString();
211 MessageBox.Show("First Records", "Info", MessageBoxButtons.OK, MessageBoxIcon.Information);
212 }
213 }
File name: frmItems.cs
Copy
215 private void btnnext_Click(object sender, EventArgs e)
216 {
217 int lbl_inc;
218
219 select_navigation("SELECT ITEMID FROM tblitems");
220 if(inc==maxrow-1)
221 {
222 MessageBox.Show("no more rows", "Info", MessageBoxButtons.OK, MessageBoxIcon.Information);
223 }
224 else
225 {
226 if (inc != maxrow - 1)
227 {
228 inc = inc + 1;
229 navigate_records(inc);
230 }
231
232 lbl_inc = int.Parse(lblinc.Text) + 1;
233 lblinc.Text = lbl_inc.ToString();
234 }
235 }
Records 111 lượt xem
Gõ tìm kiếm nhanh...