Browse Dialogue Problem


Author
Message
Wayne Van Rooyen
Wayne Van Rooyen
StrataFrame Beginner (15 reputation)StrataFrame Beginner (15 reputation)StrataFrame Beginner (15 reputation)StrataFrame Beginner (15 reputation)StrataFrame Beginner (15 reputation)StrataFrame Beginner (15 reputation)StrataFrame Beginner (15 reputation)StrataFrame Beginner (15 reputation)StrataFrame Beginner (15 reputation)
Group: Forum Members
Posts: 15, Visits: 33
When setting up a browse dialogue and a record is returned, select the record and click okay. This takes you to the maintenance window with the selected record active. However if you now movenext etc on the one pk field update the rest of the test boxes stay as is. Did i do something wrong or is this a bug.
StrataFrame Team
S
StrataFrame Developer (4.7K reputation)StrataFrame Developer (4.7K reputation)StrataFrame Developer (4.7K reputation)StrataFrame Developer (4.7K reputation)StrataFrame Developer (4.7K reputation)StrataFrame Developer (4.7K reputation)StrataFrame Developer (4.7K reputation)StrataFrame Developer (4.7K reputation)StrataFrame Developer (4.7K reputation)
Group: StrataFrame Developers
Posts: 3K, Visits: 2.5K
Is this the functionality you're getting in the sample, or is this one of your applications?  And are you using a standard maintenance form, or the DevExpress maintenance form?  When you select the record from the browse and return to the calling form, all of the records returned from the browse will be returned to the dataset, and the current record will be selected.  So, yes, when you navigate after a browse, the rest of the fields should be updating.
Wayne Van Rooyen
Wayne Van Rooyen
StrataFrame Beginner (15 reputation)StrataFrame Beginner (15 reputation)StrataFrame Beginner (15 reputation)StrataFrame Beginner (15 reputation)StrataFrame Beginner (15 reputation)StrataFrame Beginner (15 reputation)StrataFrame Beginner (15 reputation)StrataFrame Beginner (15 reputation)StrataFrame Beginner (15 reputation)
Group: Forum Members
Posts: 15, Visits: 33
HI,

I was using the Standard maintenance form, i followed the tutorial from the help file. I dont see a tutorial in vb that conforms to the step by step in the help manual so i cant test it against my example. I will start again and see if i can reproduce it.

PS: The Full sample provided in vb called "StrataFrameSample.sln" Click Customer Maintenenance then "Browse" then "Search" and double click on a returned record. Produces error

System.InvalidCastException was unhandled by user code
  Message="Specified cast is not valid."
  Source="StrataFrameSample"
  StackTrace:
       at StrataFrameSample.CustomersBO.get_cust_phonedaytype() in C:\Program Files\MicroFour\StrataFrame\VB.NET Samples\WinForms Sample\StrataFrameSample\Business Objects\CustomersBO.Designer.vb:line 548
       at StrataFrameSample.CustomersBO.Field_cust_phonedaytype_Descriptor.GetValue(Object component) in C:\Program Files\MicroFour\StrataFrame\VB.NET Samples\WinForms Sample\StrataFrameSample\Business Objects\CustomersBO.Designer.vb:line 1291
       at System.Windows.Forms.BindToObject.GetValue()
       at System.Windows.Forms.Binding.PushData(Boolean force)

Regards Wayne

StrataFrame Team
S
StrataFrame Developer (4.7K reputation)StrataFrame Developer (4.7K reputation)StrataFrame Developer (4.7K reputation)StrataFrame Developer (4.7K reputation)StrataFrame Developer (4.7K reputation)StrataFrame Developer (4.7K reputation)StrataFrame Developer (4.7K reputation)StrataFrame Developer (4.7K reputation)StrataFrame Developer (4.7K reputation)
Group: StrataFrame Developers
Posts: 3K, Visits: 2.5K
Yes, I just fixed that problem... it will be corrected in the next update.

As for the problem of the controls not refreshing when the business object is navigated, if you can reproduce it, let me know, and ZIP your solution and post it here on the forum.

Larry Caylor
Larry Caylor
StrataFrame VIP (1.3K reputation)StrataFrame VIP (1.3K reputation)StrataFrame VIP (1.3K reputation)StrataFrame VIP (1.3K reputation)StrataFrame VIP (1.3K reputation)StrataFrame VIP (1.3K reputation)StrataFrame VIP (1.3K reputation)StrataFrame VIP (1.3K reputation)StrataFrame VIP (1.3K reputation)
Group: Awaiting Activation
Posts: 592, Visits: 3.7K

I having a similar problem; getting an InvalidCastException using version 1.41. I have a standard SF maint. form. On the form I have two controls, a textbox and combo box. The combo box is populated by an enumeration and is bound to the BO. The text box is bound to a string property on the BO. If I open the maintenance form and click on “New” I can add a new record with no error. However if I click on browse, retrieve some records and then click “New” I get the InvalidCastException. If I unbind the combo box from the BO everything works fine.

