none
CurrencyManager odd behavior... RRS feed

  • Question

  • I have a dataset called dsContacts and I create a CurrencyManager bound to it like so:

    myCM = CType(Me.BindingContext(dsContacts.Tables("contacts")), CurrencyManager)
    I bind some form controls to the dataset like so:

    Me.lblTelephone.DataBindings.Add("Text", dsContacts.Tables("contacts"), dsContacts.Tables("contacts").Columns("telephone").ColumnName)

    Me.lblSalutation.DataBindings.Add("Text", dsContacts.Tables("contacts"), dsContacts.Tables("contacts").Columns("salutation").ColumnName)
    Me.lblFirstName.DataBindings.Add("Text", dsContacts.Tables("contacts"), dsContacts.Tables("contacts").Columns("firstname").ColumnName)
    Me.lblLastName.DataBindings.Add("Text", dsContacts.Tables("contacts"), dsContacts.Tables("contacts").Columns("lastname").ColumnName)
    Me.lblDetail1.DataBindings.Add("Text", dsContacts.Tables("contacts"), dsContacts.Tables("contacts").Columns("company").ColumnName)  

    Later, I jump to a specific record in the dataset like so:

    myCM.Position = Me.callable(z).rowID

    where the value of Me.callable(z).rowID is confirmed to be 29 which is a valid and proper row in the dataset.

    The odd thing that happens is that the form controls get updated with the contents of record #1 briefly before the contents of record #29 are shown. 

    Why is this and can it be avoided?

    -parkerjnc


    Thanks,
    • Edited by Martin_Xie Friday, April 16, 2010 2:42 AM Adjust code layout to make it more readable.
    • Moved by Martin_Xie Friday, April 16, 2010 2:44 AM Move it to ADO.NET DataSet Forum for better support. (From:Visual Basic General)
    Friday, April 16, 2010 1:14 AM

Answers

  • Do you have other controls besides labels being databound? In particular, any ComboBoxes?

    Many years ago I ran into issues when moving the CurrencyManager position and, if I recall correctly, I'm pretty sure that it had something to do with databound Combos. What I ended up doing was to unbind the Combos,  then move the position, the rebind the Combos. We just had an unbind/rebind method in our base classes that took care of it all automatically, but try it first (assuming you have databound Combos) to see if that's really the cause.

    As I said, this was an issue many years ago under .NET 1.1 ... we never re-tested our base framework classes after 2.0 came out, so I don't know off the top of my head if it's still an issue with Combos or if something else is causing your problem.


    ~~Bonnie Berent [C# MVP]

    geek-goddess-bonnie.blogspot.com
    • Marked as answer by parkerjnc Friday, April 23, 2010 7:01 PM
    Saturday, April 17, 2010 10:08 PM

All replies

  • Hello parkerjnc,

     

    Welcome to ADO.NET DataSet forum!

     

    If it is convenient for you, could you please send me a demo project with db file for further investigation?   I will do my best to help.    Thanks a lot!   My mail address is v-micsun@microsoft.com.  

     

    Have a nice weekend!

     

     

    Best Regards,
    Lingzhi Sun

    MSDN Subscriber Supportin Forum

    If you have any feedback on our support, please contactmsdnmg@microsoft.com


    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.
    Friday, April 16, 2010 8:12 AM
    Moderator
  • Do you have other controls besides labels being databound? In particular, any ComboBoxes?

    Many years ago I ran into issues when moving the CurrencyManager position and, if I recall correctly, I'm pretty sure that it had something to do with databound Combos. What I ended up doing was to unbind the Combos,  then move the position, the rebind the Combos. We just had an unbind/rebind method in our base classes that took care of it all automatically, but try it first (assuming you have databound Combos) to see if that's really the cause.

    As I said, this was an issue many years ago under .NET 1.1 ... we never re-tested our base framework classes after 2.0 came out, so I don't know off the top of my head if it's still an issue with Combos or if something else is causing your problem.


    ~~Bonnie Berent [C# MVP]

    geek-goddess-bonnie.blogspot.com
    • Marked as answer by parkerjnc Friday, April 23, 2010 7:01 PM
    Saturday, April 17, 2010 10:08 PM
  • Hi parkerjnc,

     

    I am writing to check the status of the issue on your side.  Would you mind letting us know the result of the suggestions? 

     

    If you need further assistance, please feel free to let me know.   I will be more than happy to be of assistance.

     

    Have a nice day!

     

     

    Best Regards,
    Lingzhi Sun

    MSDN Subscriber Support in Forum

    If you have any feedback on our support, please contact msdnmg@microsoft.com


    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.
    Thursday, April 22, 2010 1:32 AM
    Moderator
  • Yes, I did have a combo box bound.  I cleared the binding then re-added it after the shift and all seems to be working fine. Thanks so much for advice.


    Thanks,
    Friday, April 23, 2010 7:04 PM
  • You're welcome! Glad I could help.  =0)


    ~~Bonnie Berent [C# MVP]

    geek-goddess-bonnie.blogspot.com
    Monday, April 26, 2010 2:44 PM