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

  • Thread starter Thread starter beginner
  • Start date Start date
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
 
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.
 
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.
 
Back
Top