Re: Tabs and ComboBoxes Repost

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



Hi,

"Steve B." <SteveB@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:A38F1CE3-0110-4676-94DA-0F29EC7A9648@xxxxxxxxxxxxxxxx
> How can I keep the ComboBox textbox empty of datasource items when my
> local
> application starts AND keep them empty even after the user clicks
> different
> Tabs on the form.
>
> I welcome any questions. The problem isn't clearing the items from the CB
> textbox, the problem is I can't keep them empty when the user moves around
> the Tabs on the form. Each Tab has more CB's and, by the way of course, I
> need to keep user CB selections on each Tab.
>
> I think I can solve the problem by adding whitespace to the CB datasource
> (dB Table/Dataset). Do I need a Leave() event and variable for each CB?
> Tab
> Event? Suggestions welcome. I can't let this go.
>
> Previous post
> http://www.microsoft.com/communities/newsgroups/en-us/default.aspx?dg=microsoft.public.dotnet.languages.csharp&mid=f105eb74-be55-441d-bfe4-e1376e9f7200&sloc=en-us
>

When switching tabs BindingContextChanged (unnecessary) fires, when
BindingContextChanged is fired it also updates ComboBox.SelectedIndex from
CurrencyManager.Position. CurrencyManager.Position can only be -1 if the
list is empty, otherwise 0, so that's why each time the first item gets
selected when switching tabs.

By default, Control's use the BindingContext from the parent Form
implicitly. Assigning the Form's BindingContext _explicitly_ to the
ComboBox solves the problem.

eg. inside a Form:
comboBox1.BindingContext = this.BindingContext;
comboBox1.DataSource = .... ;
comboBox1.SelectedIndex = -1;
comboBox1.SelectedIndex = -1; // twice because of another bug


Note: that in NET2.0 both bugs are gone.

HTH,
Greetings



.



Relevant Pages

  • Re: Tabs and ComboBoxes Repost
    ... I been working with the bindingcontext since your last e-mail, however, ... tabs display the 25 dimensional characteristics for the part. ... "Bart Mermuys" wrote: ... >> How can I keep the ComboBox textbox empty of datasource items when my ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Tabs and ComboBoxes Repost
    ... > tabs display the 25 dimensional characteristics for the part. ... I've tried lots of things and all kinds of BindingContext ... BindingContext for each ComboBox because of the fact that they still need ... >>> How can I keep the ComboBox textbox empty of datasource items when my ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: hi i am a girl who were trying a bit on C can someone help?
    ... You may want to take a look at the compiler warnings that get issued. ... your code, with those tabs set at ... >empty, empty); ... You may want to convert the if/else ladder into a switch statement. ...
    (comp.lang.c)
  • Re: Omniweb Quicktime question
    ... empty and loading nothing. ... Workspace> New Workspace; New Workspace dialog appears ... Open five blank tabs in a new window ... You can do this with any number of windows, tabs, etc., with any URLs ...
    (comp.sys.mac.apps)
  • Re: Omniweb tab question
    ... I would like 5 tabs - all ... empty and loading nothing. ... Been through the preferences and help, ...
    (comp.sys.mac.apps)