Accessing VB.Net class in App_Code from C# code behind

Sumeet
 
on Sep 27, 2018 04:45 AM
Sample_113118.zip
2393 Views

SIr,

 In my App_Code I have made class file in .vb. Now need to access that file class in c# code behind. 

The class file is inaccessible in c# code behind file.

How should I do that.

Download FREE API for Word, Excel and PDF in ASP.Net: Download
pandeyism
 
on Sep 27, 2018 05:04 AM

Hi Sumeet,

Please refer below sample.

Vb class can  access in C# code behind, refer below sample.

Default.aspx.cs

protected void Page_Load(object sender, EventArgs e)
{
    Customer cust = new Customer();
    Response.Write("Name is: " + cust.GetFirstName() + " " + cust.GetLastName());
}

Customer.VB

Public Function GetFirstName() As String
    Return "Mudassar"
End Function

Public Function GetLastName() As String
    Return "Khan"
End Function

Output

Name is: Mudassar Khan