473,750 Members | 2,211 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Drop down a combobox programatically ?

Hi,

I'd like to drop down a combobox after validating the Leave() event, how
can I do that ?

Thanks
Sep 17 '06 #1
7 26200
hung tran wrote:
Hi,

I'd like to drop down a combobox after validating the Leave() event,
how can I do that ?
Why would you want to do that? A combobox standard behavior in windows
is that when you click the [v] button, it will show a list, and when
you leave the control the list will dissapear, which is logical as the
focus is on another control.

Frans

--
------------------------------------------------------------------------
Lead developer of LLBLGen Pro, the productive O/R mapper for .NET
LLBLGen Pro website: http://www.llblgen.com
My .NET blog: http://weblogs.asp.net/fbouma
Microsoft MVP (C#)
------------------------------------------------------------------------
Sep 18 '06 #2
On Mon, 18 Sep 2006 00:57:18 -0700, "Frans Bouma [C# MVP]"
<pe************ ******@xs4all.n lwrote:
hung tran wrote:
Hi,

I'd like to drop down a combobox after validating the Leave() event,
how can I do that ?

Why would you want to do that? A combobox standard behavior in windows
is that when you click the [v] button, it will show a list, and when
you leave the control the list will dissapear, which is logical as the
focus is on another control.

Frans

Hi Frans,

For example the combobox is used for searching customer number (string), if
I enter in the text field "0005" and click the drop down arrow it will
display a list of "00051, 00052, 00053, 00054", I can select one of them.

If I enter "00053" and press tab, it's ok too because the customer 00053
does exist ...

But if I enter "0005" and press tab, there is no customer number 0005 so I
want to display the list automatically as if I click the drop down arrow
....

Actually I don't want this behavior, but our client wants it so -:)

Thanks
Sep 18 '06 #3
On Mon, 18 Sep 2006 12:07:26 +0200, hung tran <om*****@gmx.ne twrote:
>On Mon, 18 Sep 2006 00:57:18 -0700, "Frans Bouma [C# MVP]"
<pe*********** *******@xs4all. nlwrote:
>hung tran wrote:
Hi,

I'd like to drop down a combobox after validating the Leave() event,
how can I do that ?

Why would you want to do that? A combobox standard behavior in windows
is that when you click the [v] button, it will show a list, and when
you leave the control the list will dissapear, which is logical as the
focus is on another control.

Frans


Hi Frans,

For example the combobox is used for searching customer number (string), if
I enter in the text field "0005" and click the drop down arrow it will
display a list of "00051, 00052, 00053, 00054", I can select one of them.

If I enter "00053" and press tab, it's ok too because the customer 00053
does exist ...

But if I enter "0005" and press tab, there is no customer number 0005 so I
want to display the list automatically as if I click the drop down arrow
...

Actually I don't want this behavior, but our client wants it so -:)

Thanks
Then display it as a ComboBoxStyle.S imple so the list is always visible.
Good luck with your project,

Otis Mukinfus
http://www.arltex.com
http://www.tomchilders.com
Sep 18 '06 #4
You can drop the list portion of a combo box programatically using Windows
SendMessage API. To do so in C#:

// Declare the following in your class

[DllImport("user 32.dll")]
public static extern int SendMessage(int hWnd, int msg, int wParam, IntPtr
lParam);
public const int CB_SHOWDROPDOWN = 0x14F;

// In the leave event of combobox, use the following code:

SendMessage(com boBox1.Handle.T oInt32(), CB_SHOWDROPDOWN , 1, IntPtr.Zero);
--
Nand Kishore Gupta
"hung tran" wrote:
Hi,

I'd like to drop down a combobox after validating the Leave() event, how
can I do that ?

Thanks
Sep 18 '06 #5
You don't need P/Invoke for this. Just set the DroppedDown property to true

/claes

"Nand Kishore Gupta" <Na************ **@discussions. microsoft.comwr ote in
message news:9C******** *************** ***********@mic rosoft.com...
You can drop the list portion of a combo box programatically using Windows
SendMessage API. To do so in C#:

// Declare the following in your class

[DllImport("user 32.dll")]
public static extern int SendMessage(int hWnd, int msg, int wParam, IntPtr
lParam);
public const int CB_SHOWDROPDOWN = 0x14F;

// In the leave event of combobox, use the following code:

SendMessage(com boBox1.Handle.T oInt32(), CB_SHOWDROPDOWN , 1, IntPtr.Zero);
--
Nand Kishore Gupta
"hung tran" wrote:
>Hi,

I'd like to drop down a combobox after validating the Leave() event, how
can I do that ?

Thanks

Sep 18 '06 #6
Oh, sorry, I forgot to mention it's an Infragistics UltraCombo
control, I thought it's almost the same as MS combobox but it does not
have DroppedDown property and SendMessage didn't work too.

But I found out it has a method ToggleDropDown( ), in the Leave event I
have to focus on other control first then call ToggleDropDown( ), work
ok now ...

Thank you all for your help.

Tran

On Mon, 18 Sep 2006 16:29:52 -0400, "Claes Bergefall"
<lo*****@nospam .nospamwrote:

:>You don't need P/Invoke for this. Just set the DroppedDown property to true
:>
: /claes
:>
:>"Nand Kishore Gupta" <Na************ **@discussions. microsoft.comwr ote in
:>message news:9C******** *************** ***********@mic rosoft.com...
:>You can drop the list portion of a combo box programatically using Windows
:>SendMessage API. To do so in C#:
:>>
:>// Declare the following in your class
:>>
:>[DllImport("user 32.dll")]
:>public static extern int SendMessage(int hWnd, int msg, int wParam, IntPtr
:>lParam);
:>public const int CB_SHOWDROPDOWN = 0x14F;
:>>
:>// In the leave event of combobox, use the following code:
:>>
:>SendMessage(c omboBox1.Handle .ToInt32(), CB_SHOWDROPDOWN , 1, IntPtr.Zero);
:>--
:>Nand Kishore Gupta
:>>
:>>
:>"hung tran" wrote:
:>>
:>>Hi,
:>>>
:>>I'd like to drop down a combobox after validating the Leave() event, how
:>>can I do that ?
:>>>
:>>Thanks
:>>>
:>
Sep 18 '06 #7
On Tue, 19 Sep 2006 00:50:42 +0200, om*****@gmx.net wrote:
>Oh, sorry, I forgot to mention it's an Infragistics UltraCombo
control, I thought it's almost the same as MS combobox but it does not
have DroppedDown property and SendMessage didn't work too.
<Rolls eyes<G>
>But I found out it has a method ToggleDropDown( ), in the Leave event I
have to focus on other control first then call ToggleDropDown( ), work
ok now ...
<Rolls eyes even moreCool! Problem solved.

--
Posted via a free Usenet account from http://www.teranews.com

Sep 18 '06 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
2602
by: Andy Bates | last post by:
I've got what at first appears to be a really simple problem. I have a dropdown combobox with a list of names in, the user can enter text into the edit portion or drop the combobox and select a name. What I need to do is to drop the combobox when the user types and find the nearest entry to what the user entered (so if they typed A, Andy may be the nearest entry, the list should scroll, but not select, unless the user uses arrow down...
3
1305
by: Angel | last post by:
is there a combo box that a user can key something in or select from the drop down list? i added the webcontrol drop down but there is no property to allow the user to key into the text portion of the control. thanks
3
6160
by: Don Wash | last post by:
Hi There! I have a Server-side Drop-down box in ASP.NET (VB) page. What do I do to widen the Drop down box's Pull-Down list's width? I'm not talking about the Drop-down box's width but the box that appear when user clicks the drop-down arrow button. Because items in the Drop down list are a little long, user can't see the full thing when they pull down the items from the drop down list.
3
3204
by: excel_hari | last post by:
Hi, I couldnt locate a Classic ASP group hence posting here. One of my colleagues has designed an intranet site and one of the pages has a drop-down box with close to 300 options. I want to navigate to the desired option quickly just by typing out the name. For example if I want to choose "Other" (All the options are arranged alhabetically within the Drop-down box) from Drop-down and if I Type "O" then I navigate to first entry with...
17
14817
by: Aussie Rules | last post by:
Hi, I want to have a single line combo box dropdown, but where i can selected multiple items in the drop down via a check box... I can see one in the standard tool box... is there one ? If not any suggestions as to where to get one from.
0
2102
by: TD | last post by:
I have a combobox that is sometimes slow to drop down when clicked on. If you select an item in the list that is near the top of the list then the next time you click on the combobox it drops down fast for you to make another selection. If you click on an item from the list that is way down the list then the next time you click on the combobox it takes several seconds for it to drop down so you can make another selection The combobox is...
6
2365
by: zacks | last post by:
I have an application I am developing that has a Combo Box that is intended to show a list of available tables in the selected DSN. I have put code in the control's DropDown event handler to clear the item list and reload it from the currently specified DSN (in a Text Box control on the same form). This works well. BUT ... if the specified DSN is invalid, I can display an appropriate error message, but then then empty dropdown list is...
3
3540
by: - HAL9000 | last post by:
I am trying to get an event when the drop-down Combo Box goes away / reverts back to showing a single item. For example, clicking the box's down arrow, to remove the drop-down window, doesn't seem to generate any event. Not even a mouse event. That seems a little odd. Besides not finding a public event method, I can't seem to find a protected method to over-ride either.
3
5909
by: jcassan | last post by:
Hello folks. I am new to these forums and have something, which has been stumping me for little while. I am using pspell to spellcheck a scrolling textbox (textarea) containing user input. I analyze each word and rebuild the text string as a combination of correct text (not misspelled) and a drop down list offering suggestions in place of any misspelled words. Pretty common stuff using pspell. I display the new string so that the user...
0
8999
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8836
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
9338
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8260
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6080
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4712
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
3322
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2798
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2223
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.