Hi,
I am using a custom text box, where I need to override TabSelection, as I
have to generate an event and based on that event, I need to do some
processing in other class, who is listening to that event. This thing works
fine, when I am stopping in the debugger for the event, but as soon as I
remove the breakpoint from the event handler method. This doesn't work and
even the release version of the software also doesn't work.
Following is a snippet of the code :-
public class TypeTextBox : System.Windows.Forms.TextBox
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.Container components = null;
public delegate void TabSelectedDelegate(object sender,EventArgs e);
public event TabSelectedDelegate TabSelected;
protected override bool ProcessCmdKey(ref Message msg, Keys keyData)
{
const int WM_KEYDOWN = 0x100;
const int WM_SYSKEYDOWN = 0x104;
System.EventArgs e = new EventArgs();
if ((msg.Msg == WM_KEYDOWN) || (msg.Msg == WM_SYSKEYDOWN))
{
if (keyData == Keys.Tab)
{
textcolor = Color.DarkGreen;
TabSelected(this,e);
}
}
this.TabStop = false;
keyData = Keys.None;
base.TabIndex = 0;
base.TabStop = false;
return base.ProcessCmdKey(ref msg,keyData);
}
}
}
public class PicturePlacement : System.Windows.Forms.UserControl
{
private TypeTextBox myTextBox;
private void SubscribeTabSelected(TypeTextBox localTextBox)
{
localTextBox.TabSelected +=
new TypeTextBox.TabSelectedDelegate(TabSelectDone);
}
private void TabSelectDone(object localTextBox,EventArgs e)
{
// Do something here..
}
Any idea would be appreciated.
Thanks,
-Brajesh