Re: Tabs and ComboBoxes Repost

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



Hi,

"Steve B." <SteveB@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:1BCAFA7F-92E7-4114-A469-1BA229AE4275@xxxxxxxxxxxxxxxx
> Bart,
>
> Thank You
>
> I figured it had to be something like that (I know about the two -1's),
> but
> where do I put your code; in a Tab event? and what about the user
> selection.
> Anyways, I'll try to implement your suggestion, any more info is
> appreciated

You want the ComboBox's to be cleared (even when the user switches tabs)
until the user selects something, right ? If so then all you should have to
do is run the code in the previous post just once, eg. at Form load, no need
to use tab events.

Form_Load:
comboBox1.BindingContext = this.BindingContext;
...

hth,
Greetings

>
> Steve
>
> "Bart Mermuys" wrote:
>
>> 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: Sankey Retaining RIng
    ... Make sure the spear is seated and twisted with the tab under the lip. ... O.K. So I am reading all of this, and thinking about the Pony Keg I have ... Turn over and empty. ...
    (rec.crafts.brewing)
  • Re: cant create new mailbox
    ... If the Email Address tab is empty, you've got a problem with your Recipient ... For Exchange news, links and tips, check: ... > I had tried run the "rebuild" command from Recepient update service. ...
    (microsoft.public.exchange.admin)
  • Re: Which SKU has Web Services wizards- DO YOU HAVE PRO?
    ... "Thomas Miller" wrote in message ... I would hope the tab would not be available if the tab was empty. ... BSS Enterprise Accounting FrameWork ...
    (borland.public.delphi.non-technical)
  • Permission entry without anything
    ... on several objects in AD (such as user or computer account) there is a weird thing on the Advanced permissions list in the object properties. ... The ACE is empty. ... the column Permission is empty. ... When I go to the properties of such an entry, the focus is on Properties tab, but still both Properties and Object tabs are empty. ...
    (microsoft.public.windows.server.active_directory)
  • Re: parse two field file
    ... linux/proc/filesystems file a sample of which I have included below: ... The first field can be "empty" and concist of only a single tab ... (The first "%s" will skip any leading white space, ...
    (comp.lang.c)