Home
|
Forums
|
Contact
|
Search
|
Syndication
[login]
[create account]
Saturday, February 22, 2025
slxdeveloper.com
Home
Search
Contact us
About slxdeveloper
Syndication
Community
Forums
(NEW!)
Newsletter Archive
Members
Your Profile
Submit Article
General
Administration
(6)
OLE DB Provider
Miscellaneous
(2)
Architect
VBScript
(9)
ActiveX Controls
(6)
How To's
(14)
.NET Extensions
(3)
External
OLE DB Provider
(12)
SLAPI (SlgxApi.dll)
SalesLogix COM
(1)
Web
ASP/ASP.NET
(2)
Web Services
Web Client
Downloads
Samples
(17)
Documentation
(7)
Utilities
(18)
Resources
SalesLogix
(3)
Programming
(1)
2/22/2025 9:00:18 AM
slxdeveloper.com Community Forums
The Forums on slxdeveloper.com are now retired. The forum archive will remain available for the time being. Thank you for your participation on slxdeveloper.com!
Architect Forums - SalesLogix .NET Extensions
Forum to discuss the use of .NET Extensions in SalesLogix version 7 and higher. View the
code of conduct
for posting guidelines.
Forums RSS Feed
Back to Forum List
|
Back to SalesLogix .NET Extensions
|
New Thread
View:
Dynamic
Flat
Tree
Search:
Author
Thread: can't build a .net form in c#
vaughn poulson
Posts: 28
can't build a .net form in c#
Posted: 08 Feb 08 10:28 AM
I'm having trouble creating a .net extension for slx. It is a windows form and when it is created there are three files automatically created. Here is the code from Form1.cs:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using Sage.SalesLogix.NetExtensions;
namespace WinTest
{
public partial class Form1 : Sage.SalesLogix.NetExtensions.IRunnable
{
private Sage.SalesLogix.NetExtensions.SalesLogix.ISlxApplication _SlxApplication;
public void Initialize(Sage.SalesLogix.NetExtensions.SalesLogix.ISlxApplication SlxApplication, Sage.SalesLogix.NetExtensions.Licensing.ILicenseKeyManager LicenseKeyManager)
{
_SlxApplication = SlxApplication;
}
public object Run(object[] Args)
{
return null;
}
}
}
Here is the code from Form1.Designer.cs
namespace WinTest
{
partial class Form1 : Sage.SalesLogix.NetExtensions.IRunnable
{
///
/// Required designer variable.
///
private System.ComponentModel.IContainer components = null;
///
/// Clean up any resources being used.
///
///
true if managed resources should be disposed; otherwise, false.
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
///
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
///
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.Text = "Form1";
}
#endregion
}
}
Here is the code from Program.cs:
using System;
using System.Collections.Generic;
using System.Windows.Forms;
namespace WinTest
{
static class Program
{
///
/// The main entry point for the application.
///
[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new Form1());
}
}
}
I keep getting the following error:
WinTest.Form1.Dispose(bool): no suitable method found to override
I'm not sure what i'm doing wrong, can anyone please help?
[
Reply
][
Quote
]
Ryan Farley
Posts: 2265
Re: can't build a .net form in c#
Posted: 08 Feb 08 10:45 AM
You've changed the form's base class from System.Windows.Forms.Form to Sage.SalesLogix.NetExtensions.IRunnable. You still need to inherit from the Form base class but you can also implement the IRunnable interface. As it is now, you've changed this so it is no longer a form, but it is still attempting to override Form class methods.
Change the class to this:
public partial class Form1 :
Form
, Sage.SalesLogix.NetExtensions.IRunnable
{
//...
}
Make sense?
[
Reply
][
Quote
]
vaughn poulson
Posts: 28
Re: can't build a .net form in c#
Posted: 08 Feb 08 11:20 AM
Yes, that makes sense and now it compiles. I'm now having the problem of launching it from slx. I added a nav bar button to launch it and here is the code:
option explicit
sub Main
Dim ext
ext = Application.Managed.Create("WinApp","WinApp.Form1")
Application.Managed.Run ext
Application.Managed.Destroy ext
end sub
where WinApp is the name of the solution and Form1 is where the Run method is placed.
[
Reply
][
Quote
]
vaughn poulson
Posts: 28
Re: can't build a .net form in c#
Posted: 08 Feb 08 11:33 AM
If i remove the Application.Managed.Destroy ext it will work. Do i really need to include that?
[
Reply
][
Quote
]
Ryan Farley
Posts: 2265
Re: can't build a .net form in c#
Posted: 08 Feb 08 12:11 PM
Quote:
Originally posted by vaughn poulson
If i remove the Application.Managed.Destroy ext it will work. Do i really need to include that?
That is because you're opening the form as a non-modal form so it is still open when you destroy it. At some point you'd need to destroy it or you'll be creating a memory leak. Or you could open the form as a modal form, then it won't get to the destroy line until after it closes.
[
Reply
][
Quote
]
vaughn poulson
Posts: 28
Re: can't build a .net form in c#
Posted: 08 Feb 08 2:17 PM
I'm new to slx. How do you open the form as a modal form?
[
Reply
][
Quote
]
Ryan Farley
Posts: 2265
Re: can't build a .net form in c#
Posted: 08 Feb 08 2:54 PM
Quote:
Originally posted by vaughn poulson
I'm new to slx. How do you open the form as a modal form?
Not really a SLX thing, a C# thing. Somewhere in your C# code you're showing the form, right? You'll want to ShowDialog instead of just show. What I usually do is have a class in my extension that get's loaded from IRunnable and then that calls ShowDialog on my form - both the class and the form are in the same DLL that I add to SLX.
-Ryan
[
Reply
][
Quote
]
Mark Dykun
Posts: 297
Re: can't build a .net form in c#
Posted: 09 Feb 08 8:16 AM
It looks as if you are building a .net C# application (.exe) for your project based on the files you created. You should not have the Main class that 'Enables styles' and adds Form1 to the application. You start off by creating a .net class library.
You add a single class that implements IRunnable. This is your entry point into showing your form. Now there are 2 ways to tackle your form showing need.
1) in the Run method do
Form1 myForm = new Form1();
myForm.ShowDialog();
- or -
2) Have the run class inherit from System.ComponentModel.Component and make sure that your assembly is COM visible. This can be set in project properties.
You then can add methods to your class that can be called from SalesLogix directly
public void ShowAccountExtensionForm()
{
AccountExtForm form = new AccountExtForm();
form.ShowDialog();
}
in SLX VBScript
dim guid
dim obj
guid = Application.Managed.Create(...)
set obj = Application.Managed.Run(guid, nothing)
obj.ShowAccountExtensionForm()
Does this make sense?
[
Reply
][
Quote
]
Page 1 of 1
You can subscribe to receive a daily forum digest in your
user profile
. View the site
code of conduct
for posting guidelines.
Forum RSS Feed
-
Subscribe to the forum RSS feed to keep on top of the latest forum activity!
slxdeveloper.com is brought to you courtesy of
Ryan Farley
&
Customer FX Corporation
.
This site, and all contents herein, are Copyright © 2025 Customer FX Corporation. The information and opinions expressed here are not endorsed by Sage Software.
code of conduct
|
page cache (param): 2/22/2025 9:14:10 AM