473,479 Members | 2,128 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Loading the Form by passing form name as string and setting its MDIParent as true

4 New Member
Hi guys,anyone can help me...

I have to set a form's mdiparent property at run time..But I have the formname as string..how can I do it..

I tried this way ..

'Dim _form As Form = CType(Microsoft.VisualBasic.Interaction.CallByName (My.Forms, formname, CallType.Get), Form)
If (Me.IsMdiContainer) Then
_form.MdiParent = Me
End If

_form.Show()

But it is not loading the form..

I tried another method as follows..


Dim infAssembly As [Assembly] = infAssembly.LoadFrom("D:\Vb2005\Zaky\zaky\bin\Rele ase\Zaky.exe")

Dim infType As Type = infAssembly.GetType("formname", True, True)

Dim method As MethodInfo
'Dim instance As Form = CType(Activator.CreateInstance(infType), Form)
Dim instance As Object = CType(Activator.CreateInstance(infType), Form)
instance.infParameters = ""

If (Me.IsMdiContainer) And (instance.FormBorderStyle <> FormBorderStyle.FixedDialog) Then
method = infType.GetMethod("Show", New Type() {})
instance.MdiParent = Me
method.Invoke(instance, New Object() {})
Else
method = infType.GetMethod("Show", New Type() {GetType(Form)}) '{Type.GetType(Form)})
method.Invoke(instance, New Object() {Me})
End If

But it gives the error message on second line as follows..

Could not load type 'frmTimeSheet' from assembly 'Zaky1, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'.

here I am trying to load the form 'frmTimesheet'.before loading it ,
I have to set it's property mdiparent to true.I am calling this from MenuForm which is it's MDIParentContainer.

Please help me..
Regards
Zak.
May 31 '07 #1
0 983

Sign in to post your reply or Sign up for a free account.

Similar topics

2
2611
by: ColinWard | last post by:
Hi. I have a form which has as its recordsource an SQL string. The SQL String is as follows: SELECT * from CONTACTS where false. this ensures that there is no data loaded in the form when the...
4
1834
by: Ahmet | last post by:
Hi all; I have one application in which I read form names from database to be opened. I open form with the code below, and call its show method for form to be shown but before this, I must set...
1
359
by: Jim Heimer | last post by:
How can I pass data from one child form to another? I have two forms, one (formX) that holds a datagrid (with the results of a query) and another (formY) that consists of many textboxes. I'd like...
7
4730
by: Ken Allen | last post by:
I have a .net client/server application using remoting, and I cannot get the custom exception class to pass from the server to the client. The custom exception is derived from ApplicationException...
2
1500
by: Supra | last post by:
An unhandled exception of type 'System.NullReferenceException' occurred in system.windows.forms.dll Additional information: Object reference not set to an instance of an object. i don't know how...
2
3664
by: Itar | last post by:
I'm having a problem when opening an MDI Child form. I'm declaring the child form then setting the dock property to fill so that it takes up the entire space of the MDI Parent window without being...
1
2375
by: Michael | last post by:
Hi Everyone, I seem to be having a problem accessing a menuitem on the MDIParent from a child form. From a login (frmSecurity -child form) screen, I need to hide a menuitem based on the users...
5
5592
by: Charlie Brown | last post by:
I am using the following to load my mdi form into the parent. If Me.frmIncoming Is Nothing Then Me.frmIncoming = New IncomingForm Me.frmIncoming.MdiParent = Me End If Me.frmIncoming.Show()...
7
1688
by: Rotsey | last post by:
Hi, I am loading a tab control on a form. The code loads textboxes and comboboxes and checkboxes, normal data entry form that loads a table row of data. I have a combo on the form above the...
0
7027
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7067
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
6719
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
6847
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
1
4757
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4463
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
1288
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
555
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
166
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.