Disable and enable dropdown combobox(Form Control)

Disable and enable dropdown combobox(Form Control)

Post by Vmlub2 » Thu, 08 Nov 2007 04:30:01


How can i disable or enable a drop list using a Excel functions (Not a VBA
macro).
Here I'm talking about I've been using Combo Box from From control as
dropdown list in my template.

Advanced thanks,
Vinod
 
 
 

1. ComboBox Control (not DropDown "Forms" Item) in a Word Document

2. DropDown control implementation like ComboBox without stealing focus from form?

Hello,

I'm createing a custom control from scratch and this control has a dropdown
portion just like combobox...

To have a professional look, I've to take care some points while the
dropdown is shown such as :

1) It should not steal focus from the Form.
2) It should be focusable.
3) It should catch all the mouse events while it's visible.

To achieve this I create the dropdown control and show it like this :

[DllImport("user32.dll")]
private static extern bool ShowWindow(IntPtr hWnd, int nCmdShow);

[DllImport("user32")]
private static extern int SetParent(IntPtr hWndChild,IntPtr hWndNewParent);

[DllImport("user32")]
private static extern int SetCapture(int hwnd);

--- The code that shows the DropDown portion---

SetParent(MyListBox.Handle,IntPtr.Zero);
ShowWindow(MyListBox.Handle,4);
SetCapture(MyListBox.Handle.ToInt32());

As you can see, I'm setting the parent of the dropdown to desktop. Than
showing the window and setting the capture to that window.

The only succesfull part of the code is that the form does not loose the
focus. But I can't set the focus to the control and neither it captures the
mouse.

Can anybody point me what I'm doing wrong or know any way to achieve the
effect I want?

Regards,

den Irmak

3. Enable/Disable Control on Form Open

4. Enable/Disable a Control in a Form Based on Security Group Per

5. Enable\Disable control on form

6. Enable / disable controls in forms

7. Enabling/Disabling Form controls with checkbox click.

8. Disable Controls + subform on a Form but keep one field enabled

9. Enable/Disable a Control in a Form Based on Security Group Permiss

10. how can enable or disable certain control on the form depending upon

11. Disable Controls + subform on a Form but keep one field enable

12. Enable/Disable controls on form

13. Enable/Disable controls in forms

14. Enabling & Disabling Form Controls

15. enabled/disabled control continuous form