EDN Admin
Well-known member
Hi<br/> <br/> I have a DLL which I use to output a ethernet protocol called ArtNet. In VB.Net the DLL works perfectly, outputing ArtNet without any issues. However, When I try to use the DLL with C#, I get a number of issues. <br/> <br/> VB.Net code: - Works fine<br/>
<pre lang=x-vbnet> Imports ArtNetC
Public Class Form1
Inherits System.Windows.Forms.Form
Dim WithEvents ArtNet As New ArtNet
test send
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Dim DMXData(511) As Byte
DMXData(0) = 127
DMXData(1) = 255
DMXData(510) = 127
DMXData(511) = 255
send the DMXData Array to Universe 0
ArtNet.SendDMX(0, DMXData, DMXData.Length)
End Sub[/code]
C# - Not working<br/>
<pre lang="x-c# using ArtNetC;
public class Form1 : System.Windows.Forms.Form
{
ArtNet ArtNet = new ArtNet();
// test send
private void // ERROR: Handles clauses are not supported in C#
Button2_Click(System.Object sender, System.EventArgs e)
{
byte[] DMXData = new byte[512];
DMXData(0) = 127;
DMXData(1) = 255;
DMXData(510) = 127;
DMXData(511) = 255;
// send the DMXData Array to Universe 0
ArtNet.SendDMX(0, DMXData, DMXData.Length);
}
}
[/code]
Any ideas?<br/> <br/> Cheers<br/> <br/> Michael
View the full article
<pre lang=x-vbnet> Imports ArtNetC
Public Class Form1
Inherits System.Windows.Forms.Form
Dim WithEvents ArtNet As New ArtNet
test send
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Dim DMXData(511) As Byte
DMXData(0) = 127
DMXData(1) = 255
DMXData(510) = 127
DMXData(511) = 255
send the DMXData Array to Universe 0
ArtNet.SendDMX(0, DMXData, DMXData.Length)
End Sub[/code]
C# - Not working<br/>
<pre lang="x-c# using ArtNetC;
public class Form1 : System.Windows.Forms.Form
{
ArtNet ArtNet = new ArtNet();
// test send
private void // ERROR: Handles clauses are not supported in C#
Button2_Click(System.Object sender, System.EventArgs e)
{
byte[] DMXData = new byte[512];
DMXData(0) = 127;
DMXData(1) = 255;
DMXData(510) = 127;
DMXData(511) = 255;
// send the DMXData Array to Universe 0
ArtNet.SendDMX(0, DMXData, DMXData.Length);
}
}
[/code]
Any ideas?<br/> <br/> Cheers<br/> <br/> Michael
View the full article