-Larry

 

StrataFrame Team
S
StrataFrame Developer (4.7K reputation)StrataFrame Developer (4.7K reputation)StrataFrame Developer (4.7K reputation)StrataFrame Developer (4.7K reputation)StrataFrame Developer (4.7K reputation)StrataFrame Developer (4.7K reputation)StrataFrame Developer (4.7K reputation)StrataFrame Developer (4.7K reputation)StrataFrame Developer (4.7K reputation)
Group: StrataFrame Developers
Posts: 3K, Visits: 2.5K
You get the InvalidCastException when the combo box is populated using an enumeration and the bound field property on the business object is not typed as the same enumeration. 

When you use an enumeration to populate a combobox, the SelectedValue (which is what the combobox will bind to by default) actually contains enumeration values, not integer values.  So, to bind to that combobox, you'll need to go to the BOMapper and customize the field to return the enumeration value rather than an integer. 

If you don't want to customize the field, you'll have to populate the combo manually, or it will continue to throw the InvalidCastException Sad

Larry Caylor
Larry Caylor
StrataFrame VIP (1.3K reputation)StrataFrame VIP (1.3K reputation)StrataFrame VIP (1.3K reputation)StrataFrame VIP (1.3K reputation)StrataFrame VIP (1.3K reputation)StrataFrame VIP (1.3K reputation)StrataFrame VIP (1.3K reputation)StrataFrame VIP (1.3K reputation)StrataFrame VIP (1.3K reputation)
Group: Awaiting Activation
Posts: 592, Visits: 3.7K
The field has been customized to the enumeration type in object mapper. I think something else is going on. Also attached is a screen shot from OM that I get when I do a "Rebuild All" after customizing one BO. What does the warning mean?

-Larry

Attachments
MapperWarning.png (133 views, 78.00 KB)
StrataFrame Team
S
StrataFrame Developer (4.7K reputation)StrataFrame Developer (4.7K reputation)StrataFrame Developer (4.7K reputation)StrataFrame Developer (4.7K reputation)StrataFrame Developer (4.7K reputation)StrataFrame Developer (4.7K reputation)StrataFrame Developer (4.7K reputation)StrataFrame Developer (4.7K reputation)StrataFrame Developer (4.7K reputation)
Group: StrataFrame Developers
Posts: 3K, Visits: 2.5K
The warning means that you have one or more fields that have been customized on the business object that have been "removed" from the business object meaning this:

1) MyBO's SQL table has a field called "field1"

2) You customize "field1" to, say, trim the value.

3) You change the structure of the SQL table so that "field1" no longer exists (or was renamed).

4) The BOMapper thinks the field disappeared, but the customization record still exists within the BOMapper.

So, the warning is just telling you that not all of the fields that you customized are being created on the business object.

As for your other error, can you post the red error message that contains the stack trace... might tell us where that exception is being thrown from Smile

Larry Caylor
Larry Caylor
StrataFrame VIP (1.3K reputation)StrataFrame VIP (1.3K reputation)StrataFrame VIP (1.3K reputation)StrataFrame VIP (1.3K reputation)StrataFrame VIP (1.3K reputation)StrataFrame VIP (1.3K reputation)StrataFrame VIP (1.3K reputation)StrataFrame VIP (1.3K reputation)StrataFrame VIP (1.3K reputation)
Group: Awaiting Activation
Posts: 592, Visits: 3.7K

Ben,

 

Thanks for the explanation of the warning message. I’ve attached a couple of screen shots. The two field sample I’m using is a stripped down sample of a more complex object. While that form includes an enum bound combo box it was a string property that was getting the same error.  In stepping through the code I noticed that when “New” was clicked without first doing a browse, any fields that were not set to allow null in OM were automatically set to default non-NULL values. When a Browse was done and rows retrieved prior to clicking on “New’ the fields in the BO were not automatically set to defaults.

 

-Larry

Attachments
OM.png (145 views, 66.00 KB)
ErrorMsg.png (149 views, 110.00 KB)
StrataFrame Team
S
StrataFrame Developer (4.7K reputation)StrataFrame Developer (4.7K reputation)StrataFrame Developer (4.7K reputation)StrataFrame Developer (4.7K reputation)StrataFrame Developer (4.7K reputation)StrataFrame Developer (4.7K reputation)StrataFrame Developer (4.7K reputation)StrataFrame Developer (4.7K reputation)StrataFrame Developer (4.7K reputation)
Group: StrataFrame Developers
Posts: 3K, Visits: 2.5K
Oh, the infamous DBNull.Value...  basically, you're getting that during the Get of your property (just like your screenshot says).  The DBNull is a special object type that is used to represent a NULL value in the database.  If a field can contain null values, then you'll need to configure that field through the BOMapper to either "Return Alternate On Null" or "Use Nullable Generic" (the generic can only be used with value types (no strings)).  Your best bet would be to either return "Nothing" or "String.Empty" on a null value.  That will fix your problem. 
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