A
al-s
I have a working VB.NET 2005 (.NET2.0) solution that works. When I
translate the code modules, form modules to C# I get all sorts of
build errors, much of which are related to scoping of methods.
I have the following given in a form module:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
namespace SPORTLinkCSC
{
public partial class SPortLink : Form
{
public SPortLink()
{
InitializeComponent();
}
static SPortImplement si = new SPortImplement();
private void btnQuit_Click(object sender, EventArgs e)
{
this.Close();
}
void FormLoad(object sender, EventArgs e)
{
this.txtRcvMsg.Text = "Waiting to receive message";
this.txtSndMsg.Text = "Waiting to send message";
InitBoard();
}
}
}
I also have the following in a code module which contains methods that
I want the form to call:
using System;
using System.Windows.Forms;
using System.Runtime.InteropServices;
using System.Threading;
using System.Diagnostics;
namespace SPORTLinkCSC
{
public class SPortImplement
{
private void InitBoard()
{
Int32 status = 0;
//ulong address = 0;
SPortLink.txtStatusMsg.Text = "Opening BlackTip for
Reading/Writing messages";
}
}
}
When trying to build, I get the errors:
1) An object reference is required for the nonstatic field, method,
or property
2) The name 'InitBoard' does not exist in the current context
The code module and the form module are in seperate files both in the
VB.NET project and in the C# project. Why after converting the code
from language to another does the whole thing fall apart? The two
languages are relatively close and I believe I converted them
properly. I can provide the VB.NET code of these two modules if it
would help.
Any insight or help greatly appreciated.
Al
translate the code modules, form modules to C# I get all sorts of
build errors, much of which are related to scoping of methods.
I have the following given in a form module:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
namespace SPORTLinkCSC
{
public partial class SPortLink : Form
{
public SPortLink()
{
InitializeComponent();
}
static SPortImplement si = new SPortImplement();
private void btnQuit_Click(object sender, EventArgs e)
{
this.Close();
}
void FormLoad(object sender, EventArgs e)
{
this.txtRcvMsg.Text = "Waiting to receive message";
this.txtSndMsg.Text = "Waiting to send message";
InitBoard();
}
}
}
I also have the following in a code module which contains methods that
I want the form to call:
using System;
using System.Windows.Forms;
using System.Runtime.InteropServices;
using System.Threading;
using System.Diagnostics;
namespace SPORTLinkCSC
{
public class SPortImplement
{
private void InitBoard()
{
Int32 status = 0;
//ulong address = 0;
SPortLink.txtStatusMsg.Text = "Opening BlackTip for
Reading/Writing messages";
}
}
}
When trying to build, I get the errors:
1) An object reference is required for the nonstatic field, method,
or property
2) The name 'InitBoard' does not exist in the current context
The code module and the form module are in seperate files both in the
VB.NET project and in the C# project. Why after converting the code
from language to another does the whole thing fall apart? The two
languages are relatively close and I believe I converted them
properly. I can provide the VB.NET code of these two modules if it
would help.
Any insight or help greatly appreciated.
Al