Perhaps it is because it is the end of the day and my eyes are tired of
looking at code but I cannot seem to figure out what I am doing wrong and
what I can do (if anything) to fix it.
On a Windows form, I have a ToolStripComboB ox object with a handful of
entries in the Items collection. I would like to change the text of the
ToolStripComboB ox object (using the Text property) to something other than
the text of one of the items in the items collection. For example, if the
items in the Items collection were "Item A", "Item B", and "Item C", I would
like to be able to set the text to "Item Z". If I manually type the text in,
it works. If I set the Text property at runtime, the text remains to be that
of the currently selected item.
Any suggestions on how to get around this will be greatly appreciated.
Thank you,
Jason Richmeier 2 4907
I was a bit baffled when I grabbed a copy of your test project and it worked
as expected. This led me to believe that there was something different
between your project and mine.
In my project, I am using the SelectedIndexCh anged event and it is in this
event where I am attempting to change the Text propery of the
ToolStripComboB ox object. When I add this event handler to your test project
and attempt to set the Text property there, it behaves just like my project
does. From my observation (which may be inaccurate), it appears that the
Text property gets set to what I set it to and then it is set back to the
text of the drop down list item sometime after the event handler finishes
execution. I am not sure how to get around this.
If you have any more suggestions I would greatly appreciate it.
Thank you,
Jason Richmeier
""Jeffrey Tan[MSFT]"" wrote: Hi Jason ,
Thanks for your post!
I have created a little test project regarding your issue, however, I can manipulate the ToolStripComboB ox.Text property at runtime without any problem. Attached is the test project. You can download it with Outlook Express, not IE.
Hope this helps!
Best regards, Jeffrey Tan Microsoft Online Community Support =============== =============== =============== ===== When responding to posts, please "Reply to Group" via your newsreader so that others may learn and benefit from your issue. =============== =============== =============== ===== This posting is provided "AS IS" with no warranties, and confers no rights
Hi Jason ,
Thanks for your feedback!
Yes, with SelectedIndexCh anged event, I can reproduce out this problem.
After doing some debugging, I think the problem stems from native Win32
combobox behavior. The native combobox sends us the CBN_SELCHANGE
notification (= SelectedIndexCh anged event) using SendMessage rather than
PostMessage. So its quite possible that the native combo does extra stuff
on return from this call. Its also possible they simply ignore certain
changes that occur during this message. For example, setting text has no
effect, but changing the selected index does seem to work.
Regarding this issue, we can use Control.BeginIn voke method to queue
another delegate on the UI thread, then this delegate will execute after
the SelectedIndexCh anged event, which works well in our scenario. Like this:
private void SetComboBoxTest ()
{
this.toolStripC omboBox1.Text += "test";
}
private void toolStripComboB ox1_SelectedInd exChanged(objec t sender,
EventArgs e)
{
this.BeginInvok e(new MethodInvoker(S etComboBoxTest) , null);
}
This works well in the sample project.
Hope this helps!
Best regards,
Jeffrey Tan
Microsoft Online Community Support
=============== =============== =============== =====
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
=============== =============== =============== =====
This posting is provided "AS IS" with no warranties, and confers no rights. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Mike |
last post by:
The following (C#) code snippet sets the text property of a label to null,
then tests it for null, only to find out that is isn't. Can anyone explain
why?
Label1.Text = null;
if (Label1.Text == null) {
Label2.Text = "Is null";
} else {
Label2.Text = "Is not null";
}
|
by: Job Lot |
last post by:
How can i bind ToolStripComboBox to a DataTable?
There is no DataSource, DisplayMember & ValueMemeber property?
Thanks
|
by: bds |
last post by:
Is there any way to databind a ToolStripComboBox?
I have a form where I'd like a databound combobox to be the parameter
selection of a DataGridView. This combobox comes from a table with your
basic two column id and description fields. I'm interested in displaying the
descriptions in the combobox and having the id be used for the parameter.
I can see how this can be done with a simple combobox, but I do not see
DataBinding for the...
|
by: MLH |
last post by:
Combo box LimitToList property setting of No does not
prevent the MS Access error "The text you enter must
match an entry in the list" from popping up. What makes
this bad is that the error is not a capturable error.
My list has 2 fields: and . The
2nd column is the bound column.
Here's the RowSource property setting:
Select , From ;
|
by: Frank Yamrick |
last post by:
I am trying to program an application that requires a
large number of screnes that are very similar in the
respect that all the bottons and labels interact with each
other with the same relationship. If possible, it seems
it would be easier to set up one standard page where the
text is blank for each radiobutton, button, or label. The
text would then be filled in by specifying the dataset and
databinding information via code under the...
| |
by: Manuel |
last post by:
How can I add an item to a ToolStripComboBox and specify a DisplayMember and
a ValueMember?
|
by: laredotornado |
last post by:
Hi,
I'm using PHP 4.4.4 on Apache 2 on Fedora Core 5. PHP was installed
using Apache's apxs and the php library was installed to
/usr/local/php. However, when I set my "error_reporting" setting to be
"E_ALL", notices are still not getting reported. The perms on my file
are 664, with owner root and group root. The php.ini file is located
at /usr/local/lib/php/php.ini. Any ideas why the setting does not seem
to be having an effect? ...
|
by: Ronald S. Cook |
last post by:
In a .NET Windows app, if I set somehting like the title of the form to
"MyApp" at run-time, will that make the app run slightly slower than if I
had set the title at design-time?
Thanks,
Ron
|
by: McPolu |
last post by:
Hello.
I am trying to set ToolStripComboBox.DroppedDown inside of the Leave
event and it does not work:
public class MyToolStripComboBox : ToolStripComboBox
{
public MyToolStripComboBox()
{
Leave += new EventHandler(ExtendedToolStripComboBox_Leave);
|
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,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
| |
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
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...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
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...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
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
| |
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...
| |