[c#] Client > Server - textbox
Well I'm just messing about with a packet logger and say if I want to inject the 'BK' and use the text from txtAlert
BK - message box popup
Code:
private void cmdAlertCS_Click(object sender, EventArgs e)
{
clsSockets.SendToClient("BK" + txtAlertCS);
}
But when I have like 'Hey there!' and I send the packet to client, the BK alert comes up fine but it comes out like;
Code:
System.Windows.Forms.Textbox, Text: Hey there!
But I don't want the 'System.Windows.Forms.Textbox, Text:' to come up.
Does anyone know how to counter this?
Re: [c#] Client > Server - textbox
By using 'txtAlertCS' which is a TextBox object (and not text), the ToString method is implicitly invoked to convert the object to a string, which results in 'System.Windows.Forms.Textbox, Text:'. The solution is to use the 'Text' property of txtAlertCS, which will return the text contained in the text box.
How it should be:
Code:
private void cmdAlertCS_Click(object sender, EventArgs e)
{
clsSockets.SendToClient("BK" + txtAlertCS.Text);
}
Re: [c#] Client > Server - textbox
Quote:
Originally Posted by
King Izu
By using 'txtAlertCS' which is a TextBox object (and not text), the ToString method is implicitly invoked to convert the object to a string, which results in 'System.Windows.Forms.Textbox, Text:'. The solution is to use the 'Text' property of txtAlertCS, which will return the text contained in the text box.
How it should be:
Code:
private void cmdAlertCS_Click(object sender, EventArgs e)
{
clsSockets.SendToClient("BK" + txtAlertCS.Text);
}
Thanks, I knew there was a simpler way to do it.