Results 1 to 6 of 6

Thread: forms across projects in the same solution

  1. #1

    Thread Starter
    Frenzied Member maged's Avatar
    Join Date
    Nov 2002
    Location
    Egypt
    Posts
    1,040

    forms across projects in the same solution

    hi all,

    I have made a new solution, with two projects inside it,

    1 - A Windows Application

    2 - a class library, i use to store routines so that i can use them in the next projects.

    now , look .

    i have the main midi form in the project no. 1 , but the routines in project no. 2 needs to have access to the instance of the main form from project no.1 so that it can show dialogues on it and so on.

    if i make the main form as a separate class in a new project , then the main form will lose connection to it's childs ( Same Problem Again).

    I tried to make a refernce of the project 1 but the compiler said that you can only reference DLL file / Projects.


    I just need a technique to expose the type of the main midi form to other project in the same solution

    THx i Advance
    BST RGDS

  2. #2
    Frenzied Member MrGTI's Avatar
    Join Date
    Oct 2000
    Location
    Ontario, Canada
    Posts
    1,277

    Post

    All you can do is pass a reference into the functions in Project 2. For instance:
    VB Code:
    1. Public Sub EatPasta(ByRef frmDisplay as Form)
    ~Peter


  3. #3
    PowerPoster
    Join Date
    Dec 2003
    Location
    Bristol, England (but heart is in Virginia)
    Posts
    2,949
    Originally posted by MrGTI
    All you can do is pass a reference into the functions in Project 2. For instance:
    VB Code:
    1. Public Sub EatPasta(ByRef frmDisplay as Form)
    Please excuse my lack of understanding but could you explain with exact code please?

    What do you put in form1 of Project1 and form2 of Project2.?
    Taxes
    The more I learn about VB.NET the more I like dBaseIII Plus

    The foregoing, whilst believed to be correct, is given without guarantee as to it's accuracy and entirely without recourse. You are required to decide for yourself whether or not it is suitable for your purposes and no liability for loss of any nature can be entertained.

  4. #4
    Frenzied Member
    Join Date
    Nov 2003
    Posts
    1,489
    since it's in the same solution, a reference should already be made to project x from project y i believe, shouldn't he be able to create an instance of that class (assuming it's public) and call it's methods (the function)?

  5. #5

    Thread Starter
    Frenzied Member maged's Avatar
    Join Date
    Nov 2002
    Location
    Egypt
    Posts
    1,040
    well fellows, the problem is like that


    in the library project

    [vb/code]

    public sub tryx ( xx as form)
    {
    ' Some Code Here
    }

    [/Highlight]

    The problem when executing that i pass a specific kind of form
    like this

    VB Code:
    1. dim x as new frmmain
    2. tryx (x)       '''''''ERROR Appears HEre - Type is not the same (Form <> frmmain) , and of course i cant see the frmmain type from the library project and i will not make two identical copies of the main form as it is very stupid.


    THX in advance for your interests

  6. #6
    PowerPoster
    Join Date
    Dec 2003
    Location
    Bristol, England (but heart is in Virginia)
    Posts
    2,949
    Originally posted by Andy
    since it's in the same solution, a reference should already be made to project x from project y i believe, shouldn't he be able to create an instance of that class (assuming it's public) and call it's methods (the function)?
    Have you tried to do that yourself?
    Taxes
    The more I learn about VB.NET the more I like dBaseIII Plus

    The foregoing, whilst believed to be correct, is given without guarantee as to it's accuracy and entirely without recourse. You are required to decide for yourself whether or not it is suitable for your purposes and no liability for loss of any nature can be entertained.

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