Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6581699
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T16:11:12+00:00 2026-05-25T16:11:12+00:00

I am using VB.net 2010 and I have two projects: SQLtesting and Controls .

  • 0

I am using VB.net 2010 and I have two projects: SQLtesting and Controls. Their physical locations are:

C:\My Documents\Visual Studio 2010\Projects\SQLtesting\SQLtesting\ [forms reside here]
C:\My Documents\Visual Studio 2010\Projects\Controls\Controls\ [forms reside here]

The code shown below works fine. I run it from the project SQLtesting. It loads a listbox and a checkedlistbox with the controls found on a form. I can change the value of the ProjAndForm field to any form within the SQLtesting project and get the form’s controls. The forms are not actually opened/shown and they are not suppose to be.

I would like to be able to access forms in other projects i.e.
*C:\My Documents\Visual Studio 2010\Projects\Controls\Controls*
while running the code from the SQLtesting project.

In actual use, (when this application is an .exe) the user (developer) will enter the Project Name, Form name and whatever else this requires and click on Button7. There cannot be any hardcoding as in my example code. This application will be installed on individual pc’s or on a network so the code must work based on what the developer enters.

What I really need is a way to POINT to another project and form and still use my code.
I believe the statements needed would precede the following 3 statements I have.

ProjAndForm = "SQLtesting.Form1"
FormInstanceType = Type.GetType(ProjAndForm, True, True)
objForm = CType(Activator.CreateInstance(FormInstanceType), Form)

Currently, if I change the value of ProjAndForm to “Controls.Form66” an exception is thrown on the FormInstanceType statement.

Could not load type ‘Controls.Form66’ from assembly ‘SQLtesting,
Version=1.0.0.0, Culture=neutral, PublicKeyToken=null’.

As I said above, the code works fine and provides exactly what I want as long as I
reference a form in the current project SQLtesting.

Can anyone help me with this?

Thank you.

Private Sub Button7_Click(ByVal sender As System.Object, ByVal e As

System.EventArgs) Handles Button7.Click

    Dim CtlType As Type
    Dim FormInstanceType As Type
    Dim index As Integer 
    Dim objForm As Form
    Dim ProjAndForm As String
    Dim TypeName1 As String
    Dim TypeName2 As String

    ListBox1.Sorted = True
    ListBox1.Items.Clear()

    CheckedListBox1.Sorted = True
    CheckedListBox1.Items.Clear()
    CheckedListBox1.CheckOnClick = True

    ProjAndForm = "SQLtesting.Form1"
    FormInstanceType = Type.GetType(ProjAndForm, True, True)
    objForm = CType(Activator.CreateInstance(FormInstanceType), Form)

    For Each ctl As Control In objForm.Controls 
        CtlType = ctl.GetType
        TypeName1 = CtlType.ToString.Substring(21) ' Remove system.windows.forms prefix
        index = CheckedListBox1.FindStringExact(TypeName1)
        If index = -1 Then
            CheckedListBox1.Items.Add(TypeName1)
        End If
        TypeName1 = TypeName1 & ":" & ctl.Name & ":" & ctl.Text
        ListBox1.Items.Add(TypeName1.ToString)
    Next ctl

End Sub
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T16:11:12+00:00Added an answer on May 25, 2026 at 4:11 pm

    What you are looking for is Assembly.LoadFrom. You will need the exe or dll for this.

    Dim path As String = "youassemblywitpath.dll"
    Dim ass As Assembly = Assembly.LoadFrom(path)
    ProjAndForm = "SQLtesting.Form1"
    FormInstanceType = ass.GetType(ProjAndForm)
    objForm = CType(Activator.CreateInstance(FormInstanceType), Form)
    

    or you could use MEF.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am currently playing around with VB.Net using Visual Studio 2010 (.Net 4.0) and
I have created a very simple window service using visual studio 2010 and .NُET
I'm using .NET 3.5. I have two string arrays, which may share one or
I am new to using Microsoft development tools but have been using Visual Studio
I just installed Visual Studio C++ 2010 Express (BTW. great ide). I have to
I'm wondering if using VS.Net 2010, I can have Entity Framework 3.5 code running
In visual studio 2010 I have setup a Project Visual Studio Installer it includes
Using .NET 1.1, I have a DataGrid that contains three columns for each row.
I have wrote an application that consists of two projects in a solution, each
I was wondering if anyone knew whether Visual Studio .NET had a parallel build

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.