|
||
|
|
#1 (permalink) |
|
Forum Expert
|
Hello, i am having a bit of a problem with textboxes. I am trying to get it to put each message on a new line, instead of adding it to the end of one, or replacing whats there. Here is part of the code:
Code:
(...)
private void button1_Click(object sender, EventArgs e)
{
try
{
tcpclnt = new TcpClient();
SetText4("Connecting...");
tcpclnt.Connect(textBox2.Text, 8221);
}
catch (Exception p)
{
SetText1("Connecting Error: " + p.ToString() + "");
}
}
private void SetText1(string text)
{
if (this.textBox1.InvokeRequired)
{
SetTextCallback d = new SetTextCallback(SetText1);
this.Invoke(d, new object[] { text });
}
else
{
this.textBox1.Text += text;// adds to the end of the line
}
}
private void SetText4(string text)
{
if (this.textBox4.InvokeRequired)
{
SetTextCallback d = new SetTextCallback(SetText4);
this.Invoke(d, new object[] { text });
}
else
{
this.textBox4.Text = text;//replaces whats there
}
}
private void SetText5(string text)
{
if (this.textBox5.InvokeRequired)
{
SetTextCallback d = new SetTextCallback(SetText5);
this.Invoke(d, new object[] { text });
}
else
{
this.textBox5.Text = text;
}
}
(...)
Any insight would be fantastic. ![]() |
|
|
|
|
|
#2 (permalink) |
|
Forum Expert
|
try adding a new line character '\n' at the beginning of each message ( or at the end of the previous one ) that you want to be put on a single line.
__________________
Angels are falling the very last time, down they're burning in hate and decline, unfaithful and violent we're breaking the spell, we're god, we're scissor, in heaven and hell! |
|
|
|
|
|
#4 (permalink) |
|
ConnectUO Creator
Join Date: Jan 2004
Age: 28
Posts: 4,886
|
incase you cared, i believe textbox.Append( text ); works too
![]()
__________________
Jeff Boulanger ConnectUO - Core Developer Want to help make ConnectUO better? Click here to submit your ideas/requests Use your talent to compete against other community members in RunUO hosted coding competitions If you know XNA (even if its just a little) or are a good artist(2d or 3d) and are interested in making games for a hobby send me a pm or drop by #xna in irc.runuo.com. I'm looking to put together a small game development team. Please do not pm me for support. If you are having issues please post in the appropriate forum. Thanks for your continued support of both ConnectUO and RunUO |
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|