implemented open form edit on row double click
This commit is contained in:
parent
c3ddf9fdd7
commit
e7e8f5a944
@ -1 +0,0 @@
|
||||
CNSA-212-Personal-CAS
|
73
Database3/frmSearch.Designer.cs
generated
73
Database3/frmSearch.Designer.cs
generated
@ -32,17 +32,17 @@
|
||||
this.components = new System.ComponentModel.Container();
|
||||
this.lblDisStID = new System.Windows.Forms.Label();
|
||||
this.dgvStudents = new System.Windows.Forms.DataGridView();
|
||||
this.contextMenuStrip1 = new System.Windows.Forms.ContextMenuStrip(this.components);
|
||||
this.toolStripSeparator1 = new System.Windows.Forms.ToolStripSeparator();
|
||||
this.cmuSearch = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.cmuEdit = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.cmuDelete = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.lblDislname = new System.Windows.Forms.Label();
|
||||
this.lblDisDOB = new System.Windows.Forms.Label();
|
||||
this.txtStuID = new System.Windows.Forms.TextBox();
|
||||
this.txtlname = new System.Windows.Forms.TextBox();
|
||||
this.txtDOB = new System.Windows.Forms.TextBox();
|
||||
this.btnSearch = new System.Windows.Forms.Button();
|
||||
this.contextMenuStrip1 = new System.Windows.Forms.ContextMenuStrip(this.components);
|
||||
this.toolStripSeparator1 = new System.Windows.Forms.ToolStripSeparator();
|
||||
this.cmuSearch = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.cmuEdit = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.cmuDelete = new System.Windows.Forms.ToolStripMenuItem();
|
||||
((System.ComponentModel.ISupportInitialize)(this.dgvStudents)).BeginInit();
|
||||
this.contextMenuStrip1.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
@ -59,11 +59,44 @@
|
||||
// dgvStudents
|
||||
//
|
||||
this.dgvStudents.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
||||
this.dgvStudents.ContextMenuStrip = this.contextMenuStrip1;
|
||||
this.dgvStudents.Location = new System.Drawing.Point(77, 250);
|
||||
this.dgvStudents.Name = "dgvStudents";
|
||||
this.dgvStudents.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect;
|
||||
this.dgvStudents.Size = new System.Drawing.Size(638, 150);
|
||||
this.dgvStudents.TabIndex = 1;
|
||||
//
|
||||
// contextMenuStrip1
|
||||
//
|
||||
this.contextMenuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { this.toolStripSeparator1, this.cmuSearch, this.cmuEdit, this.cmuDelete });
|
||||
this.contextMenuStrip1.Name = "contextMenuStrip1";
|
||||
this.contextMenuStrip1.Size = new System.Drawing.Size(110, 76);
|
||||
//
|
||||
// toolStripSeparator1
|
||||
//
|
||||
this.toolStripSeparator1.Name = "toolStripSeparator1";
|
||||
this.toolStripSeparator1.Size = new System.Drawing.Size(106, 6);
|
||||
//
|
||||
// cmuSearch
|
||||
//
|
||||
this.cmuSearch.Name = "cmuSearch";
|
||||
this.cmuSearch.Size = new System.Drawing.Size(109, 22);
|
||||
this.cmuSearch.Text = "Search";
|
||||
this.cmuSearch.Click += new System.EventHandler(this.cmuSearch_Click);
|
||||
//
|
||||
// cmuEdit
|
||||
//
|
||||
this.cmuEdit.Name = "cmuEdit";
|
||||
this.cmuEdit.Size = new System.Drawing.Size(109, 22);
|
||||
this.cmuEdit.Text = "Edit";
|
||||
this.cmuEdit.Click += new System.EventHandler(this.cmuEdit_Click);
|
||||
//
|
||||
// cmuDelete
|
||||
//
|
||||
this.cmuDelete.Name = "cmuDelete";
|
||||
this.cmuDelete.Size = new System.Drawing.Size(109, 22);
|
||||
this.cmuDelete.Text = "Delete";
|
||||
//
|
||||
// lblDislname
|
||||
//
|
||||
this.lblDislname.Location = new System.Drawing.Point(206, 108);
|
||||
@ -88,6 +121,7 @@
|
||||
this.txtStuID.Name = "txtStuID";
|
||||
this.txtStuID.Size = new System.Drawing.Size(132, 20);
|
||||
this.txtStuID.TabIndex = 4;
|
||||
this.txtStuID.TextChanged += new System.EventHandler(this.txtStuID_TextChanged);
|
||||
//
|
||||
// txtlname
|
||||
//
|
||||
@ -113,35 +147,6 @@
|
||||
this.btnSearch.UseVisualStyleBackColor = true;
|
||||
this.btnSearch.Click += new System.EventHandler(this.btnSearch_Click);
|
||||
//
|
||||
// contextMenuStrip1
|
||||
//
|
||||
this.contextMenuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { this.toolStripSeparator1, this.cmuSearch, this.cmuEdit, this.cmuDelete });
|
||||
this.contextMenuStrip1.Name = "contextMenuStrip1";
|
||||
this.contextMenuStrip1.Size = new System.Drawing.Size(110, 76);
|
||||
//
|
||||
// toolStripSeparator1
|
||||
//
|
||||
this.toolStripSeparator1.Name = "toolStripSeparator1";
|
||||
this.toolStripSeparator1.Size = new System.Drawing.Size(106, 6);
|
||||
//
|
||||
// cmuSearch
|
||||
//
|
||||
this.cmuSearch.Name = "cmuSearch";
|
||||
this.cmuSearch.Size = new System.Drawing.Size(109, 22);
|
||||
this.cmuSearch.Text = "Search";
|
||||
//
|
||||
// cmuEdit
|
||||
//
|
||||
this.cmuEdit.Name = "cmuEdit";
|
||||
this.cmuEdit.Size = new System.Drawing.Size(109, 22);
|
||||
this.cmuEdit.Text = "Edit";
|
||||
//
|
||||
// cmuDelete
|
||||
//
|
||||
this.cmuDelete.Name = "cmuDelete";
|
||||
this.cmuDelete.Size = new System.Drawing.Size(109, 22);
|
||||
this.cmuDelete.Text = "Delete";
|
||||
//
|
||||
// frmSearch
|
||||
//
|
||||
this.AcceptButton = this.btnSearch;
|
||||
|
@ -9,9 +9,33 @@ namespace Database3
|
||||
{
|
||||
public partial class frmSearch : Form
|
||||
{
|
||||
|
||||
public static string myID = "";
|
||||
|
||||
public frmSearch()
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
dgvStudents.DoubleClick += new EventHandler(dgvStudents_DoubleClick);
|
||||
|
||||
}
|
||||
|
||||
private void dgvStudents_DoubleClick(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
string studentid = "";
|
||||
|
||||
if (dgvStudents.Rows.Count > 0)
|
||||
{
|
||||
DataGridViewRow row = dgvStudents.SelectedRows[0];
|
||||
frmEdit aform = new frmEdit();
|
||||
|
||||
studentid = row.Cells[0].Value.ToString().Trim();
|
||||
myID = studentid;
|
||||
aform.ShowDialog();
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void btnSearch_Click(object sender, EventArgs e)
|
||||
@ -75,6 +99,22 @@ namespace Database3
|
||||
}
|
||||
|
||||
private void frmSearch_Load(object sender, EventArgs e)
|
||||
{
|
||||
dgvStudents.Visible = false;
|
||||
contextMenuStrip1.Items[1].Enabled = false;
|
||||
}
|
||||
|
||||
private void cmuSearch_Click(object sender, EventArgs e)
|
||||
{
|
||||
btnSearch_Click(sender,e);
|
||||
}
|
||||
|
||||
private void txtStuID_TextChanged(object sender, EventArgs e)
|
||||
{
|
||||
cmuSearch.Enabled = txtStuID.Text.Length>0;
|
||||
}
|
||||
|
||||
private void cmuEdit_Click(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user