| | | 
StrataFrame User
       
Group: StrataFrame Users Last Login: 07/09/2008 2:20:16 PM Posts: 436, Visits: 944 |
| When trying to fill a Listview with a BO i get the following error:
Dynamically populating the ListView failed. Could not create and fill the business object of type 'STI.InventoryBO'.
I setup everything correctly, i think, not sure why I'm getting this error.
Any ideas? |
| | | | 
StrataFrame Developer

Group: StrataFrame Developers Last Login: Yesterday @ 10:49:29 PM Posts: 4,379, Visits: 4,412 |
| | Does the method you selected require parameters? If so you need to set those parameters in the ListPopulating event of the list. There will be an event argument like this: e.Parameters(0).Value = 1 e.Parameters(1).Value = "Second Parm" |
| | | | 
StrataFrame User
       
Group: StrataFrame Users Last Login: 07/09/2008 2:20:16 PM Posts: 436, Visits: 944 |
| I did that. I fixed it. Not sure why this works. I'm sure you can explain it to me. 
This is what I had when it wasnt working...
e.Parameters(0).Value = Me.txtPOID.Text
I changed it to this and it worked.
e.Parameters(0).Value = Cint(Me.txtPOID.Text)
Can you enlighten me as to why that conversion made a difference? |
| | | | 
StrataFrame Developer

Group: StrataFrame Developers Last Login: Yesterday @ 10:49:29 PM Posts: 4,379, Visits: 4,412 |
| | It has to do with strong-typing. Your method has a parameter defined as a System.Int32. Any controls "Text" property is defined as a System.String. By passing just the Control.Text, you are passing a string typed value and the method expects integer. When you added the CInt(), it converted the text to Integer as the method was expecting. .NET is a strong-typed development environment. You cannot rely on automatic data conversions like other languages such as Visual FoxPro. This is actually a VERY good thing. You learn about type conversions either a compile time or very quickly when an app is run. So most of the "Data Type Mistmatch" error from the old days are gone. Just FYI, I would not use CInt(). It is very slow and is an obselete method. You should do most of your type conversions like this: CType(Control.Text, System.Integer) |
| | | | 
StrataFrame User
       
Group: StrataFrame Users Last Login: 07/09/2008 2:20:16 PM Posts: 436, Visits: 944 |
| | Thaks for the tip! I can ALWAYS use those! |
| | | | 
StrataFrame Developer

Group: StrataFrame Developers Last Login: Yesterday @ 10:49:29 PM Posts: 4,379, Visits: 4,412 |
| That's what we're here for! |
| |
|
|