new at C# so be nice...
I am trying to send some text to a form textbox using the following code:
SettingsForm.cs
namespace BluMote
{
public partial class SettingsForm : Form
{
public void send2Display(string whatWasSent)
{
this.rtbDisplay.Text = whatWasSent;
}
private void cmdOpen_Click(object sender, EventArgs e)
{
commToy.Parity = "None";
commToy.StopBits = "One";
commToy.DataBits = "8";
commToy.BaudRate = "115000";
commToy.PortName = "COM4";
commToy.OpenPort();
}
.........
}
}
And i am (trying) calling it from another class like so:
namespace PCComm
{
class CommunicationManager
{
#region OpenPort
public bool OpenPort()
{
try
{
if (comPort.IsOpen == true) comPort.Close();
comPort.BaudRate = int.Parse(_baudRate);
comPort.DataBits = int.Parse(_dataBits);
comPort.StopBits = (StopBits)Enum.Parse(typeof(StopBits), _stopBits);
comPort.Parity = (Parity)Enum.Parse(typeof(Parity), _parity);
comPort.PortName = _portName;
comPort.Open();
PCComm.frmMain form = new PCComm.frmMain();
form.send2Display("test");
return true;
}
catch (Exception ex)
{
DisplayData(MessageType.Error, ex.Message);
return false;
}
}
#endregion
}
}
And "test" does not display in the textbox field
But as you can see, its not working... What am i missing?
David