By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,432 Members | 790 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,432 IT Pros & Developers. It's quick & easy.

Dim frm As Form

P: n/a
Dib
Hi,

How can I call a form at run-time based on the value from a table.
Dim frm as Form
Dim sForm as String
sForm = rs.Fields(1).Value

frm.Name=sForm

frm.Show()

This is what I am doing. Is this wrong?

What is the correct syntex.

Thanks
Dib


Nov 21 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
"Dib" <dN************@conNOSPAMsoftware.com> schrieb:
How can I call a form at run-time based on the value from a table.


\\\
Dim frm As Form = _
DirectCast( _
Activator.CreateInstance( _
Type.GetType("MyApplication.SampleForm") _
), _
Form _
)
frm.Show()
///

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>
Nov 21 '05 #2

P: n/a
Dib
Thanks for your reply. This is too much for me!

I set the code like this
Dim frm As Form = DirectCast(Activator.CreateInstance(Type.GetType(s Form)),
Form)

and I got an error Value cannot be Null

What did I do wrong?

Thanks

Dib


"Herfried K. Wagner [MVP]" <hi***************@gmx.at> wrote in message
news:%2******************@TK2MSFTNGP15.phx.gbl...
"Dib" <dN************@conNOSPAMsoftware.com> schrieb:
How can I call a form at run-time based on the value from a table.


\\\
Dim frm As Form = _
DirectCast( _
Activator.CreateInstance( _
Type.GetType("MyApplication.SampleForm") _
), _
Form _
)
frm.Show()
///

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

Nov 21 '05 #3

P: n/a
Dib
Got it to work, thanks
Dib

"Herfried K. Wagner [MVP]" <hi***************@gmx.at> wrote in message
news:%2******************@TK2MSFTNGP15.phx.gbl...
"Dib" <dN************@conNOSPAMsoftware.com> schrieb:
How can I call a form at run-time based on the value from a table.


\\\
Dim frm As Form = _
DirectCast( _
Activator.CreateInstance( _
Type.GetType("MyApplication.SampleForm") _
), _
Form _
)
frm.Show()
///

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

Nov 21 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.