locked
help...Tab order when datagridview is on interop usercontrol

    السؤال

  • I have interop windows usercontrol.it has 2 panels.in one panel i have couple of textboxes and one datagridview. in another panel i have other textboxes, combobox etc.
    In my datagridview first column cells have a combo box. i added this to the grid in a different way than having comboboxcolumn.
    i have combobox on the form and i hide this one on initial load.i add this combo box to gridview.controls.add(combobox). in the datagridview cellbeginedit event i show this combobox. when i select the value in combobox i assign that value to cell value in cellendedit. everything works fine but when i am in this first cell after selecting the value in combobox and tab out it goes to a textbox field in the second panel instead of next cell. this way tab order is all messed up.
    i did the same UI on pure .net form instead of interopcontrol and the tab order is working perfect. i checked the tab indexes and everything is in order they way it should be.
    can someone provide me a solution if you have come across this one.this is driving me crazy for 2 days now.....i believe some of the routines in ActiveXControlHelpers.vb is causing this.sub ValidationHandler is being called multiple times in my interopusercontrol and it might be causing this.
    it happens when i run the interop user control from .net or vb6. so something it is with interop which is causing this. please help.....
    24/صفر/1431 06:14 م

الإجابات

  • Hi ,

    1. Please use the built-in comboboxcolumn here.

    2. Please customize keyboard behavior to see whether it can satisfy your requirement. You can handle standard keyboard events such as KeyDown. In edit mode, however, the hosted editing control receives the keyboard input and the keyboard events do not occur for the DataGridView control. Commonly we can customize keyboard behavior in a DataGridView subclass by overriding the ProcessDialogKey and ProcessDataGridViewKey methods. Here is the simple code example about changing the behavior of the ENTER key in a DataGridView subclass by overriding the ProcessDataGridViewKey and ProcessDialogKey methods. Please have a look at this thread for your reference:
    http://social.msdn.microsoft.com/Forums/en-US/vbgeneral/thread/118efc9a-46ad-4ddd-93aa-513f73069134

    Best regards,
    Riquel
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.
    • تم وضع علامة كإجابة بواسطة Riquel_DongModerator 01/ربيع الأول/1431 02:36 ص
    27/صفر/1431 09:12 ص
    المشرف