S
Scott Starker
I have spent hours looking for the answer but I don't think I can phrase it
right to the search engines out there. So, I guess I'll have to try out
people and give it a shot!
If I have 2 .cs files and I want to share the same class (in a third .cs
file) with my 2 .cs files how do I do this? I.e., I have a project with 6 cs
files. In the Form1.cs file I have:
namespace TECData
{
public partial class Form1 : Form
{
ButtonArray MyButtonArray;
public Form1()
{
InitializeComponent();
MyButtonArray = new ButtonArray(this, "Arial");
for (int i = 1; i <= 0xff - 0x21; i++)
{
MyButtonArray.AddNewButton("Arial");
}
....
And then in TEC.cs I have:
namespace TECData
{
public partial class TEC : Form
{
public TEC()
{
InitializeComponent();
EncodingName();
}
private void EncodingName()
{
for (int x = 0; x <= 0xff - 0x21; x++)
{
if (MyButtonArray.CharArray(x))
{
....
MyButtonArray is built in Forms1.cs. That's fine. But now in TEC.cs the
error is "The name 'MyButtonArray' does not exist in the current context". I
have tried a bunch of ways but can anyone help me? (The CharArray(x) is a
bool method.)
Scott
right to the search engines out there. So, I guess I'll have to try out
people and give it a shot!
If I have 2 .cs files and I want to share the same class (in a third .cs
file) with my 2 .cs files how do I do this? I.e., I have a project with 6 cs
files. In the Form1.cs file I have:
namespace TECData
{
public partial class Form1 : Form
{
ButtonArray MyButtonArray;
public Form1()
{
InitializeComponent();
MyButtonArray = new ButtonArray(this, "Arial");
for (int i = 1; i <= 0xff - 0x21; i++)
{
MyButtonArray.AddNewButton("Arial");
}
....
And then in TEC.cs I have:
namespace TECData
{
public partial class TEC : Form
{
public TEC()
{
InitializeComponent();
EncodingName();
}
private void EncodingName()
{
for (int x = 0; x <= 0xff - 0x21; x++)
{
if (MyButtonArray.CharArray(x))
{
....
MyButtonArray is built in Forms1.cs. That's fine. But now in TEC.cs the
error is "The name 'MyButtonArray' does not exist in the current context". I
have tried a bunch of ways but can anyone help me? (The CharArray(x) is a
bool method.)
Scott