Results 1 to 3 of 3

Thread: [RESOLVED] Data Bindings - Invalid cast exception with DBNulls

  1. #1

    Thread Starter
    Member
    Join Date
    May 2011
    Posts
    38

    Resolved [RESOLVED] Data Bindings - Invalid cast exception with DBNulls

    Hello,

    I'm binding a ComboBox's SelectedIndex to a Nullable database field like so:
    VB.NET Code:
    1. ColapsoComboBox.DataBindings.Add("SelectedIndex", EnsaiosBindingSource, "Colapso", False, DataSourceUpdateMode.OnValidation, 0)

    As you can see, I've defined the NullValue to be zero, yet I get an InvalidCastException.
    Is there anything I'm doing wrong? Or is handling the binding's Format and Parse events the only way around this?

    Thanks in advance

  2. #2

    Thread Starter
    Member
    Join Date
    May 2011
    Posts
    38

    Re: Data Bindings - Invalid cast exception with DBNulls

    Anyone?

  3. #3

    Thread Starter
    Member
    Join Date
    May 2011
    Posts
    38

    Re: Data Bindings - Invalid cast exception with DBNulls

    I've fixed it by setting formattingEnabled to True.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width