Thursday, December 23, 2010

Handling backspace in IE extension

I post solution for textbox backspace problem which I am facing during creating a IE toolbar using band object. Here txtUserName and txtName_GotFocus could be different.


 public partial class IEToolbarEngine : BandObject
 {


          [DllImport("user32.dll")]

        public static extern int SendMessage(IntPtr hWnd, UInt32 Msg, UInt32 wParam, Int32 lParam);

        [DllImport("user32.dll")]

        public static extern int TranslateMessage(ref MSG lpMsg);

        [DllImport("user32", EntryPoint = "DispatchMessage")]

        static extern bool DispatchMessage(ref MSG msg);


        Public IEToolbar()
      {
                InitializeComponant();
                txtUserName.GotFocus  += new EventHandler(txtName_GotFocus);
                txtUserName.focus();  
      }
     Private void txtName_GotFocus(object sender, EventArgs e)
    {
                this.OnGotFocus(e);
    }

}

Hope this will be solve your issue.

No comments:

Post a Comment