Dear All,
How I can call a method of C# class from VB.Net? Suppose I have a
class SaveFile in C# having a method saveImageFile(). There is a form
Form1 in VB.Net having an picturebox populated with an image. I want
to call SaveFile.saveImageFile() method from Form1. How it will be
done?

Regares,
Arif

Re: Calling of C# methods from VB.Net by Maarten

Maarten
Wed Feb 25 01:37:06 CST 2004

Is your C# code available in a separate DLL? What you do then is add a
reference to that particular dll. After having set that reference you simply
invoke the C# function with its name + expected parameters from VB.NET, e.g.
SaveFile.saveImageFile().

--
Regards,

Maarten Struys, eMVP
PTS Software bv

www.opennetcf.org | www.dotnetfordevices.com

"Muhammad Arif" <aliarifpk@hotmail.com> wrote in message
news:979367fe.0402242317.4438e908@posting.google.com...
> Dear All,
> How I can call a method of C# class from VB.Net? Suppose I have a
> class SaveFile in C# having a method saveImageFile(). There is a form
> Form1 in VB.Net having an picturebox populated with an image. I want
> to call SaveFile.saveImageFile() method from Form1. How it will be
> done?
>
> Regares,
> Arif



Re: Calling of C# methods from VB.Net by Milosz

Milosz
Wed Feb 25 04:12:07 CST 2004

You can also add the C# project to your Solution

regards

--
-> Milosz Weckowski
www.playseven.com

mailto:mw@playseven.com
ICQ Number: 84867613

Get the enhanced Progressbar and a fine Colorpicker for the Compact Framwork
for free:
http://www.playseven.com/11620/p7_Controls.html


"Muhammad Arif" <aliarifpk@hotmail.com> schrieb im Newsbeitrag
news:979367fe.0402242317.4438e908@posting.google.com...
> Dear All,
> How I can call a method of C# class from VB.Net? Suppose I have a
> class SaveFile in C# having a method saveImageFile(). There is a form
> Form1 in VB.Net having an picturebox populated with an image. I want
> to call SaveFile.saveImageFile() method from Form1. How it will be
> done?
>
> Regares,
> Arif



Re: Calling of C# methods from VB.Net by Neil

Neil
Wed Feb 25 04:54:36 CST 2004

Add your C# class to a class library project, compile it and then
reference the assembly from your VB .NET project. Very simple, yet
effective.

HTH
Neil

--
Neil Cowburn, MVP
Co-founder, OpenNETCF.org
Technologist, Content Master Ltd
Microsoft .NET Compact Framework MVP

www.opennetcf.org | www.contentmaster.com


Muhammad Arif wrote:
> Dear All,
> How I can call a method of C# class from VB.Net? Suppose I have a
> class SaveFile in C# having a method saveImageFile(). There is a form
> Form1 in VB.Net having an picturebox populated with an image. I want
> to call SaveFile.saveImageFile() method from Form1. How it will be
> done?
>
> Regares,
> Arif

Re: Calling of C# methods from VB.Net by aliarifpk

aliarifpk
Thu Feb 26 05:27:48 CST 2004

Dear Milosz,
Yup, I can add C# project to my solution but how i can use it? The C#
namespace is not accessible in VB.Net project.

Regards,
Arif

"Milosz - [playseven.com]" <mw@playseven.com> wrote in message news:<OAdlOf4#DHA.684@tk2msftngp13.phx.gbl>...
> You can also add the C# project to your Solution
>
> regards
>
> --
> -> Milosz Weckowski
> www.playseven.com
>
> mailto:mw@playseven.com
> ICQ Number: 84867613
>
> Get the enhanced Progressbar and a fine Colorpicker for the Compact Framwork
> for free:
> http://www.playseven.com/11620/p7_Controls.html
>
>
> "Muhammad Arif" <aliarifpk@hotmail.com> schrieb im Newsbeitrag
> news:979367fe.0402242317.4438e908@posting.google.com...
> > Dear All,
> > How I can call a method of C# class from VB.Net? Suppose I have a
> > class SaveFile in C# having a method saveImageFile(). There is a form
> > Form1 in VB.Net having an picturebox populated with an image. I want
> > to call SaveFile.saveImageFile() method from Form1. How it will be
> > done?
> >
> > Regares,
> > Arif

