473,385 Members | 1,521 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Show VB6 Form from .NET - How to ?

I would wish to be able to open an existing VB6 Form from my VB.NET
application.

All VB6 forms are in COM dll. My COM dll expose a Public Class with a method
that return an instance of my VB6 form.

I have used tlbimp.exe utility to generate a RCW.(wrapper). The wrapper name
is SecurityNet

Dim objApplication As New SecurityNet.Application
Dim FormVB6 As Object
Dim FormNET As Form

FormVB6 = objApplication.GetMDIChild("frmUsers")
FormNET = CType(FVB6, Form) ---------------------------------> I get an
error: Conversion is not valid
FormNET.Show

Any help will be appreciated
TIA
Antonio
Jul 21 '05 #1
3 3441
The "Form" datatype is likely for now System.Windows.Forms.Form and not the
usual VB6 Form datatype hence this error...

You may want to add the correct namespace whatever you called it (or you
could keep late binding if you don't have anything else to do than showing
the form).

If you intended to "cast" your VB6 Form to System.Windows.Forms.Form, it
will not work (they are not "compatible" and in particular this is not the
same data type).

Patrice
--

"Antonio Paglia" <to**@algoritmo.com.ar> a écrit dans le message de
news:e8**************@TK2MSFTNGP09.phx.gbl...
I would wish to be able to open an existing VB6 Form from my VB.NET
application.

All VB6 forms are in COM dll. My COM dll expose a Public Class with a method that return an instance of my VB6 form.

I have used tlbimp.exe utility to generate a RCW.(wrapper). The wrapper name is SecurityNet

Dim objApplication As New SecurityNet.Application
Dim FormVB6 As Object
Dim FormNET As Form

FormVB6 = objApplication.GetMDIChild("frmUsers")
FormNET = CType(FVB6, Form) ---------------------------------> I get an
error: Conversion is not valid
FormNET.Show

Any help will be appreciated
TIA
Antonio

Jul 21 '05 #2
This means that COM Interop works fine only for classes but does not with
Forms ? There is a way to reuse my olds VB6 forms from NET applications ?
Antonio
"Patrice" <no****@nowhere.com> escribió en el mensaje
news:%2****************@tk2msftngp13.phx.gbl...
The "Form" datatype is likely for now System.Windows.Forms.Form and not
the
usual VB6 Form datatype hence this error...

You may want to add the correct namespace whatever you called it (or you
could keep late binding if you don't have anything else to do than showing
the form).

If you intended to "cast" your VB6 Form to System.Windows.Forms.Form, it
will not work (they are not "compatible" and in particular this is not the
same data type).

Patrice
--

"Antonio Paglia" <to**@algoritmo.com.ar> a écrit dans le message de
news:e8**************@TK2MSFTNGP09.phx.gbl...
I would wish to be able to open an existing VB6 Form from my VB.NET
application.

All VB6 forms are in COM dll. My COM dll expose a Public Class with a

method
that return an instance of my VB6 form.

I have used tlbimp.exe utility to generate a RCW.(wrapper). The wrapper

name
is SecurityNet

Dim objApplication As New SecurityNet.Application
Dim FormVB6 As Object
Dim FormNET As Form

FormVB6 = objApplication.GetMDIChild("frmUsers")
FormNET = CType(FVB6, Form) ---------------------------------> I get an
error: Conversion is not valid
FormNET.Show

Any help will be appreciated
TIA
Antonio


Jul 21 '05 #3
I meant that the problem is that you have likely a confusion between Form
(the VB6 datatype) and System.Windows.Forms.Form (which is something
different).

Here it looks like you are doing :

AWindows.Forms.Form variable = a VB6 Form Variable...

It won't work. The fact that the VB6 type and the .NET type are using the
same name doesn't make them the same type...

Unless you need to do extensive Form manipulation you could use here :

FormVB6.Show()

else see wiht the object browser what is exported by the VB6 DLL. If this is
the Form type yo(ull have to indicate the full name space to avoid a
confusuion with the .NET Form type).

Patrice
--

"Antonio Paglia" <to**@algoritmo.com.ar> a écrit dans le message de
news:eA*************@TK2MSFTNGP15.phx.gbl...
This means that COM Interop works fine only for classes but does not with
Forms ? There is a way to reuse my olds VB6 forms from NET applications ?
Antonio
"Patrice" <no****@nowhere.com> escribió en el mensaje
news:%2****************@tk2msftngp13.phx.gbl...
The "Form" datatype is likely for now System.Windows.Forms.Form and not
the
usual VB6 Form datatype hence this error...

You may want to add the correct namespace whatever you called it (or you
could keep late binding if you don't have anything else to do than showing the form).

If you intended to "cast" your VB6 Form to System.Windows.Forms.Form, it
will not work (they are not "compatible" and in particular this is not the same data type).

Patrice
--

"Antonio Paglia" <to**@algoritmo.com.ar> a écrit dans le message de
news:e8**************@TK2MSFTNGP09.phx.gbl...
I would wish to be able to open an existing VB6 Form from my VB.NET
application.

All VB6 forms are in COM dll. My COM dll expose a Public Class with a

method
that return an instance of my VB6 form.

I have used tlbimp.exe utility to generate a RCW.(wrapper). The wrapper

name
is SecurityNet

Dim objApplication As New SecurityNet.Application
Dim FormVB6 As Object
Dim FormNET As Form

FormVB6 = objApplication.GetMDIChild("frmUsers")
FormNET = CType(FVB6, Form) ---------------------------------> I get an error: Conversion is not valid
FormNET.Show

Any help will be appreciated
TIA
Antonio



Jul 21 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: dp | last post by:
I am new to VB.NET and I have a simple question. How do I show a form from a command button click event? The code I have below is not working. I am trying to show the form frmAgent. What am I...
13
by: genetic.error | last post by:
I'm moving from Vb6 to VB.Net. I have a feeling this has come up before... The VS.Net MSDN file seems to state that the following should work: Form1.Show Form1.Visible = True Form1.Hide...
2
by: Ajai Kumar .R | last post by:
Hai all, I've two or more forms on my app. My requirement is, Have to show the first form asa the user press a button have to hide the first form and show the second form. If the user press the...
20
by: WindAndWaves | last post by:
Hi Gurus I was wondering if you can send me in the right direction: I have a table with about 300 rows. I want to make all of them invisible and when a user enters a code in a form then make...
1
by: cefrancke | last post by:
I have set the Startup properties to the following... All menus, toolbars, etc are turned off plus these are unchecked Allow Full Menus Allow Built-in Toolbars Allow Default Shortcut Menus...
0
by: Homa | last post by:
Hi I'm working on a program that will have 3 forms: a main form, a status form and a sub-form. The main form and status form are always appear, and my sub-form is a singleton (for performance...
13
by: Tim Smallwood | last post by:
Hi, This is probably a stupid question, but I can't seem to get a form to show / load? In the older versions of VB I'd use frmMyform.show / load myForm, etc? I looked at the help file and it...
3
by: yzi | last post by:
I have a list form and a detail form . Before, I open the List form, use form.showDialog(),then I click List Item and open the Detail Form by form.show(). now , user need when the list form...
22
by: Zytan | last post by:
I have public methods in a form. The main form calls them, to update that form's display. This form is like a real-time view of data that is changing. But, the form may not exist (it is...
4
by: Delphiscn | last post by:
How to show a ABOUT Form???????? Hello Everyone: I use C# want to Create a Project. In my project. there are two forms. One is main form, and another is a about form. In the about form there...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

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.