TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
varsha dodiya
NA
407
75.2k
select datagridviewButtonCell on Pressing Enter key,Winforms
Jul 21 2014 3:27 AM
hey Geeks,
I have a datagridview in which i have one button column .. i am using it for selecting some values of that row.
what i want is when that button cell gets focus ,i press enter key (instead of clicking it by mouse) data of that row should be selected .help in guys.
here is my code
private void comboProname_TextChanged(object sender, EventArgs e) //combo box of product name
{ cmd = new SqlCommand("select P_batchno,P_min_stk,P_max_stk,P_vat from PRO where P_name='" + comboProname.Text + "'", conn);
conn.Open();
dr = cmd.ExecuteReader();
while (dr.Read())
{
if(comboBthNo.Text=="")
{ dataGridView3.Visible = true; //datagrid which has button column
int i = 0;
dataGridView3.Rows.Insert(i);
dataGridView3.Rows[i].Cells[0].Value = dr["P_batchno"].ToString();
tbMinstk.Text = dr["P_min_stk"].ToString();
tbMaxStk.Text = dr["P_max_stk"].ToString();
tbVAT.Text = dr["P_vat"].ToString();
}
}
conn.Close();
}
private void dataGridView3_CellContentClick(object sender, DataGridViewCellEventArgs e)
{ //for batchno I want dis all to be done on Enter key.
string p;
var senderGrid = (DataGridView)sender;
if (senderGrid.Columns[e.ColumnIndex] is DataGridViewButtonColumn && e.RowIndex >= 0)
{
//TODO - Button Clicked - Execute Code Here
p = (dataGridView3.Rows[e.RowIndex].Cells[0].Value.ToString());
comboBthNo.Text = p;
}
}
looking forward to ur help frens,thanks in advance
Reply
Answers (
2
)
How to convert .mp4 file to .avi format
How to capture frame of a .mp4 file while uploading