Re: Calling of C# methods from VB.Net by aliarifpk

aliarifpk
Thu Feb 26 07:29:24 CST 2004

Dear Neil,
I have compiled my C# class library and add it to VB.Net project. When
I rebuilt the solution of VB.Net project, I gave an error that
application conflict with "mscorlib.dll". I dig out this file from my
computer and placed it with my application and start the error was
resolved.
But when my other team member took the latest version of application
and compiled VB.Net project, he also got the same error and it is not
be resolved in any case.
What would be the problem with this?

Regards,
Muhammad Arif





"Neil Cowburn [MVP]" <neilc@online.cowburn.me.uk> wrote in message news:<#lByD34#DHA.1548@TK2MSFTNGP12.phx.gbl>...
> Add your C# class to a class library project, compile it and then
> reference the assembly from your VB .NET project. Very simple, yet
> effective.
>
> HTH
> Neil
>
> --
> Neil Cowburn, MVP
> Co-founder, OpenNETCF.org
> Technologist, Content Master Ltd
> Microsoft .NET Compact Framework MVP
>
> www.opennetcf.org | www.contentmaster.com
>
>
> Muhammad Arif wrote:
> > Dear All,
> > How I can call a method of C# class from VB.Net? Suppose I have a
> > class SaveFile in C# having a method saveImageFile(). There is a form
> > Form1 in VB.Net having an picturebox populated with an image. I want
> > to call SaveFile.saveImageFile() method from Form1. How it will be
> > done?
> >
> > Regares,
> > Arif

Re: Calling of C# methods from VB.Net by Neil

Neil
Thu Feb 26 08:10:21 CST 2004

In this case, you need to add a reference to the C# project to your VB
.NET project.

--
Neil Cowburn, MVP
Co-founder, OpenNETCF.org
Technologist, Content Master Ltd
Microsoft .NET Compact Framework MVP

www.opennetcf.org | www.contentmaster.com

Muhammad Arif wrote:
> Dear Milosz,
> Yup, I can add C# project to my solution but how i can use it? The C#
> namespace is not accessible in VB.Net project.
>
> Regards,
> Arif
>
> "Milosz - [playseven.com]" <mw@playseven.com> wrote in message news:<OAdlOf4#DHA.684@tk2msftngp13.phx.gbl>...
>
>>You can also add the C# project to your Solution
>>
>>regards
>>
>>--
>>-> Milosz Weckowski
>>www.playseven.com
>>
>>mailto:mw@playseven.com
>>ICQ Number: 84867613
>>
>>Get the enhanced Progressbar and a fine Colorpicker for the Compact Framwork
>>for free:
>>http://www.playseven.com/11620/p7_Controls.html
>>
>>
>>"Muhammad Arif" <aliarifpk@hotmail.com> schrieb im Newsbeitrag
>>news:979367fe.0402242317.4438e908@posting.google.com...
>>
>>>Dear All,
>>>How I can call a method of C# class from VB.Net? Suppose I have a
>>>class SaveFile in C# having a method saveImageFile(). There is a form
>>>Form1 in VB.Net having an picturebox populated with an image. I want
>>>to call SaveFile.saveImageFile() method from Form1. How it will be
>>>done?
>>>
>>>Regares,
>>>Arif

Re: Calling of C# methods from VB.Net by Neil

Neil
Thu Feb 26 08:13:25 CST 2004

Are you using the .NET CF version of mscorlib? It has a public key token
of 969db8053d3322ac.

--Neil

--
Neil Cowburn, MVP
Co-founder, OpenNETCF.org
Technologist, Content Master Ltd
Microsoft .NET Compact Framework MVP

www.opennetcf.org | www.contentmaster.com


