ComboBox requieres selected value when connected by Datasource
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 7 of 7

Thread: ComboBox requieres selected value when connected by Datasource

  1. #1
    Join Date
    Apr 2010
    Posts
    41

    ComboBox requieres selected value when connected by Datasource

    Good morning,

    I am using a combobox which is connected by data source with a table. On this table I do a Select distinct with some filters. Everything is fine except the fact that when I click on the combobox and dont select a value the app hangs until I select one value.
    Sometimes I have this error, sometimes no.

    I call the value by the sub load:
    Code:
    Me.Empleados1TableAdapter.FillByActiveInsepc(Me.SHFDataSet.Empleados1)
    Any ideas what I am doing wrong?

  2. #2
    Join Date
    Aug 2009
    Location
    NW USA
    Posts
    173

    Re: ComboBox requieres selected value when connected by Datasource

    In the DS construction, when you add fields to a DT I believe the default for NullValue is to "(Throw exception)". You can change this setting which, I believe, will allow for null entries.

  3. #3
    Join Date
    Apr 2010
    Posts
    41

    Re: ComboBox requieres selected value when connected by Datasource

    Good point, but when I try to change this value for the field to Nothing or Empty it tells me, it is not allowed. It makes sense because those are primary keys but in the view later I just want to have a dropdownmenu and wont change anything in the table

  4. #4
    Join Date
    Jan 2006
    Location
    Chicago, IL
    Posts
    15,002

    Re: ComboBox requieres selected value when connected by Datasource

    Find out how the DB is storing a blank, or better yet, set it to a default value that won't crash the app.
    David

    CodeGuru Article: Bound Controls are Evil-VB6
    2013 Samples: MS CODE Samples

    CodeGuru Reviewer
    2006 Dell CSP
    2006, 2007 & 2008 MVP Visual Basic
    If your question has been answered satisfactorily, and it has been helpful, then, please, Rate this Post!

  5. #5
    Join Date
    Apr 2010
    Posts
    41

    Re: ComboBox requieres selected value when connected by Datasource

    just wanna that the combobox doesnt give attention to what it is selected because later I just need the value which is selected for another sql query

  6. #6
    Join Date
    Jan 2006
    Location
    Chicago, IL
    Posts
    15,002

    Re: ComboBox requieres selected value when connected by Datasource

    Set the SELECTED ITEM = -1 (Unselected)
    David

    CodeGuru Article: Bound Controls are Evil-VB6
    2013 Samples: MS CODE Samples

    CodeGuru Reviewer
    2006 Dell CSP
    2006, 2007 & 2008 MVP Visual Basic
    If your question has been answered satisfactorily, and it has been helpful, then, please, Rate this Post!

  7. #7
    Join Date
    Apr 2010
    Posts
    41

    Re: ComboBox requieres selected value when connected by Datasource

    I deleted now the combox box which I dropped out of the data source and created one out of the toolbox, connected it with the table and now its working

    Thx

Posting Permissions

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


Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center