use of vb.net and c#.net

i make a small website using vb.net,

 in it i make a 2 class in C#.net. that i want to use in that website, i dont know how to call that class.

0
Vishva
5/26/2008 9:17:09 AM
asp.net.getting-started 91979 articles. 3 followers. Follow

6 Replies
1370 Views

Similar Articles

[PageSpeed] 55

let your class is  -

class clsMyClass
    {
        public void myFunction()
        {
            // do something
        }
    }

 

now the first way - create object

clsMyClass myObj = new clsMyClass();
myObj.myFunction(); // call function

=============================

 
second way -

new clsMyClass().myFunction();
 

 


Hope it helps.

-Manas

=======================================
If this post is useful to you, please mark it as answer.
0
yeotumitsu
5/26/2008 9:34:54 AM

Compile the classes as a DLL using ClassLibrary project in Visual Studio ( File --> New --> Project --> Visual C# --> Class Library )...

Ad a reference of the dll to the project by right clicking on the Solution Explorer in Visual Studio..

Now import the class into the VB.Net page using imports statement... Now you are ready to use the C# classess and functions...


If this post was useful to you, please mark it as answer.

ClientSideAsp.Net | Blog
0
anzer
5/26/2008 9:39:44 AM

if its a class file then copy that file in (app Code )

then create the object of the class and use it .

but rember one thing in app code you cant store C# as well as vb.net file.

if u have any other query related to it ,you can ask it ?

however we have work on it........

 


======================================
Regard,
Pradeep Sahoo
Team Leader
Don't forget to click "Mark as Answer" on the post that helped you.
0
pradeepsahoo
5/26/2008 9:42:49 AM

thanks for reply, 

i have a .cs class in app_code\class folder

my website is in vb.net,

i want to call that .cs class' function to default.aspx file tat is in vb.net

------

cust .cs file

public class CustomerManager

{

string strQuery;

#region "------------------Private Variables-----------------------"

int _a;

int _b;

#endregion

#region "-------------------Public Properties------------------------"

public int A

{

get { return _a;}
set { _a = value; }

}

public int B

{

get { return _b; }

set { _b = value; }

}

#endregion

#region
"--------------------Public Methods---------------------------"
public int sum()

{

int c;

return c = A + B;

}

#endregion

}

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

in my default.aspx file at the click of submit button i want to do sum of a and b,

how does i create a object of that .cs  class?

plz reply fast....

0
Vishva
5/26/2008 10:42:20 AM

 

 Better option is that you put ur class file in a namespace.

 let -

 using whatever;

 using whatever;

 namespace YourProjectName.DataAccessLayer

 {

     

public class CustomerManager

{

string strQuery;

#region "------------------Private Variables-----------------------"

int _a;

int _b;

#endregion

#region "-------------------Public Properties------------------------"

public int A

{

get { return _a;}
set { _a = value; }

}

public int B

{

get { return _b; }

set { _b = value; }

}

#endregion

#region
"--------------------Public Methods---------------------------"
public int sum()

{

int c;

return c = A + B;

}

#endregion

}

 

=====================

now at that file where you want to use these properties

add -

using YourProjectName.DataAccessLayer; 

===================== 

 now -

 new customerManager()._a = 5;
 new customerManager()._b = 25; 

 int varsum =  new customerManager().Sum();


Hope it helps.

-Manas

=======================================
If this post is useful to you, please mark it as answer.
0
yeotumitsu
5/26/2008 11:45:10 AM

thanks for reply,

I got the answer about that.

i changs in web.congif

<codeSubDirectories>

<add directoryName="VB"/>

</codeSubDirectories>

and put 2 folder in app_code named VB and CS. put .vb class and. cs class in it and use direcly in codebehind.

i refere this site for solution :

http://aspalliance.com/745

thanks for repling....

0
Vishva
5/26/2008 1:49:04 PM
Reply:

Similar Artilces:

Sending SMS using vb.net or C#.net using vb.net or c#.net
Hi  My requirement is I hav one csv file with these fields id,mobilenum,messgae,status.intiallu staus is 0. once i read the all fileds and take that mobile number.using tat mobile number  i need to send sms .after sending sms i shuld change status as 1 How to send sms thru coding (please dont provide any links.if it is provide also please give working links becox i checked codeproject .i didnt get any nice link. and also provide the how to update the status field im csv file   Thank ssandhya   To send SMS, you need some third party SMS providers. if you consul...

use VB.NET and C#.NET code in the same C#.NET project
All-- Here is a sample that is "off the beaten path", (at least for me). Is it possible, in an ASP.NET application, using the code-behind page building technique, to have both pages written in VB.NET and pages written C#.NET?At http://www.WebLogicArts.com/DemoList.aspx there is a sample that shows that, (contrary to popular belief), it IS possible to mix ASP.NET pages built with C#.NET with ASP.NET pages built with VB.NET in the same VS.NET 2003 project. Note that this is just a "fun" sample to see if it can be done and I do not recommend this practice as a "standard" way of develo...

used a c#.net to vb.net converter and am now getting a syntax error.
ok I used a cool utility at http://www.kamalpatel.net/ConvertCSharp2VB.aspx to convert some c#.net to vb.net and it spit out a bunch of code which almost works but I am getting a syntax error on this line Imports (StreamReader sr = Shadows Function)() As StreamReader(objResponse.GetResponseStream()) I tried it that way and also like Imports (StreamReader sr = Shadows Function)() As StreamReader(objResponse.GetResponseStream()) but either way gave the same error Compiler Error Message: BC30035: Syntax error. Source Error: Line 26: Line ...

converting to vb.net from c#.net authorize.net
authorize.net offered me some sample code when I signed up with them the only problem is the sample code is in c#.net but my page that they type all of their credit card into is vb.net <code><%@ Import Namespace="System.Net" %> <%@ Import Namespace="System.IO" %> <script language="C#" runat="server"> void Page_Load(Object Src, EventArgs E) { myPage.Text = readHtmlPage("https://certification.authorize.net/gateway/transact.dll"); } private String readHtmlPage(string url) { ...

vb.net vs c#.net vs j#.net
just out of curiousity which looks, acts most like java? i'm still learning trying to used to vb.net but it seems that it was easier to do some stuff with java. C# is Java++ in my opinion. If you have done C or Jave you will prefer C#.Mike Schellenberger - MCAD If you are looking for language similar to java go for J#. However most code samples you find on the net will be in VB.NET and C#....

.Net 2.0 Web application using Vb.net is unable to create object of another dll writen in C# .net 2.0
Hi, I habe created one ASP.net web application using Vb.net which is adding reference of dlls written in C# and .net 2.0. But whenever trying to create object of referencing dll, it is throwing error :Object reference does not set to an object. But, locally it is working fine,. In the server i have deployed the .aspx files and dll files in the bin. There were already an web.config in the server which is of .net 1.1. But checked it is retrieving value for that web.config correctly. Should i have to deply any other files and if not what can be the solution for this? Please help. Thanks, So...

VB.Net To C#.Net
Hello... Since Last from 1 year i had develope web application in using vb.net now i want to transfer from vb.net to c#.net so what should i do to transform to c# language any link or book related to me through i can easily understand and coding using c# in a short time... Thanks~ Mark As Answer If UseFull ~Kaushal. Hi, you can read the specifications of the language. You're already familiar with .NET and how to program in an OO manner thanks to your experience with vb.net. The only thing you need to learn is the new syntax of C#. You can also convert parts of your v...

C#.NET or VB.NET
what lang does everyone prefer? Thanks, Peter Iuvara, MCP It's a very famous debatable question in forums! I would say if you are from Java/C/C++, then C# would be easy to use for you. If you are from ASP/VB, then VB.NET would be easy for you! As long as if you follow CLS, then what ever the language you use, it's going to be the same for CLR!Sreedharhttp://www.w3coder.orgweblog http://weblogs.asp.net/skoganti I would agree with that ... just curious as to what user's on this forum predominantly code in?Thanks, Peter Iuvara, MCP I came from no real programming background, started i...

vb .net or c# .net
I currently develop websites using php but have been requested to develop a site using asp.net. The question I have is for someone who knows php would it be better to transition to vb.net or c#.net? Thanks, Fr. Robert C# -> There is a converter that will transition about 60% or more of your PHP code to C#. Plus C# is closer to PHP than VB.NET.Jason N. GaylordASPInsider and Microsoft MVPhttp://jasongaylord.com...

Re: Gadget using vb.net and c#.net
 Hi, I am new to Gadget Concept. i want to create new Gadget. it must show the name 'Gadget Application'. pls, guide me how to create Gadget using .net application with some sample. thanks for your help in advance. Regards,Suriyanarayana.N  Unfortunately creating a Gadget using the .NET framework is not so simple. I have found a few post that might help you understand the process:http://www.codeproject.com/KB/gadgets/gadgettips.aspx http://www.codeproject.com/KB/gadgets/GadgetInterop.aspx Gabriel Bogéa (http://www.gbogea.com)-----------------Please 'Mark...

How to Add Applications to ADAM using vb.net or C#.net
 Hi Pls thrown light  any one on How to Add Applications to ADAM using vb.net or C#.net RegardsMallikarjunaP.Mallikarjuna...

Difference Between VB.Net And C#.Net
 hi friends,Please tell me the key difference between the Vb.Net And C#.Net..wheather vb.net supports operator overloading..Thanks & Regards,Pravin Kumar T.   Regards,Pravin Kumar T. pravin_thanusu:Please tell me the key difference between the Vb.Net And C#.Net.. Neither are ASP.NET so you probably want a different forum.  You'll also find your answers at Microsoft.com. JeffPlease: Don't forget to click "Mark as Answer" on the post that helped you. That way future readers will know which post solved your issue.  >Please tell me the k...

Converting from vb.net to c#.net
Hello I have recently purchased VBGolds RawDataPrinter which should allow users to print directly to label printers on our network directly from a c# web form.  Unfortunately they only supply vb.net examples and I have need of c#.  The component has been installed on our web server.  This is some code that they have supplied as examples in vb.net   "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" >"Head1" runat="server&qu...

vb.net and c#.net same app
Been asked before, but... If I build a c# web app and someone builds a vb.net desktop app, can they communicate? and can you develop against it...ie..in my c# web app, can I add the vb.net desktop app as a reference? or at least make calls to it? web apps or desktop apps can contain components created in either language. i have a web solution that contains 4 projects. One of the projects is C# the others are VB.Mike Banavige~~~~~~~~~~~~Need a site code sample in a different language? Try converting it with: http://converter.telerik.com/ Thanks...that is what I was looking for ...

Web resources about - use of vb.net and c#.net - asp.net.getting-started

Donald Trump’s Twitter Notes To Obama On Tonight’s Performance: Change Set, Punch Up Script
Donald Trump live-tweeted during President Obama ’s Oval Office address to the nation tonight. Trump promised his barrage of @-real-donald-trump-isms ...

Justice Department to open probe of Chicago Police Department
The U.S. Justice Department is expected to launch a wide-ranging investigation this week into the patterns and practices of the Chicago Police ...

Australian who claims he fought Islamic State returns home
An Australian man who fought against the Islamic State in Syria has been allowed back into the country. Queensland man Ashley Dyball, 23, was ...

PlayStation VR games debut, prepping for 2016 launch
At the PlayStation Experience event over the weekend, Sony and its partner game developers revealed their play to once again wrest the attention ...

Alabama-Michigan St in CFP semifinal at Cotton Bowl
A decade before winning three national championships at Alabama, Nick Saban was the coach at Michigan State and Mark Dantonio was one of his ...

Donald Trump's latest 9/11 claim draws more scrutiny
CBS News Donald Trump's latest 9/11 claim draws more scrutiny CBS News In an interview with CBS' "Face the Nation" that aired just days after ...

SNL reveals the true aftermath of an alien abduction
Technically Incorrect: After the little green people have let you go, you have to reveal all to the NSA. That's not so easy.

ADP Starts Making Up The World’s Mind About Climate Change
The Ad Hoc Working Group on Durban part of the COP21 meeting in Paris sewed up its last draft in the week just past. ADP delegates from every ...

Morgan Freeman’s Plane Crash Leaves Actor And SJ30 Jet Pilot, Jimmy Hobson, Unscathed
A private plane carrying actor Morgan Freeman and pilot Jimmy Hobson made an emergency crash landing in Tunica, Mississippi on Saturday. Fortunately, ...


Resources last updated: 12/7/2015 3:00:43 AM