StrataFrame Forum
Home      Members   Calendar   Who's On
Welcome Guest ( Login | Register )
      



Error populating a listview...Expand / Collapse
Author
Message
Posted 07/26/2006 2:49:30 PM


StrataFrame User

StrataFrame UserStrataFrame UserStrataFrame UserStrataFrame UserStrataFrame UserStrataFrame UserStrataFrame UserStrataFrame 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?
Post #1950
Posted 07/26/2006 2:51:49 PM


StrataFrame Developer

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"

Post #1951
Posted 07/26/2006 2:55:14 PM


StrataFrame User

StrataFrame UserStrataFrame UserStrataFrame UserStrataFrame UserStrataFrame UserStrataFrame UserStrataFrame UserStrataFrame 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?
Post #1952
Posted 07/26/2006 2:59:26 PM


StrataFrame Developer

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)

Post #1953
Posted 07/26/2006 3:01:14 PM


StrataFrame User

StrataFrame UserStrataFrame UserStrataFrame UserStrataFrame UserStrataFrame UserStrataFrame UserStrataFrame UserStrataFrame 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!
Post #1955
Posted 07/26/2006 3:03:06 PM


StrataFrame Developer

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!
Post #1957
« Prev Topic | Next Topic »


Reading This TopicExpand / Collapse
Active Users: 0 (0 guests, 0 members, 0 anonymous members)
No members currently viewing this topic.
Forum Moderators: Ben Chase, Trent L. Taylor, Steve L. Taylor

PermissionsExpand / Collapse

All times are GMT -6:00, Time now is 7:40pm

Powered by InstantForum.NET v4.1.4 © 2008
Execution: 0.125. 10 queries. Compression Enabled.
Site Map - Home - My Account - Forum - About Us - Contact Us - Try It - Buy It

Microsoft, Visual Studio, and the Visual Studio logo are trademarks or registered trademarks of Microsoft Corporation in the United States and/or other countries.