By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,983 Members | 2,082 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,983 IT Pros & Developers. It's quick & easy.

Display Data at rich Text Box

P: 36
I have data table with Two Columns (S_column,R_column) and I want to display these data at rich text box like this formate :

[Al_Sahed] (Red Color ) >>> it just Title

Data of Column [S_column] (Black Color )

Al_Share7 (Red Color) >>> it just Title

Data of Column [,R_column] (Black Color )

Al_Sahed (Red Color ) repeat this format

Data of Column [S_column] (Black Color )

Al_Share7 (Red Color)

Data of Column [,R_column] (Black Color )

And So on ..................
until display all data Rows at Table

Using c# how can present data of table like this formate at rich text box ????
Feb 1 '09 #1
Share this Question
Share on Google+
6 Replies


P: 40
I used RichTextBox so, that I build the message to a string (now that I think, StringBuilder could be bettter) one part at a time. Each time there is a change of a format, I store the length of the string to a variable and length of the field to another. Then, I set the RicthTextBox's Text to the string. Then for each part, I select the part with

Expand|Select|Wrap|Line Numbers
  1. rtfBox.Select(field1Start, field1Length);
  2. rtfBox.SelectionFont = font1;
  3. rtfBox.Select(field2Start, field2Length);
  4. rtfBox.SelectionFont = font2;
  5.  
I used only fonts, but in your case use colors etc.
Feb 2 '09 #2

P: 36
Sorry I can't understand some point
What do you mean by (I build the message to a string)

And string builder??? How it can be useful in this case??

field1Start, field1Length ? ??

Could you please explain in more details?
Thanx in advance .
Feb 2 '09 #3

P: 40
Ok, my message was about a parameter in a file; it said parameter's type, description etc (parameters are three dimension). The message is something like

Parameter name, parameter description, parameter unit
X coordinate description, X coordinate unit
Y coordinare descrption, Y coordinate unit
for example

MotorHeat Heat of the motor, celcius
power used, kW
rotation, rpm

So when I make the message, I code (paremeterName, xDesc etc. come from the parameter file)

string msg = parameterName;
int paramLength = msg.Length;
msg += " ";
int xDescStart = msg.Length;
msg += xDesc;
int xDescLength = msg.Length - xDescStart;
...
etc.etc. StringBuilder would be better, since msg += creates new string object, whereas StringBuilder is one and same object all the time.
Feb 2 '09 #4

P: 36
still ca't understand Message ??

All this i can't understand

Ok, my message was about a parameter in a file; it said parameter's type, description etc (parameters are three dimension). The message is something like


Quote:
Parameter name, parameter description, parameter unit
X coordinate description, X coordinate unit
Y coordinare descrption, Y coordinate unit
for example

MotorHeat Heat of the motor, celcius
power used, kW
rotation, rpm


:( :( :(
Feb 2 '09 #5

P: 40
Ok, sorry. I used the term message, since the RichTextBox was part of the bigger dialog.
Feb 2 '09 #6

P: 36
Do you mean by Meesage richtextbox ??? HOW
Feb 2 '09 #7

Post your reply

Sign in to post your reply or Sign up for a free account.