Cor Ligthert [MVP]
1/24/2008 6:19:00 AM
The problems with the comboboxes is always that the index changes as soon as
you change something in that and then that event fires.
What I do in those cases is remove the event handler in the beginnen of the
event in the index change event and add it again at the end. (This works
both in C# and VB the same, however with complete different code)
Cor
"jp2msft" <jp2msft@discussions.microsoft.com> schreef in bericht
news:E7D3FCE3-A499-4D98-A366-88D5CB6A5695@microsoft.com...
> An employee might be moved to a different department, change shifts, etc.
>
> If the ComboBoxes are data bound, I am unable to make changes.
>
> Is there a better way?
>
> "Cor Ligthert[MVP]" wrote:
>
>> jp2msft,
>>
>> I am curious how you want to do use those comboboxes without databinding.
>> The databinding will not the problem, however I assume that there are
>> datatables (or any other from the database collected table class) as
>> datasource (bindingsource) for those boxes. Probably is the problem the
>> retrieval of those tables.
>>
>> Cor
>>
>> "jp2msft" <jp2msft@discussions.microsoft.com> schreef in bericht
>> news:0D0E0663-3A0A-48FF-942D-F64733449786@microsoft.com...
>> > We have a database with one table of 15000 employees and 21 fields.
>> > (Yes,
>> > it
>> > needs to be restructured, but that isn't happening today).
>> >
>> > I have a DataGridView that is databound to the table. Whenever the
>> > application starts, it takes about 5-10 seconds to populate this
>> > DataGrid
>> > (depending on how congested our internal network is).
>> >
>> > I also have ComboBox controls for each of the individual fields in the
>> > database. Before, I was filling these in programatically from data in
>> > the
>> > TableAdapter for the DataGridView.
>> >
>> > While reading through a "How-To" book, I saw where I could have my
>> > ComboBoxes also bound to the data. Hoping for increased effeciency, I
>> > data
>> > bound each of my 21 ComboBoxes with a column from my table.
>> >
>> > Now, whenever I start my application, instead of taking 5-10 seconds to
>> > populate the DataGridView and display the form, it now takes (5-10
>> > seconds) *
>> > (1 DataGridView + 21 ComboBoxes) to show the form.
>> >
>> > Ouch! I thought my application had crashed for an unknown reason!
>> >
>> > How do I "unbind" these controls now? There isn't anything in this
>> > "How-To"
>> > book on undoing the evils it started.
>> >
>> > Regards,
>> > Joe
>> >
>> > "How-To" book: Microsoft Visual Basic 2005 "Step by Step"
>>
>>