473,513 Members | 2,477 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

C# static methods -> .dll -> VB6 fail to work

Okay i manage to convert the C# class library into dll, and enable com interop.

I basically can call c# methods from vb6 with this as long i add references to the .net project (e.g TestProject)

Private Sub Command1_Click()
Dim myObject As TestProject.ClassA
Set myObject = New TestProject.ClassA
Dim test as String
test = myObject.PrintHello()
MsgBox test
End Sub

in C# if i code this,

public string PrintHello()
{
return "hello";
}

so i can get to call the method from vb6 with the solution on top!
----

But if i use try to use static in the method,

public static string PrintHello()
{
return "Hello";
}

i receive an error in VB6

coz i called directly like

Dim test2 as String
test2 = ClassA.PrintHello() 'fail to work

Compile Error: Variable not defined - cannot find ClassA

Any idea, please?

Thanks.

Nov 16 '05 #1
1 3740
"=?Utf-8?B?Q2h1YSBXZW4gQ2hpbmc=?=" <an*******@discussions.microsoft.com>
wrote in news:4A**********************************@microsof t.com:
Dim test2 as String
test2 = ClassA.PrintHello() 'fail to work

Compile Error: Variable not defined - cannot find ClassA


I dont have all you code, but shouldnt it be:

test2 = TestProject.ClassA.PrintHello()

?

Check your imports as well.
--
Chad Z. Hower (a.k.a. Kudzu) - http://www.hower.org/Kudzu/
"Programming is an art form that fights back"

Develop ASP.NET applications easier and in less time:
http://www.atozed.com/IntraWeb/
Nov 16 '05 #2

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

Similar topics

13
10673
by: Axehelm | last post by:
Okay, I'm in a debate over whether or not static methods are a good idea in a general domain class. I'm personally not a fan of static methods but we seem to be using them to load an object. ...
3
1981
by: Steven D'Aprano | last post by:
I've been doing a lot of reading about static methods in Python, and I'm not exactly sure what they are useful for or why they were introduced. Here is a typical description of them, this one...
3
2088
by: Jay | last post by:
Why are there static methods in C#. In C++ static was applied to data only (I believe) and it meant that the static piece of data was not a part of the object but only a part of the class (one...
2
9672
by: Pavils Jurjans | last post by:
Hello, I wanted to get some feedback on why there are not allowed virtual static members in C#. Say, I have the Parent class, that hosts number of protected methods, that occasionaly make...
9
4146
by: Clint | last post by:
Hey all - Excuse the cross-post ... I'm not sure what the appropriate newsgroup would be for this question. I have a question that I'm not quite sure how to ask. For all I know, I have the...
17
2330
by: Picho | last post by:
Hi all, I popped up this question a while ago, and I thought it was worth checking again now... (maybe something has changed or something will change). I read this book about component...
2
1494
by: blue | last post by:
We have an abstract class with all static methods. It makes sense to have it static because there are no member variables and the constructor is empty. Some of the methods update the SQL Server...
12
3552
by: chandu | last post by:
hello, i want to know usage of static methods in a class. is it advantageous or disadvantage to use more static methods in a class. thank u
25
3354
by: =?iso-8859-1?B?QW5kcuk=?= | last post by:
Hello, I'm having a discussion with my colleagues (and boss) over the use of static methods in a class. My colleagues say that static methods should be avoided whenever is possible, because...
0
911
by: Dobedani | last post by:
Dear All, For some time now, I have been working with the ctypes module on Windows. First I got my hands on a library developed with Delphi 7. That library is exporting plain functions....
0
7162
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
7539
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...
0
7527
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...
0
5686
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
4746
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
3234
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
1597
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
803
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
456
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.