Muhammad Arif wrote:
> Dear Neil,
> I have compiled my C# class library and add it to VB.Net project. When
> I rebuilt the solution of VB.Net project, I gave an error that
> application conflict with "mscorlib.dll". I dig out this file from my
> computer and placed it with my application and start the error was
> resolved.
> But when my other team member took the latest version of application
> and compiled VB.Net project, he also got the same error and it is not
> be resolved in any case.
> What would be the problem with this?
>
> Regards,
> Muhammad Arif
>
>
>
>
>
> "Neil Cowburn [MVP]" <neilc@online.cowburn.me.uk> wrote in message news:<#lByD34#DHA.1548@TK2MSFTNGP12.phx.gbl>...
>
>>Add your C# class to a class library project, compile it and then
>>reference the assembly from your VB .NET project. Very simple, yet
>>effective.
>>
>>HTH
>>Neil
>>
>>--
>> Neil Cowburn, MVP
>> Co-founder, OpenNETCF.org
>> Technologist, Content Master Ltd
>> Microsoft .NET Compact Framework MVP
>>
>> www.opennetcf.org | www.contentmaster.com
>>
>>
>>Muhammad Arif wrote:
>>
>>>Dear All,
>>>How I can call a method of C# class from VB.Net? Suppose I have a
>>>class SaveFile in C# having a method saveImageFile(). There is a form
>>>Form1 in VB.Net having an picturebox populated with an image. I want
>>>to call SaveFile.saveImageFile() method from Form1. How it will be
>>>done?
>>>
>>>Regares,
>>>Arif

Re: Calling of C# methods from VB.Net by Ravichandran

Ravichandran
Thu Feb 26 08:53:18 CST 2004

Quite simple. Compile your C# class into a Dll and Add Reference to it
from your VB project and then, declare a type of the C# class
programmatically and instantiate it.

Dim o as Class1
o=new Class1
o.saveImageFile()


with regards,


J.V.Ravichandran
- http://www.geocities.com/
jvravichandran
- http://www.411asp.net/func/search?
qry=Ravichandran+J.V.&cob=aspnetpro
- http://www.southasianoutlook.com
- http://www.MSDNAA.Net
- http://www.csharphelp.com
- http://www.poetry.com/Publications/
display.asp?ID=P3966388&BN=999&PN=2
- Or, just search on "J.V.Ravichandran"
at http://www.Google.com

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Re: Calling of C# methods from VB.Net by aliarifpk

aliarifpk
Thu Feb 26 22:47:14 CST 2004

Dear Neil,
I how i can judge that I am using .NET CF version of mscorlib?
Moreover, for what purpose this library is used?

-- Arif --


> Are you using the .NET CF version of mscorlib? It has a public key token
> of 969db8053d3322ac.
>
> --Neil
>
> --
> Neil Cowburn, MVP
> Co-founder, OpenNETCF.org
> Technologist, Content Master Ltd
> Microsoft .NET Compact Framework MVP
>
> www.opennetcf.org | www.contentmaster.com

Re: Calling of C# methods from VB.Net by Neil

Neil
Fri Feb 27 03:52:17 CST 2004

Expand the References node in the Solution Explorer. Select mscorlib. In
the Property Grid, copy the path of mscorlib. Open a Visual Studio .NET
Command Prompt and type the following:

sn -T <path to mscorlib.dll>

Replacing "<path to mscorlib.dll>" with the path you copied from the
Property Grid.

MSCorLib.dll contains the core .NET Compact Framework classes such as
all the .NET types, the Reflection namespace, and a whole host more.

--Neil

--
Neil Cowburn, MVP
Co-founder, OpenNETCF.org
Technologist, Content Master Ltd
Microsoft .NET Compact Framework MVP

www.opennetcf.org | www.contentmaster.com


Muhammad Arif wrote:
> Dear Neil,
> I how i can judge that I am using .NET CF version of mscorlib?
> Moreover, for what purpose this library is used?
>
> -- Arif --
>
>
>
>> Are you using the .NET CF version of mscorlib? It has a public key token
>>of 969db8053d3322ac.
>>
>>--Neil
>>
>>--
>> Neil Cowburn, MVP
>> Co-founder, OpenNETCF.org
>> Technologist, Content Master Ltd
>> Microsoft .NET Compact Framework MVP
>>
>> www.opennetcf.org | www.contentmaster.com