private void newdgv_EditingControlShowing(object sender, DataGridViewEditingControlShowingEventArgs e)
{
TextBox tbox = e.Control as TextBox;
if (newdgv.CurrentCell.ColumnIndex == 0)
{
tbox.TextChanged+=new EventHandler(tbox_TextChanged);
tbox.KeyDown += new KeyEventHandler(tbox_KeyDown);
}
}
private void tbox_KeyDown(object sender, KeyEventArgs e)
{
if (e.Control && e.KeyCode == Keys.C)
{
CashShortAC4 csa4 = new CashShortAC4();
csa4.Bt_Click += new CashShortAC4.CShortAC1(csa4_Bt_Click);
csa4.Show(this);
}
}
private void tbox_TextChanged(object sender, EventArgs e)
{
TextBox tbox = (TextBox)sender;
if (tbox.Text.Length > 2)
{
listBox2.Visible = true;
button2.Visible = true;
int inddex = listBox2.FindString(tbox.Text);
if (inddex != -1)
{
listBox2.SetSelected(inddex, true);
listBox2.Focus();
tbox.TextChanged -= new EventHandler(tbox_TextChanged);
}
}
}
The tbox TextChanged event working very well but tbox keydown event not working. When I Press Ctrl+C on Editing Control like textbox it's not showing me the concern new form CashShortAC4. I don't know what is wrong in my application. How to solve the problem?.
Sam HobbsPosted Nov 17, 2011, 12:52 PM
Also, create a small program to attempt to duplicate what your main program is doing.
mahesh waghelaPosted Nov 18, 2011, 11:43 AM
Sam
You are right I will try it again and let you know later
mahesh waghelaPosted Nov 17, 2011, 12:41 PM
Sam
It's very strange when I change my tbox keyvent handller as below :
Sam HobbsPosted Nov 16, 2011, 1:33 PM
mahesh waghelaPosted Nov 16, 2011, 12:20 PM
Sam
The tbox.KeyDown+=new KeyEventHandler(tbox-Keydown)is seem likely to be hit but don't know why it's not execute. I think something serious problem in my application and I have to find out but it will take a time.
Sam HobbsPosted Nov 14, 2011, 4:34 PM
Try using the debugger; put a breakpoint in tbox_KeyDown and on the line "tbox.KeyDown += new KeyEventHandler(tbox_KeyDown);" and debug and then type something into the textbox. If the breakpoint for the adding of the keydown event is not hit then you know that the keydown event handler will never execute. If the event handler does execute then you can look at the KeyEventArgs to see what is actually iin there.