Hello,
I want to load a form dynamically by reading Form Name from a text file
using vb.net. In visual basic 6 code works fine but when i use the same
code in vb.net it gives the error.
The code below works perfect in visual basic 6:
Dim form_name As String
dim search_name() as string
form_name = search_name(0)
Dim obj As Form
Set obj = Forms.Add(form_name)
obj.Show
Basically it reads the name of the form from a text file and store it
in form_name variable, then it add that form in the form collection
using forms.add(form_name) and load that form succesfully.
but when i do that same code in vb.net, it gives the following error in
the line:
1)obj=forms.add(form_name)
(error: Name 'Forms' is not declared).
I try these things also,but it does not solve my problem.
2)obj = System.Windows.Forms.Add(form_name)
(error: 'Add' is not a member of 'Forms')
3)Dim obj As Form = DirectCast(form_name, Form)
obj.Show()
(error: Specified cast is not valid)
can anybody explain me how to achieve this in vb.net 2003?
Regards:
Danish Majid
I want to load a form dynamically by reading Form Name from a text file
using vb.net. In visual basic 6 code works fine but when i use the same
code in vb.net it gives the error.
The code below works perfect in visual basic 6:
Dim form_name As String
dim search_name() as string
form_name = search_name(0)
Dim obj As Form
Set obj = Forms.Add(form_name)
obj.Show
Basically it reads the name of the form from a text file and store it
in form_name variable, then it add that form in the form collection
using forms.add(form_name) and load that form succesfully.
but when i do that same code in vb.net, it gives the following error in
the line:
1)obj=forms.add(form_name)
(error: Name 'Forms' is not declared).
I try these things also,but it does not solve my problem.
2)obj = System.Windows.Forms.Add(form_name)
(error: 'Add' is not a member of 'Forms')
3)Dim obj As Form = DirectCast(form_name, Form)
obj.Show()
(error: Specified cast is not valid)
can anybody explain me how to achieve this in vb.net 2003?
Regards:
Danish Majid