Results 1 to 8 of 8

Thread: [RESOLVED] [2005] Working with vb.net and c#? How to integrate?

  1. #1

    Thread Starter
    Fanatic Member uniquegodwin's Avatar
    Join Date
    Jul 2005
    Location
    Chennai,India
    Posts
    694

    Resolved [RESOLVED] [2005] Working with vb.net and c#? How to integrate?

    Hello everyone...
    I have a situation where 2 people are working on vb.net and 2 people are working on c# for the same project.
    The project is a windows application.
    Some of the forms for the windows application are made in c# and some in vb.net.
    Now,How do I combine both?
    I want to be able to get the values of the textboxes in the forms made in vb.net into c# and same thing vice versa...(The values of the textboxes in the forms made in c# should be accessible in vb.net)
    Thanks so much,
    Godwin

    Help someone else with what someone helped you!

  2. #2
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: [2005] Working with vb.net and c#? How to integrate?

    You're already doing it. The entire Framework is written in C# and you're using those assemblies in your VB projects. You need to create on Windows Application project and everything else needs to be a Windows Control Library or Class Library project. The difference bewteen the two is that a Windows Control Library project already has references to System.Windows.Forms.dll and System.Drawing.dll, which you 'd have to add yourself to a Class Library. Within the one solution the EXE project can reference any of the DLL projects and each DLL project can reference any other DLL project. Outside the same solution and EXE project can reference any compiled DLL and any DLL project can reference any compiled DLL. In all cases the development language is immaterial because it's all just MSIL code manged by the Framework under the hood.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  3. #3

    Thread Starter
    Fanatic Member uniquegodwin's Avatar
    Join Date
    Jul 2005
    Location
    Chennai,India
    Posts
    694

    Re: [2005] Working with vb.net and c#? How to integrate?

    You mean there is a way to compile a windows form project into a dll?

    Thanks
    Godwin

    Help someone else with what someone helped you!

  4. #4
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: [2005] Working with vb.net and c#? How to integrate?

    Normally you would select a project type that corresponded to a DLL when you created the project in the first place, i.e. Class Library or Windows Control Library. If you've already created a Windows Application project then you can indeed make it compile to a DLL instead of an EXE by setting the "Application type" field on the Application tab of the project properties to "Class Library".
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  5. #5

    Thread Starter
    Fanatic Member uniquegodwin's Avatar
    Join Date
    Jul 2005
    Location
    Chennai,India
    Posts
    694

    Re: [2005] Working with vb.net and c#? How to integrate?

    Hi Jm,
    I thought only classes become a part of the dll when we do that...
    Ill do this now...
    Thanks so much,
    Godwin

    Help someone else with what someone helped you!

  6. #6
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: [RESOLVED] [2005] Working with vb.net and c#? How to integrate?

    I think you maybe be screwing things up conceptually here a little. A library contains classes and maybe other types. Your application can creat instances of those types just like it can create instances of types declared within the application executable itself. No TextBoxes exist until your app creates an instance, regardless of where it's declared. Your app has to create an instance of the form classes declared within its own assembly or an external assembly in order to access any controls at all.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  7. #7

    Thread Starter
    Fanatic Member uniquegodwin's Avatar
    Join Date
    Jul 2005
    Location
    Chennai,India
    Posts
    694

    Re: [RESOLVED] [2005] Working with vb.net and c#? How to integrate?

    I didnt get confused with the concept...We generally create an instance of a class when we need to use a class ..we cant use it without creating an instance right? or is there a way?
    But I was just confused thinking if the form components also can be accessed while creating an instance.
    Thanks Jm,wll try it soon... []
    Godwin

    Help someone else with what someone helped you!

  8. #8
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: [RESOLVED] [2005] Working with vb.net and c#? How to integrate?

    Each time you create an instance of a form class you also create instances of all the controls contained on that form. That's what the designer generated code does. All the designer does is generate code that corresponds to what you do visually in the design window. When you invoke the constructor of a form it calls the InitializeComponent method of that form, in which the constructors of all the controls and components you added in the designer are invoked.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width