Click here to Skip to main content
15,921,622 members
Home / Discussions / C#
   

C#

 
QuestionDoubleBuffered Pin
HexaDeveloper24-Apr-07 6:22
HexaDeveloper24-Apr-07 6:22 
AnswerRe: DoubleBuffered Pin
Patrick Etc.24-Apr-07 15:31
Patrick Etc.24-Apr-07 15:31 
GeneralRe: DoubleBuffered Pin
Brady Kelly24-Apr-07 18:49
Brady Kelly24-Apr-07 18:49 
GeneralRe: DoubleBuffered Pin
Patrick Etc.25-Apr-07 3:59
Patrick Etc.25-Apr-07 3:59 
GeneralRe: DoubleBuffered Pin
Brady Kelly25-Apr-07 5:04
Brady Kelly25-Apr-07 5:04 
GeneralRe: DoubleBuffered Pin
HexaDeveloper25-Apr-07 12:39
HexaDeveloper25-Apr-07 12:39 
GeneralRe: DoubleBuffered Pin
HexaDeveloper28-Apr-07 9:24
HexaDeveloper28-Apr-07 9:24 
Questioncarriage return question Pin
JEC456824-Apr-07 6:05
JEC456824-Apr-07 6:05 
Hello

I wrote a string appender class in c# that appends to a string until it finds a certain
group of characters. It then fires off a delegate with the completed string after the characters have been found and clears the text from the object. I'm receiving data from sockets and the carrage returns and line feeds I'm getting are in a unicode like format such as \0a or \0d. How do I search for those characters using the below class.



#region StringAppender
public class StringAppender : TextBox
{
ErrorLogging Err = new ErrorLogging();
public StringAppender()
{
this.Multiline = true;
}

public delegate void TextReceived(string Value);

public event TextReceived TextDataReceived;


private delegate void SetTextCallBack(string Text,bool AppendText);


public string TextBox
{
get
{
return this.Text;
}
set
{
SetText(value,false);
// this.Text = value;
}
}

private void SetText(string Text,bool Append)
{
SetTextCallBack SCallBack = new SetTextCallBack(SetText);

if (Append == false)
{
if (this.InvokeRequired)
{

this.Invoke(SCallBack, new object[] { Text,Append });
}
else
{
this.Text = Text;
}
}
else
{
if (this.InvokeRequired)
{
this.Invoke(SCallBack, new object[] { Text, Append });
}
else
{
this.Text = this.Text + Text;
}
}
}

public void AppendText(string Text, string[] ValuesSearched, bool FirstRun)
{

//Text = Text.Replace("\0", "");


if (Text.Length > 0)
{
try
{
//this.Text = this.Text + Text;
SetText(Text, true);

foreach (string Str in ValuesSearched)
{
//if (this.Text.IndexOf(Str) != -1)
//{
// TextDataReceived(this.Text.Substring(0, this.Text.IndexOf(Str)));

// //this.Text = string.Empty;
// SetText(string.Empty, false);
//}

if(this.Text.Contains(Str))
{
TextDataReceived(this.Text.Substring(0, this.Text.IndexOf(Str)));
SetText(string.Empty, false);
}
}
}
catch (Exception Ex)
{
throw Ex;
}
}
}

public void AppendText(string Text, string ValueSearched, bool FirstRun)
{


//Text = Text.Replace("\0", "");


if (Text.Length > 0)
{
try
{
//this.Text = this.Text + Text;
SetText(Text, true);

if (this.Text.IndexOf(ValueSearched) != -1)
{
TextDataReceived(this.Text.Substring(0, this.Text.IndexOf(ValueSearched)));

//this.Text = string.Empty;
SetText(string.Empty, false);
}

}
catch (Exception Ex)
{
throw Ex;
}
}

}

}


Jason E Cain

QuestionSave file name Pin
Anka_Ame24-Apr-07 5:20
Anka_Ame24-Apr-07 5:20 
AnswerRe: Save file name Pin
netJP12L24-Apr-07 8:55
netJP12L24-Apr-07 8:55 
QuestionDatatables and Database tables Pin
lost in transition 24-Apr-07 5:18
lost in transition 24-Apr-07 5:18 
AnswerRe: Datatables and Database tables Pin
lost in transition 24-Apr-07 6:11
lost in transition 24-Apr-07 6:11 
QuestionCreating a Graphical Relationship Pin
Gareth H24-Apr-07 4:49
Gareth H24-Apr-07 4:49 
AnswerRe: Creating a Graphical Relationship Pin
Pete O'Hanlon24-Apr-07 5:01
mvePete O'Hanlon24-Apr-07 5:01 
QuestionScript Editor in C# Pin
Adobe200724-Apr-07 4:30
Adobe200724-Apr-07 4:30 
AnswerRe: Script Editor in C# Pin
Pete O'Hanlon24-Apr-07 4:38
mvePete O'Hanlon24-Apr-07 4:38 
AnswerRe: Script Editor in C# Pin
Adobe200724-Apr-07 6:20
Adobe200724-Apr-07 6:20 
QuestionMouse Wheel Pin
The Brazilian One24-Apr-07 4:04
The Brazilian One24-Apr-07 4:04 
AnswerRe: Mouse Wheel Pin
Judah Gabriel Himango24-Apr-07 4:12
sponsorJudah Gabriel Himango24-Apr-07 4:12 
GeneralRe: Mouse Wheel Pin
The Brazilian One24-Apr-07 4:15
The Brazilian One24-Apr-07 4:15 
GeneralRe: Mouse Wheel Pin
The Brazilian One24-Apr-07 4:20
The Brazilian One24-Apr-07 4:20 
GeneralRe: Mouse Wheel Pin
Judah Gabriel Himango24-Apr-07 4:40
sponsorJudah Gabriel Himango24-Apr-07 4:40 
GeneralRe: Mouse Wheel Pin
The Brazilian One24-Apr-07 5:57
The Brazilian One24-Apr-07 5:57 
GeneralRe: Mouse Wheel Pin
Judah Gabriel Himango24-Apr-07 8:18
sponsorJudah Gabriel Himango24-Apr-07 8:18 
QuestionDeploying Visual C# express application Fails on target cpu Pin
kourvoisier24-Apr-07 3:59
kourvoisier24-Apr-07 3:59 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.