show form where (frm.Name.ToString()=strformname)

B

beginner

'[VB2005]
sub loadform(ByVal strformname As String)
Dim frm As form
'haw to show frm where (frm.Name.ToString()=strformname)
'thanks a lot.
frm.show
End sub
 
B

beginner

Imports System.Reflection
Sub loadform(ByVal strformname As String)
Dim assem As Assembly = Assembly.GetExecutingAssembly
Dim t As Type = assem.GetType("vbconndb." & strformname, True, True)
Dim obj As Object = Activator.CreateInstance(t)
If TypeOf obj Is Form Then CType(obj, Form).Show()
End Sub

success.
 
H

Herfried K. Wagner [MVP]

beginner said:
sub loadform(ByVal strformname As String)
Dim frm As form
'haw to show frm where (frm.Name.ToString()=strformname)


In addition to your other reply: 'Form.Name' already returns an object of
type 'String'. There is no need to call 'ToString' on it.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top