473,668 Members | 2,371 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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

Nov 19 '05 #1
11 2284
Hi,

"Steve B." <St****@discuss ions.microsoft. com> wrote in message
news:A3******** *************** ***********@mic rosoft.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 BindingContextC hanged (unnecessary) fires, when
BindingContextC hanged is fired it also updates ComboBox.Select edIndex 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.Bindi ngContext = this.BindingCon text;
comboBox1.DataS ource = .... ;
comboBox1.Selec tedIndex = -1;
comboBox1.Selec tedIndex = -1; // twice because of another bug
Note: that in NET2.0 both bugs are gone.

HTH,
Greetings

Nov 19 '05 #2
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:
Hi,

"Steve B." <St****@discuss ions.microsoft. com> wrote in message
news:A3******** *************** ***********@mic rosoft.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 BindingContextC hanged (unnecessary) fires, when
BindingContextC hanged is fired it also updates ComboBox.Select edIndex 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.Bindi ngContext = this.BindingCon text;
comboBox1.DataS ource = .... ;
comboBox1.Selec tedIndex = -1;
comboBox1.Selec tedIndex = -1; // twice because of another bug
Note: that in NET2.0 both bugs are gone.

HTH,
Greetings

Nov 20 '05 #3
Hi,

"Steve B." <St****@discuss ions.microsoft. com> wrote in message
news:1B******** *************** ***********@mic rosoft.com...
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.Bindi ngContext = this.BindingCon text;
...

hth,
Greetings

Steve

"Bart Mermuys" wrote:
Hi,

"Steve B." <St****@discuss ions.microsoft. com> wrote in message
news:A3******** *************** ***********@mic rosoft.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 BindingContextC hanged (unnecessary) fires, when
BindingContextC hanged is fired it also updates ComboBox.Select edIndex
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.Bindi ngContext = this.BindingCon text;
comboBox1.DataS ource = .... ;
comboBox1.Selec tedIndex = -1;
comboBox1.Selec tedIndex = -1; // twice because of another bug
Note: that in NET2.0 both bugs are gone.

HTH,
Greetings

Nov 20 '05 #4
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:
Hi,

"Steve B." <St****@discuss ions.microsoft. com> wrote in message
news:1B******** *************** ***********@mic rosoft.com...
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.Bindi ngContext = this.BindingCon text;
...

hth,
Greetings

Steve

"Bart Mermuys" wrote:
Hi,

"Steve B." <St****@discuss ions.microsoft. com> wrote in message
news:A3******** *************** ***********@mic rosoft.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 BindingContextC hanged (unnecessary) fires, when
BindingContextC hanged is fired it also updates ComboBox.Select edIndex
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.Bindi ngContext = this.BindingCon text;
comboBox1.DataS ource = .... ;
comboBox1.Selec tedIndex = -1;
comboBox1.Selec tedIndex = -1; // twice because of another bug
Note: that in NET2.0 both bugs are gone.

HTH,
Greetings


Nov 21 '05 #5
Hi,

"Steve B." <St****@discuss ions.microsoft. com> wrote in message
news:11******** *************** ***********@mic rosoft.com...
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.
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 PropertyManager s 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 .

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.
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


Steve

"Bart Mermuys" wrote:
Hi,

"Steve B." <St****@discuss ions.microsoft. com> wrote in message
news:1B******** *************** ***********@mic rosoft.com...
> 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.Bindi ngContext = this.BindingCon text;
...

hth,
Greetings
>
> Steve
>
> "Bart Mermuys" wrote:
>
>> Hi,
>>
>> "Steve B." <St****@discuss ions.microsoft. com> wrote in message
>> news:A3******** *************** ***********@mic rosoft.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 BindingContextC hanged (unnecessary) fires, when
>> BindingContextC hanged is fired it also updates ComboBox.Select edIndex
>> 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.Bindi ngContext = this.BindingCon text;
>> comboBox1.DataS ource = .... ;
>> comboBox1.Selec tedIndex = -1;
>> comboBox1.Selec tedIndex = -1; // twice because of another bug
>>
>>
>> Note: that in NET2.0 both bugs are gone.
>>
>> HTH,
>> Greetings
>>
>>
>>
>>


Nov 21 '05 #6
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
InitializeCompo nent() 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
Nov 21 '05 #7
Hi,

"Steve B." <St****@discuss ions.microsoft. com> wrote in message
news:8C******** *************** ***********@mic rosoft.com...
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
InitializeCompo nent() 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.
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.

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?
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.

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?
That sounds like a bug.

Will SQL Server help me in general?
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
My next step is contacting MS for assistance.

Steve

Nov 21 '05 #8
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:
Hi,

"Steve B." <St****@discuss ions.microsoft. com> wrote in message
news:8C******** *************** ***********@mic rosoft.com...
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
InitializeCompo nent() 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.


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.

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?


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.

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?


That sounds like a bug.

Will SQL Server help me in general?


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
My next step is contacting MS for assistance.

Steve


