Tabs and ComboBoxes Repost | |
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...200&sloc=en-us | | | | re: Tabs and ComboBoxes Repost
Hi,
"Steve B." <SteveB@discussions.microsoft.com> wrote in message
news:A38F1CE3-0110-4676-94DA-0F29EC7A9648@microsoft.com...[color=blue]
> 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...200&sloc=en-us
>[/color]
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 | | | | re: Tabs and ComboBoxes Repost
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
Steve
"Bart Mermuys" wrote:
[color=blue]
> Hi,
>
> "Steve B." <SteveB@discussions.microsoft.com> wrote in message
> news:A38F1CE3-0110-4676-94DA-0F29EC7A9648@microsoft.com...[color=green]
> > 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...200&sloc=en-us
> >[/color]
>
> 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
>
>
>
>[/color] | | | | re: Tabs and ComboBoxes Repost
Hi,
"Steve B." <SteveB@discussions.microsoft.com> wrote in message
news:1BCAFA7F-92E7-4114-A469-1BA229AE4275@microsoft.com...[color=blue]
> 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[/color]
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
[color=blue]
>
> Steve
>
> "Bart Mermuys" wrote:
>[color=green]
>> Hi,
>>
>> "Steve B." <SteveB@discussions.microsoft.com> wrote in message
>> news:A38F1CE3-0110-4676-94DA-0F29EC7A9648@microsoft.com...[color=darkred]
>> > 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...200&sloc=en-us
>> >[/color]
>>
>> 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
>>
>>
>>
>>[/color][/color] | | | | re: Tabs and ComboBoxes Repost
Bart,
I want/wish to thank you very much it appears that works excellent, I can't
tell you the hours I spent... One of the problems I have with the framework
is understanding what exactly is a binding, bindingContext, currencyManager,
etc so every time I run against it - I have a problem.
Bart, in a different matter, I'm sort of at a turning point with this local
ADO.Net application and would like to hear your comments on couple serous
problems I'm having, for example, I'm not sure if its the structure problem
or the underlying database.
I'd like to pose the questions to you if I can, please let me know.
Steve
"Bart Mermuys" wrote:
[color=blue]
> Hi,
>
> "Steve B." <SteveB@discussions.microsoft.com> wrote in message
> news:1BCAFA7F-92E7-4114-A469-1BA229AE4275@microsoft.com...[color=green]
> > 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[/color]
>
> 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
>[color=green]
> >
> > Steve
> >
> > "Bart Mermuys" wrote:
> >[color=darkred]
> >> Hi,
> >>
> >> "Steve B." <SteveB@discussions.microsoft.com> wrote in message
> >> news:A38F1CE3-0110-4676-94DA-0F29EC7A9648@microsoft.com...
> >> > 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...200&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
> >>
> >>
> >>
> >>[/color][/color]
>
>
>[/color] | | | | re: Tabs and ComboBoxes Repost
Hi,
"Steve B." <SteveB@discussions.microsoft.com> wrote in message
news:11BBA399-4E03-4652-ACC1-2C5135E2D6C0@microsoft.com...[color=blue]
> Bart,
>
> I want/wish to thank you very much it appears that works excellent, I
> can't
> tell you the hours I spent... One of the problems I have with the
> framework
> is understanding what exactly is a binding, bindingContext,
> currencyManager,
> etc so every time I run against it - I have a problem.[/color]
To put it simple:
A BindingContext is a collection (map) that contains PropertyManager's
and/or CurrencyManager's. By default each Form has a BindingContext and is
implicitly shared by the controls.
A CurrencyManager is used when you bind to a list and it manages the
position and Binding's.
A PropertyManagers is used when you bind to a single object and it manages
Binding's.
Internally a Binding binds a Control property to a CurrencyManager or
PropertyManager.
[color=blue]
>
> Bart, in a different matter, I'm sort of at a turning point with this
> local
> ADO.Net application and would like to hear your comments on couple serous
> problems I'm having, for example, I'm not sure if its the structure
> problem
> or the underlying database.
>
> I'd like to pose the questions to you if I can, please let me know.[/color]
You may get a 'broader' response if you ask it to a related newsgroup, but
if you want, you can email me, remove the spam part.
HTH,
Greetings
[color=blue]
>
> Steve
>
>
>
>
>
> "Bart Mermuys" wrote:
>[color=green]
>> Hi,
>>
>> "Steve B." <SteveB@discussions.microsoft.com> wrote in message
>> news:1BCAFA7F-92E7-4114-A469-1BA229AE4275@microsoft.com...[color=darkred]
>> > 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[/color]
>>
>> 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
>>[color=darkred]
>> >
>> > Steve
>> >
>> > "Bart Mermuys" wrote:
>> >
>> >> Hi,
>> >>
>> >> "Steve B." <SteveB@discussions.microsoft.com> wrote in message
>> >> news:A38F1CE3-0110-4676-94DA-0F29EC7A9648@microsoft.com...
>> >> > 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...200&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
>> >>
>> >>
>> >>
>> >>[/color]
>>
>>
>>[/color][/color] | | | | re: Tabs and ComboBoxes Repost
Thanks Bart. I tried to be brief below
I’m using VS for development. My local application is described as a top
level simple form with dropdown menus. The items in the menu link to
internal MS-Office network share drive documents or web pages. A couple of
these menu items link to an ADO.Net Interface in which the underlying dB is
MS-Access. The Interfaces provides Add, Delete, Change, DataGrid/dB
functionality. The adjacent bound DG ComboBoxes on the form display’s the
“selected” row in the DG
One of these Interfaces is quite complex containing approx 110 string fields
in the Main table of the dB. The ADO.Net interface that addresses this Main
table is modeled after a simpler Interface of 15 fields that works fine.
Both the simple and complex ADO.Net Interfaces utilize a common inherited
Interface file/class containing all the common ADO.Net methods.
Problem #1
FYI, the VS DataAdapter wizard limits itself to 100 fields. So I said O’K,
let’s do 90 fields and worry about the other ones later and get 90 working
and loaded. The 90 fields loaded into the DG and associated CB’s fine.
Here’s the problem, I can’t manipulate the data. If I try to change a field
in one of the 90 fields of the DG and try to save this Update to the dB I’ll
get a “Expression is to Complex” error message. I haven't bther tring the
other functionalities.
Proposed Solution #1
I’m going to strip the DA and DS from the automatically generated
InitializeComponent() code and put it all manually in my code. I hope this
stops the error and allows me to add the 110 fields. I’m doing that now.
Comments? Let me also say I recognize dB Normalization.
Problem #2
The complex Interface discussed above is a dll which is developed/debugged
on my machine and then the whole application is Released compiled to the
network. The problem is that sometimes and only sometimes the dll won’t
close(). I don’t know if a user doesn’t close it properly but I can’t trace
the problem. There’s only one thread in the program and I’ve tried stuff
like GC. All I know is when I try to Release compile I get an error message
saying basically that can’t compile that portion of the application because
that file is open and the file is definitely not open at 5:30am.
Fix #2
I have to get the IT guy, go to the server open all the running process on
the server, find my running database dll process and close it. I can’t see
it locally on my machine. After that I can Release compile fine. Why
doesn’t the dll close?
Problem #3 (BUG?)
When the program is not running and if I click on a Tab full of bound CB’s
and have focus on a Tab and then try to close VS I get the following error
massage: “The following exception has occurred, DataBinding could not find a
row in the list suitable for all bindings”..Is this a bug or a sign of the
stability of my program?
Will SQL Server help me in general?
My next step is contacting MS for assistance.
Steve | | | | re: Tabs and ComboBoxes Repost
Hi,
"Steve B." <SteveB@discussions.microsoft.com> wrote in message
news:8C603717-4E1A-448E-91DE-FEA76B6AD8E0@microsoft.com...[color=blue]
> Thanks Bart. I tried to be brief below
>
> I'm using VS for development. My local application is described as a top
> level simple form with dropdown menus. The items in the menu link to
> internal MS-Office network share drive documents or web pages. A couple
> of
> these menu items link to an ADO.Net Interface in which the underlying dB
> is
> MS-Access. The Interfaces provides Add, Delete, Change, DataGrid/dB
> functionality. The adjacent bound DG ComboBoxes on the form display's the
> "selected" row in the DG
>
> One of these Interfaces is quite complex containing approx 110 string
> fields
> in the Main table of the dB. The ADO.Net interface that addresses this
> Main
> table is modeled after a simpler Interface of 15 fields that works fine.
> Both the simple and complex ADO.Net Interfaces utilize a common inherited
> Interface file/class containing all the common ADO.Net methods.
>
> Problem #1
> FYI, the VS DataAdapter wizard limits itself to 100 fields. So I said O'K,
> let's do 90 fields and worry about the other ones later and get 90 working
> and loaded. The 90 fields loaded into the DG and associated CB's fine.
> Here's the problem, I can't manipulate the data. If I try to change a
> field
> in one of the 90 fields of the DG and try to save this Update to the dB I'll
> get a "Expression is to Complex" error message. I haven't bther tring the
> other functionalities.
>
> Proposed Solution #1
> I'm going to strip the DA and DS from the automatically generated
> InitializeComponent() code and put it all manually in my code. I hope
> this
> stops the error and allows me to add the 110 fields. I'm doing that now.
> Comments? Let me also say I recognize dB Normalization.[/color]
You're getting "Expression is to Complex" because the generated update query
checks whether the old values are still the same to provide optimistic
concurrency, but this causes a lot of AND's in the WHERE clause and the
number is limited with Jet to 40. You could create your own query whithout
checking the old values (no ANDs) but then you loose optimistic concurrency
control. I've never dealt with that many columns.
[color=blue]
>
> Problem #2
> The complex Interface discussed above is a dll which is developed/debugged
> on my machine and then the whole application is Released compiled to the
> network. The problem is that sometimes and only sometimes the dll won't
> close(). I don't know if a user doesn't close it properly but I can't
> trace
> the problem. There's only one thread in the program and I've tried stuff
> like GC. All I know is when I try to Release compile I get an error
> message
> saying basically that can't compile that portion of the application
> because
> that file is open and the file is definitely not open at 5:30am.
>
> Fix #2
> I have to get the IT guy, go to the server open all the running process on
> the server, find my running database dll process and close it. I can't
> see
> it locally on my machine. After that I can Release compile fine. Why
> doesn't the dll close?[/color]
No idea why the dll remains open. If you are using threads then makes sure
they end when the program gets closed. If non-background threads aren't
ended they keep your program running.
[color=blue]
>
> Problem #3 (BUG?)
> When the program is not running and if I click on a Tab full of bound CB's
> and have focus on a Tab and then try to close VS I get the following error
> massage: "The following exception has occurred, DataBinding could not
> find a
> row in the list suitable for all bindings"..Is this a bug or a sign of the
> stability of my program?[/color]
That sounds like a bug.
[color=blue]
>
> Will SQL Server help me in general?[/color]
There is a lot of difference between sqlserver and access, first of all
access is a file database while sql server is a server database. A lot of
people don't consider access a "real" database. But you should be able to
find lots of information (about the differences) on the internet.
Sorry i couldn't be more helpfull, maybe someone else might still help.
Greetings
[color=blue]
> My next step is contacting MS for assistance.
>
> Steve[/color] | | | | re: Tabs and ComboBoxes Repost
Thank You Bart. I was hoping SQL Server might solve problem 1. I do start a
thread when the program starts to tell the user if the program is already
running but anyways thank you for you time.
Steve
"Bart Mermuys" wrote:
[color=blue]
> Hi,
>
> "Steve B." <SteveB@discussions.microsoft.com> wrote in message
> news:8C603717-4E1A-448E-91DE-FEA76B6AD8E0@microsoft.com...[color=green]
> > Thanks Bart. I tried to be brief below
> >
> > I'm using VS for development. My local application is described as a top
> > level simple form with dropdown menus. The items in the menu link to
> > internal MS-Office network share drive documents or web pages. A couple
> > of
> > these menu items link to an ADO.Net Interface in which the underlying dB
> > is
> > MS-Access. The Interfaces provides Add, Delete, Change, DataGrid/dB
> > functionality. The adjacent bound DG ComboBoxes on the form display's the
> > "selected" row in the DG
> >
> > One of these Interfaces is quite complex containing approx 110 string
> > fields
> > in the Main table of the dB. The ADO.Net interface that addresses this
> > Main
> > table is modeled after a simpler Interface of 15 fields that works fine.
> > Both the simple and complex ADO.Net Interfaces utilize a common inherited
> > Interface file/class containing all the common ADO.Net methods.
> >
> > Problem #1
> > FYI, the VS DataAdapter wizard limits itself to 100 fields. So I said O'K,
> > let's do 90 fields and worry about the other ones later and get 90 working
> > and loaded. The 90 fields loaded into the DG and associated CB's fine.
> > Here's the problem, I can't manipulate the data. If I try to change a
> > field
> > in one of the 90 fields of the DG and try to save this Update to the dB I'll
> > get a "Expression is to Complex" error message. I haven't bther tring the
> > other functionalities.
> >
> > Proposed Solution #1
> > I'm going to strip the DA and DS from the automatically generated
> > InitializeComponent() code and put it all manually in my code. I hope
> > this
> > stops the error and allows me to add the 110 fields. I'm doing that now.
> > Comments? Let me also say I recognize dB Normalization.[/color]
>
> You're getting "Expression is to Complex" because the generated update query
> checks whether the old values are still the same to provide optimistic
> concurrency, but this causes a lot of AND's in the WHERE clause and the
> number is limited with Jet to 40. You could create your own query whithout
> checking the old values (no ANDs) but then you loose optimistic concurrency
> control. I've never dealt with that many columns.
>[color=green]
> >
> > Problem #2
> > The complex Interface discussed above is a dll which is developed/debugged
> > on my machine and then the whole application is Released compiled to the
> > network. The problem is that sometimes and only sometimes the dll won't
> > close(). I don't know if a user doesn't close it properly but I can't
> > trace
> > the problem. There's only one thread in the program and I've tried stuff
> > like GC. All I know is when I try to Release compile I get an error
> > message
> > saying basically that can't compile that portion of the application
> > because
> > that file is open and the file is definitely not open at 5:30am.
> >
> > Fix #2
> > I have to get the IT guy, go to the server open all the running process on
> > the server, find my running database dll process and close it. I can't
> > see
> > it locally on my machine. After that I can Release compile fine. Why
> > doesn't the dll close?[/color]
>
> No idea why the dll remains open. If you are using threads then makes sure
> they end when the program gets closed. If non-background threads aren't
> ended they keep your program running.
>[color=green]
> >
> > Problem #3 (BUG?)
> > When the program is not running and if I click on a Tab full of bound CB's
> > and have focus on a Tab and then try to close VS I get the following error
> > massage: "The following exception has occurred, DataBinding could not
> > find a
> > row in the list suitable for all bindings"..Is this a bug or a sign of the
> > stability of my program?[/color]
>
> That sounds like a bug.
>[color=green]
> >
> > Will SQL Server help me in general?[/color]
>
> There is a lot of difference between sqlserver and access, first of all
> access is a file database while sql server is a server database. A lot of
> people don't consider access a "real" database. But you should be able to
> find lots of information (about the differences) on the internet.
>
> Sorry i couldn't be more helpfull, maybe someone else might still help.
>
> Greetings
>[color=green]
> > My next step is contacting MS for assistance.
> >
> > Steve[/color]
>
>
>[/color] | | | | re: Tabs and ComboBoxes Repost
Bart ,
I been working with the bindingcontext since your last e-mail, however,
there's one problem I can't solve. I have an intial ADO.Net form that opens
up and displays the contents of dB in a DataGrid. Adjacent to the DG are
ComboBoxes that are databound in that when you change a row in the DG it
displays the row info in the CB's.
While the base Tab on the form displays basic part data the 4 additional
tabs display the 25 dimensional characteristics for the part. The
properties. or codes. for each of the 25 characteristics are exactly the same
set of data and are contained in the CB dropdowns.
The problem is I had to create 25 Datasets for each of the characteristic
properties/codes CB's (e.g. all the DS contain exactly the same info). The
question is with a DataBinding of the form, how do assign one DS for all the
CB's. I've tried lots of things and all kinds of BindingContext variations
(new, in code. etc).
Thanks
Steve
Example:
this.charaCode1CB.DataBindings.Add(new System.Windows.Forms.Binding("Text",
this.csiDbDS, "Main.CharacteristicCodes1"));
this.charaCode1CB.DataSource = this.charaCodeDS1;
this.charaCode1CB.DisplayMember = "CharacteristicTypes.CharacteristicType";
*************
this.charaCode2CB.DataBindings.Add(new System.Windows.Forms.Binding("Text",
this.csiDbDS, "Main.CharacteristicCodes2"));
this.charaCode2CB.DataSource = this.this.charaCodeDS2;
this.charaCode2CB.DisplayMember = "CharacteristicTypes.CharacteristicType";
..
..
..
"Bart Mermuys" wrote:
[color=blue]
> Hi,
>
> "Steve B." <SteveB@discussions.microsoft.com> wrote in message
> news:A38F1CE3-0110-4676-94DA-0F29EC7A9648@microsoft.com...[color=green]
> > 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...200&sloc=en-us
> >[/color]
>
> 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
>
>
>
>[/color] | | | | re: Tabs and ComboBoxes Repost
Hi,
"Steve B." <SteveB@discussions.microsoft.com> wrote in message
news:94AF49E0-D865-4690-94BC-E3B2BFEBF32D@microsoft.com...[color=blue]
> Bart ,
>
> I been working with the bindingcontext since your last e-mail, however,
> there's one problem I can't solve. I have an intial ADO.Net form that
> opens
> up and displays the contents of dB in a DataGrid. Adjacent to the DG are
> ComboBoxes that are databound in that when you change a row in the DG it
> displays the row info in the CB's.
>
> While the base Tab on the form displays basic part data the 4 additional
> tabs display the 25 dimensional characteristics for the part. The
> properties. or codes. for each of the 25 characteristics are exactly the
> same
> set of data and are contained in the CB dropdowns.
>
> The problem is I had to create 25 Datasets for each of the characteristic
> properties/codes CB's (e.g. all the DS contain exactly the same info).
> The
> question is with a DataBinding of the form, how do assign one DS for all
> the
> CB's. I've tried lots of things and all kinds of BindingContext
> variations
> (new, in code. etc).
>
> Thanks
> Steve
>
> Example:[/color]
You explained what you're doing but not what the problem is you're having.
I assume all ComboBox's navigated thogether, because they had the same
DataSource and same BindingContext. You can't use a different
BindingContext for each ComboBox because of the fact that they still need
the same CurrencyManager for the master table ( csiDbDS.Main ). So the best
way to deal with this is using a different DataView for each ComboBox:
this.charaCode1CB.DataBindings.Add(new System.Windows.Forms.Binding("Text",
this.csiDbDS, "Main.CharacteristicCodes1"));
this.charaCode1CB.DataSource = new
DataView(this.charaCodeDS1.Tables["CharacteristicTypes"]);
this.charaCode1CB.DisplayMember = "CharacteristicType";
this.charaCode2CB.DataBindings.Add(new System.Windows.Forms.Binding("Text",
this.csiDbDS, "Main.CharacteristicCodes2"));
this.charaCode2CB.DataSource = new
DataView(this.charaCodeDS1.Tables["CharacteristicTypes"]);
this.charaCode2CB.DisplayMember = "CharacteristicType";
HTH,
Greetings
[color=blue]
>
> "Bart Mermuys" wrote:
>[color=green]
>> Hi,
>>
>> "Steve B." <SteveB@discussions.microsoft.com> wrote in message
>> news:A38F1CE3-0110-4676-94DA-0F29EC7A9648@microsoft.com...[color=darkred]
>> > 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...200&sloc=en-us
>> >[/color]
>>
>> 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
>>
>>
>>
>>[/color][/color] | | | | re: Tabs and ComboBoxes Repost
Bart,
You’re a genius thank you it appears to work fine.
Thank You very much, again
Steve
"Bart Mermuys" wrote:
[color=blue]
> Hi,
>
> "Steve B." <SteveB@discussions.microsoft.com> wrote in message
> news:94AF49E0-D865-4690-94BC-E3B2BFEBF32D@microsoft.com...[color=green]
> > Bart ,
> >
> > I been working with the bindingcontext since your last e-mail, however,
> > there's one problem I can't solve. I have an intial ADO.Net form that
> > opens
> > up and displays the contents of dB in a DataGrid. Adjacent to the DG are
> > ComboBoxes that are databound in that when you change a row in the DG it
> > displays the row info in the CB's.
> >
> > While the base Tab on the form displays basic part data the 4 additional
> > tabs display the 25 dimensional characteristics for the part. The
> > properties. or codes. for each of the 25 characteristics are exactly the
> > same
> > set of data and are contained in the CB dropdowns.
> >
> > The problem is I had to create 25 Datasets for each of the characteristic
> > properties/codes CB's (e.g. all the DS contain exactly the same info).
> > The
> > question is with a DataBinding of the form, how do assign one DS for all
> > the
> > CB's. I've tried lots of things and all kinds of BindingContext
> > variations
> > (new, in code. etc).
> >
> > Thanks
> > Steve
> >
> > Example:[/color]
>
> You explained what you're doing but not what the problem is you're having.
> I assume all ComboBox's navigated thogether, because they had the same
> DataSource and same BindingContext. You can't use a different
> BindingContext for each ComboBox because of the fact that they still need
> the same CurrencyManager for the master table ( csiDbDS.Main ). So the best
> way to deal with this is using a different DataView for each ComboBox:
>
> this.charaCode1CB.DataBindings.Add(new System.Windows.Forms.Binding("Text",
> this.csiDbDS, "Main.CharacteristicCodes1"));
> this.charaCode1CB.DataSource = new
> DataView(this.charaCodeDS1.Tables["CharacteristicTypes"]);
> this.charaCode1CB.DisplayMember = "CharacteristicType";
>
> this.charaCode2CB.DataBindings.Add(new System.Windows.Forms.Binding("Text",
> this.csiDbDS, "Main.CharacteristicCodes2"));
> this.charaCode2CB.DataSource = new
> DataView(this.charaCodeDS1.Tables["CharacteristicTypes"]);
> this.charaCode2CB.DisplayMember = "CharacteristicType";
>
>
> HTH,
> Greetings
>
>[color=green]
> >
> > "Bart Mermuys" wrote:
> >[color=darkred]
> >> Hi,
> >>
> >> "Steve B." <SteveB@discussions.microsoft.com> wrote in message
> >> news:A38F1CE3-0110-4676-94DA-0F29EC7A9648@microsoft.com...
> >> > 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...200&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
> >>
> >>
> >>
> >>[/color][/color]
>
>
>[/color] |  | Similar C# / C Sharp bytes | | | /bytes/about
We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights.
Get the best answers to your questions from over 226,387 network members.
|