Hello
I have this in my Form1.cs:
Code:
public void msg1(string msgtype, string Message)
{
string time = DateTime.Now.ToShortTimeString();
String res = "[" + time + "] " + Message;
int selectionStart = richTextBox1.TextLength;
richTextBox1.AppendText(res + Environment.NewLine);
// OR rtbTestResult.Text += res + Environment.NewLine;
richTextBox1.SelectionStart = selectionStart;
richTextBox1.SelectionLength = res.Length;
//Set colour(0=Red|1=Green|2=Black)
if (msgtype == "0")
{
richTextBox1.SelectionColor = Color.Red;
richTextBox1.ScrollToCaret();
}
else if (msgtype == "1")
{
richTextBox1.SelectionColor = Color.Green;
richTextBox1.ScrollToCaret();
}
else if (msgtype == "2")
{
richTextBox1.SelectionColor = Color.Black;
richTextBox1.ScrollToCaret();
}
}
I want to access it from codefile1.cs. but:
Code:
msg1("2","test message");
Doesn't work.
So I tired changing:
Code:
public void msg1(string msgtype, string Message)
to:
Code:
static public void msg1(string msgtype, string Message)
but now richTextBox1 has the red line under it to show an error, like this:
the error shows:
Any help please?