locked
Combine c# code into VB.Net RRS feed

  • Question

  • I apologize up front as I'm a newbie to VB.Net.

    I created a sample program in Visual Studio that I think uses C# and I also created a new program that uses VB.Net.

    How can I import the C# code into my VB.Net program.

    Here is an image from my VB.Net solution

    Its also important that I have access to the PDFSharp libraries

    I appreciate any support with this issue.


    Thursday, July 23, 2020 5:24 PM

Answers

  • Hi

    Just google for 'convert c# to vb' - there are lots of choices. The Telerik site seems to be a popular one.


    Regards Les, Livingston, Scotland

    • Marked as answer by JRDumont Friday, August 7, 2020 2:30 AM
    Thursday, July 23, 2020 5:42 PM

All replies

  • Hi

    Just google for 'convert c# to vb' - there are lots of choices. The Telerik site seems to be a popular one.


    Regards Les, Livingston, Scotland

    • Marked as answer by JRDumont Friday, August 7, 2020 2:30 AM
    Thursday, July 23, 2020 5:42 PM
  • If the C# code is in a class project and you don't plan on changing that code than simply add a reference to the C# class project in your VB.NET project. If the C# code is not VB.NET as indicated by Les you need to convert it and no full well no one converter is perfect.

    Please remember to mark the replies as answers if they help and unmarked them if they provide no help, this will help others who are looking for solutions to the same or similar problem. Contact via my Twitter (Karen Payne) or Facebook (Karen Payne) via my MSDN profile but will not answer coding question on either.

    NuGet BaseConnectionLibrary for database connections.

    StackOverFlow
    profile for Karen Payne on Stack Exchange

    • Proposed as answer by KHURRAM RAHIM Sunday, November 22, 2020 3:56 PM
    Thursday, July 23, 2020 6:52 PM
  • Thank you for the quick reply.

    Here is what I got back from Telerik.

    Imports System
    Imports System.Collections.Generic
    Imports System.Linq
    Imports System.Text
    Imports System.Threading.Tasks
    Imports System.IO
    Imports PdfSharp
    Imports PdfSharp.Drawing
    Imports PdfSharp.Pdf
    Imports PdfSharp.Pdf.IO
    Imports System.Diagnostics

    Namespace IJW_Merge_pdf2
        Class Program
            Private Shared Sub Main(ByVal args As String())
                Dim FPath As String
                Console.Write("Enter Folder Path - ")
                FPath = Console.ReadLine()
                Dim FName As String
                Console.Write("Enter File Name - ")
                FName = Console.ReadLine()

    How do call the namespace from my module and pass it to string variables?

    Thursday, July 23, 2020 7:40 PM
  • Hi

    This is a completely different question.  If your original question has been answered then close this thread and start a new thread for the new question.


    Regards Les, Livingston, Scotland

    Thursday, July 23, 2020 7:43 PM
  • I tried converting the c# to .Net and it looked like it worked but I wonder if I need to based on your reply.

    Do I have to create a dll to access my class?

    also, can I pass arguments to the class?


    Thursday, July 23, 2020 7:49 PM
  • Hi

    It may be the case that you are really not in need of a C# conversion as the code you show looks quite trivial to accomplish in VB - maybe give a description of what you want to do (in a new thread)


    Regards Les, Livingston, Scotland

    Thursday, July 23, 2020 8:13 PM
  • Thank you for the quick reply.

    Here is what I got back from Telerik.

    Imports System
    Imports System.Collections.Generic
    Imports System.Linq
    Imports System.Text
    Imports System.Threading.Tasks
    Imports System.IO
    Imports PdfSharp
    Imports PdfSharp.Drawing
    Imports PdfSharp.Pdf
    Imports PdfSharp.Pdf.IO
    Imports System.Diagnostics

    Namespace IJW_Merge_pdf2
        Class Program
            Private Shared Sub Main(ByVal args As String())
                Dim FPath As String
                Console.Write("Enter Folder Path - ")
                FPath = Console.ReadLine()
                Dim FName As String
                Console.Write("Enter File Name - ")
                FName = Console.ReadLine()

    How do call the namespace from my module and pass it to string variables?

    You have not shown enough code to provide a recommendation.

    Please remember to mark the replies as answers if they help and unmarked them if they provide no help, this will help others who are looking for solutions to the same or similar problem. Contact via my Twitter (Karen Payne) or Facebook (Karen Payne) via my MSDN profile but will not answer coding question on either.

    NuGet BaseConnectionLibrary for database connections.

    StackOverFlow
    profile for Karen Payne on Stack Exchange

    Thursday, July 23, 2020 8:55 PM
  • Hi JRDumont,

    If your original question has been answered then please click the "Mark as Answer" Link at the bottom of the correct post(s), so that it will help other members to find the solution quickly if they face a similar issue.

    Best Regards,

    Xingyu Zhao


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Thursday, July 30, 2020 2:33 AM