﻿<?xml version="1.0" encoding="UTF-8"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/"><channel><title>StrataFrame Forum » StrataFrame Application Framework - V1 » Business Objects and Data Access (How do I?)  » Instantiate Business Object Dynamically</title><generator>InstantForum 2017-1 Final</generator><description>StrataFrame Forum</description><link>http://forum.strataframe.net/</link><webMaster>StrataFrame Forum</webMaster><lastBuildDate>Wed, 13 May 2026 18:27:46 GMT</lastBuildDate><ttl>20</ttl><item><title>Instantiate Business Object Dynamically</title><link>http://forum.strataframe.net/FindPost24816.aspx</link><description>This may be a dumb question but I can't quite get this to work.&lt;br&gt;
&lt;br&gt;
I have a string variable containing the fully qualified name of a business object.&lt;br&gt;
&lt;br&gt;
Example:  Dim var as String =  "Avanti.DTS.BusinessObject.CustomersBO"&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
I want to instantiate the actual business object based on the string value so I can access the field names and lengths etc...&lt;br&gt;
 &lt;br&gt;
can someone let me know how to do this?&lt;br&gt;
&lt;br&gt;
Thanks,&lt;br&gt;
Tim&lt;br&gt;</description><pubDate>Mon, 05 Oct 2009 15:25:53 GMT</pubDate><dc:creator>Tim Dol</dc:creator></item><item><title>RE: Instantiate Business Object Dynamically</title><link>http://forum.strataframe.net/FindPost24852.aspx</link><description>[quote]Nope, we all have one shot to make a good impression[/quote]&lt;br&gt;
&lt;br&gt;
But just think of it this way...it helps boost your forum count :D&lt;br&gt;
&lt;br&gt;
We may have the ability to request this on a per individual basis at some point, but there are some obvious reasons that we prevent this as I am sure you have seen on other posts when we have discussed this before.&lt;br&gt;</description><pubDate>Mon, 05 Oct 2009 15:25:53 GMT</pubDate><dc:creator>Trent L. Taylor</dc:creator></item><item><title>RE: Instantiate Business Object Dynamically</title><link>http://forum.strataframe.net/FindPost24843.aspx</link><description>So the moral of the story is "Do not drink and post."  :D</description><pubDate>Mon, 05 Oct 2009 10:32:28 GMT</pubDate><dc:creator>Charles R Hankey</dc:creator></item><item><title>RE: Instantiate Business Object Dynamically</title><link>http://forum.strataframe.net/FindPost24833.aspx</link><description>[quote][b]Charles R Hankey (10/04/2009)[/b][hr]...but there is also not ability to edit one's own posts ... is there?[/quote]&lt;br&gt;
&lt;br&gt;
Nope, we all have one shot to make a good impression :w00t:</description><pubDate>Sun, 04 Oct 2009 21:20:06 GMT</pubDate><dc:creator>Edhy Rijo</dc:creator></item><item><title>RE: Instantiate Business Object Dynamically</title><link>http://forum.strataframe.net/FindPost24832.aspx</link><description>... and of course that should read "could[b] NOT[/b] remember it, but there is also not ability to edit one's own posts ... is there?</description><pubDate>Sun, 04 Oct 2009 21:13:49 GMT</pubDate><dc:creator>Charles R Hankey</dc:creator></item><item><title>RE: Instantiate Business Object Dynamically</title><link>http://forum.strataframe.net/FindPost24831.aspx</link><description>Yes!  I thought I remembered you asking exactly that question and getting an answer but could remember it.  Very cool.  Now if they could get Firefox to insert images ...</description><pubDate>Sun, 04 Oct 2009 21:12:50 GMT</pubDate><dc:creator>Charles R Hankey</dc:creator></item><item><title>RE: Instantiate Business Object Dynamically</title><link>http://forum.strataframe.net/FindPost24821.aspx</link><description>[quote][b]Charles R Hankey (10/02/2009)[/b][hr]Darn I with there were a way to see the question while we are typing an anwer ... or is there ?  &lt;br&gt;
[/quote]&lt;br&gt;
&lt;br&gt;
Yes there is, and I have been there before too :).&lt;br&gt;
&lt;br&gt;
While replying down at the bottom of the page there is header named [b]"Last 10 Post in Descending Order"[/b] and on the right side there is a plus sign, just click the plus sign and you will see (guess what?) the last 10 post in descending order :hehe:</description><pubDate>Fri, 02 Oct 2009 18:50:48 GMT</pubDate><dc:creator>Edhy Rijo</dc:creator></item><item><title>RE: Instantiate Business Object Dynamically</title><link>http://forum.strataframe.net/FindPost24820.aspx</link><description>(and on rereading your question, Edhy understood your question better than I did.)&lt;br&gt;
&lt;br&gt;
Darn I with there were a way to see the question while we are typing an anwer ... or is there ?  &lt;br&gt;</description><pubDate>Fri, 02 Oct 2009 18:23:29 GMT</pubDate><dc:creator>Charles R Hankey</dc:creator></item><item><title>RE: Instantiate Business Object Dynamically</title><link>http://forum.strataframe.net/FindPost24819.aspx</link><description>I may be misunderstanding the question, but&lt;br&gt;
&lt;br&gt;
[codesnippet]dim newbo As MicroFour.StrataFrame.Business.BusinessLayer = New Myapp.Business.MyBO[/codesnippet]&lt;br&gt;
&lt;br&gt;
works for me (assuming here myBO is in the myapp.business project)&lt;br&gt;
&lt;br&gt;
Same thing works for me.myBO1 if you want the instance.&lt;br&gt;
&lt;br&gt;
Need to use fill methods if you need data, but you can check field info  etc without it.&lt;br&gt;
&lt;br&gt;
Edhy's method, of course, is the solution when you are getting the BO name from a string, but I thought perhaps you weren't doing it dynamically in this case.&lt;br&gt;
&lt;br&gt;</description><pubDate>Fri, 02 Oct 2009 18:22:05 GMT</pubDate><dc:creator>Charles R Hankey</dc:creator></item><item><title>RE: Instantiate Business Object Dynamically</title><link>http://forum.strataframe.net/FindPost24817.aspx</link><description>Hi Tim,&lt;br&gt;
&lt;br&gt;
I believe you will need to use the Activator.CreateInstance() to make this work, something like this:&lt;br&gt;
[quote]&lt;br&gt;
            Dim var As String = "Avanti.DTS.BusinessObject.CustomersBO"&lt;br&gt;
            Dim myBO As Avanti.DTS.BusinessObject.CustomersBO&lt;br&gt;
            myBO = CType(Activator.CreateInstance(Type.GetType(var)), Avanti.DTS.BusinessObject.CustomersBO)&lt;br&gt;
[/quote]&lt;br&gt;
&lt;br&gt;
If you have a base BO class, then use it in the Dim myBO declaration.</description><pubDate>Fri, 02 Oct 2009 16:48:02 GMT</pubDate><dc:creator>Edhy Rijo</dc:creator></item></channel></rss>