473,396 Members | 2,085 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,396 software developers and data experts.

How to show a form

Dear all,

I have written a com using VB.Net 2005. And I have build it
with com interop selected. What I want is to show a form by VB6
through the function call.

The following is my code in VB.net

<ComClass(ComClass1.ClassId, ComClass1.InterfaceId,
ComClass1.EventsId)_
Public Class ComClass1

#Region "COM GUID"
' ³o¨Ç GUID ´£¨Ñ¤F³o*ÓÃþ§Oªº COM ÃѧO
' »P¨ä COM ªº¤¶*±¡C¦pªG±zÅܧó³o¨Ç³]©w¡A²{¦³ªº
' ¥Î¤áºÝ±NµLªk¦A¦s¨ú¸ÓÃþ§O¡C
Public Const ClassId As String = "ba44c9f9-
e814-46cc-8449-8b2222d90ca2"
Public Const InterfaceId As String = "6b26373a-7cf4-4cd3-bf77-
fabda12c6119"
Public Const EventsId As String = "2d8bef88-e194-40cc-900f-
cd1377faa6ff"
#End Region

' ¥i«Ø¥ßªº COM Ãþ§O¥²¶·*n¦³¤@*Ó¨S¦³°Ñ¼Æªº Public Sub New()¡A
' §_«h¡A¸ÓÃþ§O±NµLªk©ó COM µn¿ý¤¤¤©¥Hµn¿ý¡A
' ¦Ó¥B¤]µLªk³z¹L
' CreateObject ¨Ó«Ø¥ß¸ÓÃþ§O¡C
Public Sub New()
MyBase.New()
End Sub

Public Function myFunction() As Integer
Dim formshow As New Form1
Return 200
formshow.Show()
End Function

End Class

And then I wrtie the following code in VB6

Private Sub Command1_Click()
Dim myObject As TestProj.ComClass1
Set myObject = New TestProj.ComClass1
MsgBox myObject.myFunction
End Sub

The msgbox can function , it shows "200". But no form was showed in
VB6. What's wrong with my code? Thanks

Jun 27 '08 #1
3 1833
Return returns immediately, does not pass go and does not collect $200.
"hon123456" <pe*********@yahoo.com.hkwrote in message
news:d9**********************************@w1g2000p rd.googlegroups.com...
Dear all,

I have written a com using VB.Net 2005. And I have build it
with com interop selected. What I want is to show a form by VB6
through the function call.

The following is my code in VB.net

<ComClass(ComClass1.ClassId, ComClass1.InterfaceId,
ComClass1.EventsId)_
Public Class ComClass1

#Region "COM GUID"
' ³o¨Ç GUID ´£¨Ñ¤F³o*ÓÃþ§Oªº COM ÃѧO
' »P¨ä COM ªº¤¶*±¡C¦pªG±zÅܧó³o¨Ç³]©w¡A²{¦³ªº
' ¥Î¤áºÝ±NµLªk¦A¦s¨ú¸ÓÃþ§O¡C
Public Const ClassId As String = "ba44c9f9-
e814-46cc-8449-8b2222d90ca2"
Public Const InterfaceId As String = "6b26373a-7cf4-4cd3-bf77-
fabda12c6119"
Public Const EventsId As String = "2d8bef88-e194-40cc-900f-
cd1377faa6ff"
#End Region

' ¥i«Ø¥ßªº COM Ãþ§O¥²¶·*n¦³¤@*Ó¨S¦³°Ñ¼Æªº Public Sub New()¡A
' §_«h¡A¸ÓÃþ§O±NµLªk©ó COM µn¿ý¤¤¤©¥Hµn¿ý¡A
' ¦Ó¥B¤]µLªk³z¹L
' CreateObject ¨Ó«Ø¥ß¸ÓÃþ§O¡C
Public Sub New()
MyBase.New()
End Sub

Public Function myFunction() As Integer
Dim formshow As New Form1
Return 200
formshow.Show()
End Function

End Class

And then I wrtie the following code in VB6

Private Sub Command1_Click()
Dim myObject As TestProj.ComClass1
Set myObject = New TestProj.ComClass1
MsgBox myObject.myFunction
End Sub

The msgbox can function , it shows "200". But no form was showed in
VB6. What's wrong with my code? Thanks

Jun 27 '08 #2
"Stephany Young" <noone@localhostschrieb
Return returns immediately, does not pass go and does not collect
$200.
Hehe...lol...I think I got it. ...only $200?? Were 4000 DM (~2000 Euros
now). Low budget version, right? :)
Jun 27 '08 #3
Original edition.
"Armin Zingler" <az*******@freenet.dewrote in message
news:ue**************@TK2MSFTNGP02.phx.gbl...
"Stephany Young" <noone@localhostschrieb
>Return returns immediately, does not pass go and does not collect $200.

Hehe...lol...I think I got it. ...only $200?? Were 4000 DM (~2000 Euros
now). Low budget version, right? :)

Jun 27 '08 #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...
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:
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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
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...

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.