This is A C# Practice code:
Video For Result:
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Data;
- using System.Drawing;
- using System.Linq;
- using System.Text;
- using System.Windows.Forms;
- namespace database
- {
- public partial class CreateTable : Form
- {
- public CreateTable()
- {
- InitializeComponent();
- }
- private void button1_Click(object sender, EventArgs e)
- {
- DataTable ss = new DataTable();
- ss.Columns.Add("Id");
- ss.Columns.Add("Names");
- ss.Columns.Add("Address");
- ss.Columns.Add("Project");
- ss.Columns.Add("Qualification");
- DataRow row = ss.NewRow();
- row["Id"] = textBox1.Text;
- row["Names"] = textBox2.Text;
- row["Address"] = textBox3.Text;
- row["Project"] = textBox4.Text;
- row["Qualification"] = textBox5.Text;
- ss.Rows.Add(row);
- foreach (DataRow Drow in ss.Rows)
- {
- int num = dataGridView1.Rows.Add();
- dataGridView1.Rows[num].Cells[0].Value = Drow["id"].ToString();
- dataGridView1.Rows[num].Cells[1].Value = Drow["Names"].ToString();
- dataGridView1.Rows[num].Cells[2].Value = Drow["Address"].ToString();
- dataGridView1.Rows[num].Cells[3].Value = Drow["Project"].ToString();
- dataGridView1.Rows[num].Cells[4].Value = Drow["Qualification"].ToString();
- }
- }
- }
- }
Facebook Comment