Click here to Skip to main content
15,895,142 members
Home / Discussions / C#
   

C#

 
GeneralSMS from a website Pin
Trance Junkie4-May-05 4:15
Trance Junkie4-May-05 4:15 
GeneralRe: SMS from a website Pin
Judah Gabriel Himango4-May-05 8:17
sponsorJudah Gabriel Himango4-May-05 8:17 
GeneralRe: SMS from a website Pin
Shashidharreddy6-May-05 23:15
Shashidharreddy6-May-05 23:15 
GeneralICustomTypeDescriptor - implementation Pin
Anonymous4-May-05 3:45
Anonymous4-May-05 3:45 
GeneralRe: ICustomTypeDescriptor - implementation Pin
Anonymous4-May-05 4:48
Anonymous4-May-05 4:48 
GeneralRe: ICustomTypeDescriptor - implementation Pin
Anonymous4-May-05 5:10
Anonymous4-May-05 5:10 
GeneralRe: ICustomTypeDescriptor - implementation Pin
Mathew Hall4-May-05 15:48
Mathew Hall4-May-05 15:48 
Questionhow to convert text inro rtf and display the same in a richtextbox?? Pin
reachme_saurabh4-May-05 3:27
reachme_saurabh4-May-05 3:27 
hi ,
i am trying to fetch the datafrom database into dataet and display it in a richtextbox in rtf format.
it displays a illegal file format.
please throw some light on where i am mistaken
below is the code for your reference

{
string st;
string st1 = "";

st = "select * from TPNeeds";
SqlDataAdapter ad = new SqlDataAdapter(st,con);
ad.Fill(dataset11,0,0,"TPNeeds");
DataTable dt = dataset11.Tables[0];
ArrayList arr = new ArrayList();
//Encoder e1 = Encoding.UTF8.GetEncoder();
Encoding encode = Encoding.Default;
foreach(DataRow row in dt.Rows)
{

st1 += row["NeedText"].ToString();
//richTextBox2.Rtf = encoding.GetString(binaryData,0,binaryData.Length);
}

byte[] rawBytes = Encoding.ASCII.GetBytes( st1 );
using ( MemoryStream ms = new MemoryStream(rawBytes) )
{
richTextBox2.LoadFile( ms, RichTextBoxStreamType.RichText );
}
// System.IO.MemoryStream stream = new System.IO.MemoryStream(StrToByteArray(st1));
// richTextBox2.LoadFile(stream,RichTextBoxStreamType.PlainText);
//richTextBox2.LoadFile(stream,RichTextBoxStreamType.RichText);
//richTextBox2.Rtf = encoding.GetString(bytearr,0,bytearr.Length);

}
catch(Exception ex)
{
MessageBox.Show(ex.Message.ToString());
MessageBox.Show(ex.StackTrace.ToString());
}
}

public static byte[] StrToByteArray(string str)
{
System.Text.ASCIIEncoding encoding=new System.Text.ASCIIEncoding();
return encoding.GetBytes(str);
}


mrlathiwala
AnswerRe: how to convert text inro rtf and display the same in a richtextbox?? Pin
Judah Gabriel Himango4-May-05 4:33
sponsorJudah Gabriel Himango4-May-05 4:33 
GeneralRe: how to convert text inro rtf and display the same in a richtextbox?? Pin
Anonymous4-May-05 20:18
Anonymous4-May-05 20:18 
GeneralRe: how to convert text inro rtf and display the same in a richtextbox?? Pin
Judah Gabriel Himango5-May-05 4:06
sponsorJudah Gabriel Himango5-May-05 4:06 
GeneralDirectShow with C# Pin
rajshukla1234-May-05 3:18
rajshukla1234-May-05 3:18 
GeneralRe: DirectShow with C# Pin
MoustafaS4-May-05 4:09
MoustafaS4-May-05 4:09 
GeneralRe: DirectShow with C# Pin
Judah Gabriel Himango4-May-05 4:32
sponsorJudah Gabriel Himango4-May-05 4:32 
GeneralCustomLabel class deriving from Label and CustomBehaviuor classes Pin
Anonymous4-May-05 2:46
Anonymous4-May-05 2:46 
GeneralRe: CustomLabel class deriving from Label and CustomBehaviuor classes Pin
MoustafaS4-May-05 2:59
MoustafaS4-May-05 2:59 
GeneralRe: CustomLabel class deriving from Label and CustomBehaviuor classes Pin
Anonymous4-May-05 3:08
Anonymous4-May-05 3:08 
GeneralRe: CustomLabel class deriving from Label and CustomBehaviuor classes Pin
keith maddox4-May-05 9:41
keith maddox4-May-05 9:41 
GeneralRe: CustomLabel class deriving from Label and CustomBehaviuor classes Pin
leppie4-May-05 3:27
leppie4-May-05 3:27 
GeneralRe: CustomLabel class deriving from Label and CustomBehaviuor classes Pin
Anonymous4-May-05 3:37
Anonymous4-May-05 3:37 
GeneralRe: CustomLabel class deriving from Label and CustomBehaviuor classes Pin
leppie4-May-05 3:52
leppie4-May-05 3:52 
GeneralRe: CustomLabel class deriving from Label and CustomBehaviuor classes Pin
Anonymous4-May-05 4:16
Anonymous4-May-05 4:16 
QuestionHow do word covert pdf Pin
shu_mi4-May-05 2:00
shu_mi4-May-05 2:00 
AnswerRe: How do word covert pdf Pin
DavidNohejl4-May-05 2:15
DavidNohejl4-May-05 2:15 
GeneralAdd thousand separator and keep decimal precision Pin
Jan R Hansen4-May-05 1:55
Jan R Hansen4-May-05 1:55 

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.