Nov 21 '05 #9
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.charaCode1 CB.DataBindings .Add(new System.Windows. Forms.Binding(" Text",
this.csiDbDS, "Main.Character isticCodes1"));
this.charaCode1 CB.DataSource = this.charaCodeD S1;
this.charaCode1 CB.DisplayMembe r = "Characteristic Types.Character isticType";
*************
this.charaCode2 CB.DataBindings .Add(new System.Windows. Forms.Binding(" Text",
this.csiDbDS, "Main.Character isticCodes2"));
this.charaCode2 CB.DataSource = this.this.chara CodeDS2;
this.charaCode2 CB.DisplayMembe r = "Characteristic Types.Character isticType";
..
..
..

"Bart Mermuys" wrote:
Hi,

"Steve B." <St****@discuss ions.microsoft. com> wrote in message
news:A3******** *************** ***********@mic rosoft.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 BindingContextC hanged (unnecessary) fires, when
BindingContextC hanged is fired it also updates ComboBox.Select edIndex 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.Bindi ngContext = this.BindingCon text;
comboBox1.DataS ource = .... ;
comboBox1.Selec tedIndex = -1;
comboBox1.Selec tedIndex = -1; // twice because of another bug
Note: that in NET2.0 both bugs are gone.

HTH,
Greetings

Nov 28 '05 #10

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

Similar topics

2
3888
by: zapazap | last post by:
-- Pythonic control of Windows GUI application: tabs and listviews Dear Snake-charming Gurus, I have learned to manipulate some controls ("Button", "ComboBox", etc) through such means as: win32gui.SendMessage(hwnd, win32con.BM_GETCHECK, 0 ,0) win32gui.SendMessage(hwnd, win32con.CB_GETCOUNT, 0 ,0)
4
1965
by: Kathy | last post by:
In my custom menu one menu item opens a form to add new Makes to TblMakes and another menu item opens a form to add new Models to TblModels. I have a form that has a combobox for Makes and a combobox for Models. In both comboboxes I use the NotInList event and code to allow users to enter Makes and Models that are not in the database. When the form is open, I want to limit the users to entering new Makes and Models in the comboboxes and not...
0
1930
by: johnson_cy | last post by:
I am using Access 2000. My main form has a record source of a table (employeeTbl with key of . It is filtering the record results. My subform and mainform have the link child/link master set to and the source object is the subform. My subform record source is a query from another table (vacationTbl). FYI: I was filtering on the subform, but removed it and replaced with
0
974
by: Steve B. | last post by:
How can I keep the text portion of my ComboBox (CB) clear of DataSource entries when my local application starts AND continue to keep them clear until the user makes a selection? I’ve tried changeTab events, SelectedIndex =-1 (e.g. twice), String.Empty and “ “. The problem is once I clear them I can’t keep them clear when the user clicks the Tabs. When the user clicks a different Tab the CB fill up with entries from the...
1
1310
by: Craig G | last post by:
for months we have been dabling round looking at various 3rd party comboboxes that allow the user to type text into the combobox as a search mechanism what we've found is that the likes of OpinatedGeek comboboxes do seem to work for exacrtly what we want to do but only if you use IE! if i try and run them in netscape navigator it falls over with errors on the load/rendering of the actual control itself so is there any 3rd party...
135
7445
by: Xah Lee | last post by:
Tabs versus Spaces in Source Code Xah Lee, 2006-05-13 In coding a computer program, there's often the choices of tabs or spaces for code indentation. There is a large amount of confusion about which is better. It has become what's known as “religious war” — a heated fight over trivia. In this essay, i like to explain what is the situation behind it, and which is proper.
2
11448
by: Matt | last post by:
Hi all, me again! :) I've now got an issue with combo boxes. Basically, I have a number of items that I want a user to pick from a single list. It's basically along the lines of: Fruit 1: Fruit 2: Fruit 3:
1
1343
by: mage | last post by:
That's about it, I've put a nine pages in tab-form on a form and have different fields on each tab from the same query. I want to filter by selection (pre-determined by each tab) when I click on that tab. Example, when I click (Tab) page 2 on the form, I see the some fields that are only relevant to a particular item I have on a query field, and now the entire form filters by selection all the records only containing such item. Is...
2
1989
by: Wingot | last post by:
Hey, I have a view to a database that I have created for Client Maintenance. It has a number of fields, but the important ones are Medical Condition, Bill To, and Country. I have a couple of external tables: One for Countries that store each Country as a ID (char(2)), and Name (varchar(50)) pair; One for Medical Conditions, using ID (int) and Name (varchar(50)). Also, the BillTo field refers back to the same table that is being...
0
8462
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, well explore What is ONU, What Is Router, ONU & Routers main usage, and What is the difference between ONU and Router. Lets take a closer look ! Part I. Meaning of...
0
8893
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8586
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
7401
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 projectplanning, coding, testing, and deploymentwithout 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...
1
6209
isladogs
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...
0
5681
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
4380
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2792
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
1786
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.