CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 9 of 9

Threaded View

  1. #1
    Join Date
    Oct 2006
    Posts
    82

    How to code access to DLL method from 2 Winforms?

    I am trying to structure my code in a better way than a pile of classes. I was going to use a DLL, but I am now stuck.

    The code below represents parts of the Windows Forms application and part of a DLL.
    I need to make methods of the AxerDataMgrClass available to the code in frmEnabledApps class and MainForm class.
    How does one do that?
    Code:
    using System;
    using System.Windows.Forms;
    using nsCommonDLL;
    namespace AccessTestForm1
    {
    	public partial class Form1 : Form
    	{
    		CommonDLLClass DEF = new CommonDLLClass();
    		public Form1()
    		{
    			InitializeComponent();
    		}
    		private void Form1_Load(object sender, EventArgs e)
    		{
    
    		}
    	}
    }
    Code:
    using System;
    using System.Collections.Generic;
    using System.Windows.Forms;
    using CD = nsCommonDLL.CommonDLLClass;
    
    namespace AccessTestForm1
    {
    	public partial class CommonDLLTestForm2 : Form
    	{
    		public CommonDLLTestForm2()
    		{
    			InitializeComponent();
    		}
    
    		private void CommonDLLTestForm2_Load(object sender, EventArgs e)
    		{
            		I need to access TMC.UpdateAppsLists() here.
    		}
    	}
    }
    Code:
    using System;
    namespace nsCommonDLL
    {
    	public class CommonDLLClass
    	{
    		public string ABC = "aBC";
    		public string XYZ()
    		{
    			return "xyz";
    		}
    		private string QQQ = "QQQ";
    	}
    }
    Last edited by Lou Arnold; April 7th, 2011 at 12:26 PM.

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

Featured