BO Populated combo boxes causing errors


Author
Message
Trent Taylor
Trent Taylor
StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 6.9K
Well, I had to change the database from MyTestDatabase to StrataFrameSample, but once I did this it worked just fine:

It was definitely not optimized and was really slow, but it worked.  In your exception window, what is the inner exception.  Click on Detail and go as deep as you can to see what the actual error is.

Trent Taylor
Trent Taylor
StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 6.9K
Hehe It looks like we were posting at the same time Smile  Let me know if you can find anything else.
Andria Jensen
Andria Jensen
StrataFrame User (428 reputation)StrataFrame User (428 reputation)StrataFrame User (428 reputation)StrataFrame User (428 reputation)StrataFrame User (428 reputation)StrataFrame User (428 reputation)StrataFrame User (428 reputation)StrataFrame User (428 reputation)StrataFrame User (428 reputation)
Group: Forum Members
Posts: 336, Visits: 497
Ok, I have attached a new project which illustrates the error I am getting.  I think I know what's happening here...On the combo box if I set the DisplayMember and/or ValueMember properties to anything it gives that error.  I know that you should let the PopulationDataSourceSettings take care of this, but I must be setting those properties on my combo boxes.   One question though...this was working just perfectly before, so is there something that changed that could have caused this error?
Trent Taylor
Trent Taylor
StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 6.9K
Andria,

I think that there was something else before in the mix because you CANNOT change the DisplayMember and ValueMember of the combo.  When you use the PopulationDataSource settings, we create a temp ADO.NET table with two columns: Display and Value.  These are the only two columns in the data source associated with the combo.  So when you set it to cust_pk, it is telling you the truth, the field does not exist, nor has it ever.

If you want the value member to be something else, then set it in the PopulationDataSourceSetting.  This is what the Value Member setting in the PopulationDataSource settings is for:

If you want to have your own display and value members, then create your own data source and you can set the display and value member to whatever columns exist in your data source:

Dim loTable As New DataTable()

loTable.Columns.Add(...)

MyCombo.DataSource = loTable
MyCombo.DisplayMember = "MyDisplayField"
MyCombo.ValueMember = "MyValueField"

And just for the record, we had to extend the DevExpress combo to even support a data source and value member.  This is the most basic thing in the world and they did not even have it!!!  It took a full day or two to implement this on their control which was something that should have already existed.

Andria Jensen
Andria Jensen
StrataFrame User (428 reputation)StrataFrame User (428 reputation)StrataFrame User (428 reputation)StrataFrame User (428 reputation)StrataFrame User (428 reputation)StrataFrame User (428 reputation)StrataFrame User (428 reputation)StrataFrame User (428 reputation)StrataFrame User (428 reputation)
Group: Forum Members
Posts: 336, Visits: 497
I agree that these properties should be getting setup in the PopulationDataSourceSettings, and they are.  I guess in my beginning days of using SF I didn't know what I was doing and was setting properties all over the place!  Now, I know better but it was just throwing me off since it was working before and all of a sudden it seemed like my whole app was crashing left and right on combo boxes.  Oh well, everything seems to be working now...I'll just have to go back and clean up my previous mistakes.  Thanks for helping me figure this out!  I appreciate the support you guys give us.
Trent Taylor
Trent Taylor
StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 6.9K
I bet I know why it changed...it would have to do with the InitializeCOmponent() method.  Before, the ValueMember property was being set before the PopulationDataSourceSettings.  Sometimes when a rebuild is done it may re-order these if a form is modified...thus the time old initialization sequence problem. 
Andria Jensen
Andria Jensen
StrataFrame User (428 reputation)StrataFrame User (428 reputation)StrataFrame User (428 reputation)StrataFrame User (428 reputation)StrataFrame User (428 reputation)StrataFrame User (428 reputation)StrataFrame User (428 reputation)StrataFrame User (428 reputation)StrataFrame User (428 reputation)
Group: Forum Members
Posts: 336, Visits: 497
Makes complete sense Trent.  I never thought of that...VS 2005 seems to do a lot of things in random order.  I've even been seeing my Activate event fire before my Load event!  Messes up everything.
GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search