Jess,
>I created a project but not based on MM project. The form however was created based on MM Business Form. The problem is when I called class methods just like below it gives me an error:
>
>this.GetDataSet("SELECT * FROM Orders WHERE CustomerID "+sqlSOrders+" @CustomerID",
> this.CreateParameter("@CustomerID", sqlPOrders));
>
>error message is:
>
>NullReferenceException was unhandled!
>Object reference not set to an instance of an object.
>
>Note: The same object class works in different form without change.
If this is a non-MM .NET project, make sure you instantiate an MM .NET application object so the form and business objects have access to MM .NET service components.
You can do the following:
- Copy the App.cs file from C:\Program Files\Mere Mortals .NET Framework 2005\VC#\Templates\Windows Forms Template, copy it to your root project directory and add it to the project
- At application startup, instantiate the application object before trying to access any data or display any form. For example:
public static AppDesktop App;
[STAThread]
public static void Main()
{
App = new AppDesktop();
}
Best Regards,
Kevin McNeish
Eight-Time .NET MVP
VFP and iOS Author, Speaker & Trainer
Oak Leaf Enterprises, Inc.
Chief Architect, MM Framework
http://www.oakleafsd.com