Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / New Users / September 2005

Tip: Looking for answers? Try searching our database.

How to use VB.Net functions in C# project?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
juvi - 23 Sep 2005 13:01 GMT
Hi,

How can I use a VB.Net function in a C# project. Is there a way to call it
directly from code? thx juvi
Tim Wilson - 23 Sep 2005 13:20 GMT
If you're inquiring about using the "built-in" Microsoft VB functions from
C# then you'll need to add a reference to the "Microsoft.VisualBasic.dll"
assembly. From there you'll be able to access certain functions such as
MsgBox...

Microsoft.VisualBasic.Interaction.MsgBox(...);

If you're asking how to call you're own functions that you've authored in
VB.NET, then you'll need to compile them into a class lib project and then
add the resulting assembly as a reference in your C# project.

Signature

Tim Wilson
.Net Compact Framework MVP

> Hi,
>
> How can I use a VB.Net function in a C# project. Is there a way to call it
> directly from code? thx juvi
Cowboy (Gregory A. Beamer) - MVP - 23 Sep 2005 13:50 GMT
1. Compile it and make reference to the compiled library
2. Convert to C# :-)
http://www.carlosag.net/Tools/CodeTranslator/Default.aspx

Signature

Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA

***************************
Think Outside the Box!
***************************

> Hi,
>
> How can I use a VB.Net function in a C# project. Is there a way to call it
> directly from code? thx juvi
juvi - 23 Sep 2005 14:19 GMT
Thank you for your quick reply. I am new to .net developement. I tried it
with the code translator but the Rnd() function is still unknown.

How would you translate this code:    MyValue = CInt(Int((6 * Rnd()) + 1))

thank you!     juvi

--------------------------------------

> 1. Compile it and make reference to the compiled library
> 2. Convert to C# :-)
[quoted text clipped - 4 lines]
> > How can I use a VB.Net function in a C# project. Is there a way to call it
> > directly from code? thx juvi
Sukhdev - 23 Sep 2005 20:17 GMT
You can use following csharp code for this:

   System.Random rr = new System.Random();
   MyValue = rr.Next(1, 6);

Sukhdev

> Thank you for your quick reply. I am new to .net developement. I tried it
> with the code translator but the Rnd() function is still unknown.
[quoted text clipped - 13 lines]
> > > How can I use a VB.Net function in a C# project. Is there a way to call it
> > > directly from code? thx juvi

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.