Pull a C# form in VB

Asked

Viewed 82 times

-4

Pull a C# form in VB

Good I wanted to know how I could ta pulling a form in C# via Visual basic example:

Imagem Demonstrativa

1 answer

1

If you want to include the file Loading.cs in its Visual Basic project, that is not possible. Compilers handle only one language type in the same project. You will have to rewrite the C# code in your VB.Net project.

Alternatively, you can reference the project in C# in your VB.Net and use the content of the other project in your.

For this, refer the C# project to the Visual Basic project and install the class of the other project in your:

Imports <caminho.para.sua.form>  ' aqui é o namespace de onde sua classe Loading está
...
Dim janela As New Loading
janela.Show()

Remark: the class Loading must be public (public) for the other project to access it.


But as I refer a project to another?

  1. Within the VB.NET project, right-click on references:

inserir a descrição da imagem aqui

  1. Select your project in C# in the "Projects tab":

inserir a descrição da imagem aqui

  1. Click OK.

inserir a descrição da imagem aqui

  • You have given the following error https://imgur.com/43qaXUU I have left the public loading class

  • @C0DE replaces the <Loading> by the way (namespace) from where your class Loading is.

  • I don’t understand could you tell me an example

  • @C0DE Imports NomeDoProjeto.Janelas, inside Janelas has the class Loading.

  • It appears that it is giving error https://imgur.com/K522X1N https://imgur.com/zm8bOUr

  • In the Loading.janelas you need to replace with the class namespace Loading. In your question, you do not specify the namespace. But what is a Namespace?

  • https://imgur.com/GwwlyJd My namespace and that

Show 2 more comments

Browser other questions tagged

You are not signed in. Login or sign up in order to post.