We help IT Professionals succeed at work.

clearbeforefill ?

MBHEY131
MBHEY131 asked
on
I don't understand this behavior in the code:

I'm filling various Combo Boxes  on a form: ""BELOW IS AN EXAMPLE WHEN THE COMBO BOX gets focus:

       frmShopHandMain.txtOPTimeLine_01.Visible = True
        'TODO: This line of code loads data into the 'Database1DataSet1.LaborOps' table. You can move, or remove it, as needed.
        frmShopHandMain.Database1DataSet11.EnforceConstraints = False
        frmShopHandMain.LbrOpsTblAdptr1.Fill(frmShopHandMain.Database1DataSet11.LaborOps)

Open in new window


After selecting a button on the same form "The following code gets called"
       Me.RO_InvTableAdapter1.ClearBeforeFill = False
        Me.RO_InvTableAdapter1.FillByVerifyRO_Exists(DbseRO_InvDataSet.RO_Inv, RoNum_Ln1)

Open in new window


when I set the CLEARBEFOREFILL method to "False" - EVERYTHING IS PRETTY MUCH OK for now, but
when I set the CLEARBEFOREFILL method to "True" - all of the above mentioned COMBOBOXES GET cleared out ???

the only COMMON DENOMINATOR here that I know of is the DATABASE THE THE SAME.
THE ADAPTERS, DATASETS are all different and I don't know why the form is being affected this way.???

Can anyone help me??
Comment
Watch Question

Retired Senior Systems Analyst/Programmer
Commented:
How did you create your boxes? If you just copied them rather than creating a fresh box each time you may have in fact perhaps set up a group of boxes that all maintain the same properties (just a guess here). In other words, inheritance might be in play. This would be particularly true if you are creating these boxes from a library referenced within VB.Net

Try creating a fresh box each time, giving them distinct names. I can see no reason (unless you have some code somewhere that has not been mentioned) which acts when an event occurs in one box, affecting all boxes.

Cheers
Chris (Australia)

Author

Commented:
yeah,  you put me on the right track here, - I had them set up to with bindings that I had not taken into consideration the effect those bindings had on the fill query I was running - I have just tested one box and with regards to the binding behavior (of which I understand now) the code works as planned after QUERY adjustment.
thanx