Results 1 to 9 of 9

Thread: Calling an UserClass object in a different Project and manipulating it on a Form

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Jun 2007
    Posts
    28

    Calling an UserClass object in a different Project and manipulating it on a Form

    Please see the attached project....

    'Here is the problem..... I don't know how to call Me.UserControl.DataGridUserControl from the main form... What I did is connect two projects, one has a UserClass in it and in it I have a GridView on the UserClass form. What I want to do is be able to load the data into it after I place it on Form1, (in the other project), as I did with the DataGridView1 which is directly on Form1.
    'any ideas how to do this? I am thinking that I need to declare it somehow to get it accessable in the Form1

    Notice above I declared a "testform" as a usercontrol... I am thinking that somehow I need to declare a variable as UserControl1 but I don't have that selection choice. On top of that I think somehow I am supposed have something like testform.DataGridUserControl so that I can call the DataGridUserControl which is embedded on the UserControl.
    Attached Files Attached Files

  2. #2
    Frenzied Member
    Join Date
    Aug 2006
    Posts
    1,051

    Re: Calling an UserClass object in a different Project and manipulating it on a Form

    If you are using VS2005
    Menu-Project-Add Reference-Browse-YourUserControlFile-Find Bin Folder-Find Release Folder - Click On The DLL File.

  3. #3
    Frenzied Member
    Join Date
    Aug 2006
    Posts
    1,051

    Re: Calling an UserClass object in a different Project and manipulating it on a Form

    No, that's not it.
    Searching...

  4. #4
    Frenzied Member
    Join Date
    Aug 2006
    Posts
    1,051

    Re: Calling an UserClass object in a different Project and manipulating it on a Form

    Follow this link:

    http://msdn2.microsoft.com/en-us/lib...26(VS.80).aspx

    Edit: Post #2 was how to add a reference to a library.
    Although you'll still go to the Bin Folder - Release Folder - Select the DLL
    Last edited by FourBlades; Jul 2nd, 2007 at 11:45 PM.

  5. #5
    Frenzied Member
    Join Date
    Aug 2006
    Posts
    1,051

    Re: Calling an UserClass object in a different Project and manipulating it on a Form

    Actually, after reading your problem again, I may have misunderstood what the problem is. Can you restate the problem -- try to expain it more fully?

  6. #6

    Thread Starter
    Junior Member
    Join Date
    Jun 2007
    Posts
    28

    Re: Calling an UserClass object in a different Project and manipulating it on a Form

    FourBlades,


    Thanks for looking at the problem. To be more consise, I have a solution consisting of two projects, say one is called project A and the other is Project B. Now project A has a userControl object in it and project B has the windows Form and is the start up project. So what I need to do is be able to get the UserControl object from A, stick it into B and then connect to it. I know that I can drag the UserControl from the Toolbox onto the Form in B but I can't seem to call it. In this case the UserControl object has a datagridView embedded in it and I want to hook up this datagridview while it is on Form in project B. So I can go into the code in B but don't know how to get this datagridview which is now part of the project B on the Form to display data that is bound to the Form.

    I hope this helps.

    Thanks,

    Brian

  7. #7
    Frenzied Member
    Join Date
    Aug 2006
    Posts
    1,051

    Re: Calling an UserClass object in a different Project and manipulating it on a Form

    Cleared because some confusing code was posted.
    Last edited by FourBlades; Jul 3rd, 2007 at 05:34 PM.

  8. #8
    Frenzied Member
    Join Date
    Aug 2006
    Posts
    1,051

    Re: Calling an UserClass object in a different Project and manipulating it on a Form

    Ok, I think I know what the problem probably is

    Just ignore the code I posted above, because it's going to be misleading.

    When you made your user control, did you write any property procedures?

  9. #9

    Thread Starter
    Junior Member
    Join Date
    Jun 2007
    Posts
    28

    Re: Calling an UserClass object in a different Project and manipulating it on a Form

    FourBlades,

    I figured that problem out. To solve it I created another User Control and stuck it directly into the project, (with the main Form1). I then just called it from there and through the User Control. The user Control is DataGridControl1 and the datagridview control on it is the SongBoxData. So I just call it as in the following example where I add rows to it.

    DataGridControl1.SongBoxData.Columns(0).Name = "FirstName"
    DataGridControl1.SongBoxData.Columns(1).Name = "LastName"
    DataGridControl1.SongBoxData.Columns(2).Name = "Color"
    DataGridControl1.SongBoxData.Columns(3).Name = "Song"
    PopulateGridView()

    Thanks for your thoughts and on to the next problem that I need thoughts on.

    Brian

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