Home All Groups Group Topic Archive Search About

Can I create windows form by using late binding?

Author
8 Feb 2006 4:58 AM
Steven
Hi,

I have a database table field to store the form name, I want to create the
particular windows form by using the value that read from that DB field. For
examples, the table field has a value "ThisForm", then I want to create the
form with class name "ThisForm" (Suppose I have already defined the class
"ThisForm"). Can I do this by using late bindnig? Any source code for
reference? Thanks!

Steven.

Author
8 Feb 2006 6:20 AM
Cor Ligthert [MVP]
Steven,

You have a form and you want to give it from the database the name from this
field. And then?

This sounds for me as

me = dr("ThisForm")

http://msdn2.microsoft.com/system.windows.forms.control.name.aspx

Not that it does something or is usable in your program, however that is it.

Cor

Show quoteHide quote
"Steven" <a@a.com> schreef in bericht
news:Ov0OnxGLGHA.3972@TK2MSFTNGP12.phx.gbl...
> Hi,
>
> I have a database table field to store the form name, I want to create the
> particular windows form by using the value that read from that DB field.
> For examples, the table field has a value "ThisForm", then I want to
> create the form with class name "ThisForm" (Suppose I have already defined
> the class "ThisForm"). Can I do this by using late bindnig? Any source
> code for reference? Thanks!
>
> Steven.
>
Author
8 Feb 2006 7:16 AM
Steven
oh, sorry. My problem is to create an instance of the form but not just
change the name of the form.

For examples, I defined 3 windows form in my VB code which have name
"Form1", "Form2" and "Form3". Which form I need to display in screen is
depended on the field in the database table. Can I do this by using late
binding? Coz I don't know which form I need to create before doing the
database query.

Show quoteHide quote
"Cor Ligthert [MVP]" <notmyfirstn***@planet.nl> wrote in message
news:ukL0eeHLGHA.1424@TK2MSFTNGP12.phx.gbl...
> Steven,
>
> You have a form and you want to give it from the database the name from
> this field. And then?
>
> This sounds for me as
>
> me = dr("ThisForm")
>
> http://msdn2.microsoft.com/system.windows.forms.control.name.aspx
>
> Not that it does something or is usable in your program, however that is
> it.
>
> Cor
>
> "Steven" <a@a.com> schreef in bericht
> news:Ov0OnxGLGHA.3972@TK2MSFTNGP12.phx.gbl...
>> Hi,
>>
>> I have a database table field to store the form name, I want to create
>> the particular windows form by using the value that read from that DB
>> field. For examples, the table field has a value "ThisForm", then I want
>> to create the form with class name "ThisForm" (Suppose I have already
>> defined the class "ThisForm"). Can I do this by using late bindnig? Any
>> source code for reference? Thanks!
>>
>> Steven.
>>
>
>
Author
8 Feb 2006 7:44 AM
CMM
Activator.CreateInstance(Assembly.GetExecutingAssembly().GetType("name"))

Note:
1) "Assembly" is in the System.Reflection namespace.
2) "name" must to be qualified with the namespace of your application (by
default, in VB, it's the same as your project name): "MyAppName.Form1"

Show quoteHide quote
"Steven" <a@a.com> wrote in message
news:epye0%23HLGHA.668@TK2MSFTNGP11.phx.gbl...
> oh, sorry. My problem is to create an instance of the form but not just
> change the name of the form.
>
> For examples, I defined 3 windows form in my VB code which have name
> "Form1", "Form2" and "Form3". Which form I need to display in screen is
> depended on the field in the database table. Can I do this by using late
> binding? Coz I don't know which form I need to create before doing the
> database query.
>
> "Cor Ligthert [MVP]" <notmyfirstn***@planet.nl> wrote in message
> news:ukL0eeHLGHA.1424@TK2MSFTNGP12.phx.gbl...
>> Steven,
>>
>> You have a form and you want to give it from the database the name from
>> this field. And then?
>>
>> This sounds for me as
>>
>> me = dr("ThisForm")
>>
>> http://msdn2.microsoft.com/system.windows.forms.control.name.aspx
>>
>> Not that it does something or is usable in your program, however that is
>> it.
>>
>> Cor
>>
>> "Steven" <a@a.com> schreef in bericht
>> news:Ov0OnxGLGHA.3972@TK2MSFTNGP12.phx.gbl...
>>> Hi,
>>>
>>> I have a database table field to store the form name, I want to create
>>> the particular windows form by using the value that read from that DB
>>> field. For examples, the table field has a value "ThisForm", then I want
>>> to create the form with class name "ThisForm" (Suppose I have already
>>> defined the class "ThisForm"). Can I do this by using late bindnig? Any
>>> source code for reference? Thanks!
>>>
>>> Steven.
>>>
>>
>>
>
>
Author
8 Feb 2006 7:09 PM
Herfried K. Wagner [MVP]
"Steven" <a@a.com> schrieb:
> I have a database table field to store the form name, I want to create the
> particular windows form by using the value that read from that DB field.
> For examples, the table field has a value "ThisForm", then I want to
> create the form with class name "ThisForm" (Suppose I have already defined
> the class "ThisForm").

<URL:http://dotnet.mvps.org/dotnet/code/techniques/#ClassByName>

--
M S   Herfried K. Wagner
M V P  <URL:http://dotnet.mvps.org/>
V B   <URL:http://classicvb.org/petition/>