Display Data at rich Text Box

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • MarwaAlSagheer
    New Member
    • Nov 2008
    • 36

    Display Data at rich Text Box

    I have data table with Two Columns (S_column,R_col umn) 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 ????
  • artov
    New Member
    • Jul 2008
    • 40

    #2
    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

    Code:
    rtfBox.Select(field1Start, field1Length);
    rtfBox.SelectionFont = font1;
    rtfBox.Select(field2Start, field2Length);
    rtfBox.SelectionFont = font2;
    I used only fonts, but in your case use colors etc.

    Comment

    • MarwaAlSagheer
      New Member
      • Nov 2008
      • 36

      #3
      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 .

      Comment

      • artov
        New Member
        • Jul 2008
        • 40

        #4
        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.

        Comment

        • MarwaAlSagheer
          New Member
          • Nov 2008
          • 36

          #5
          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


          :( :( :(

          Comment

          • artov
            New Member
            • Jul 2008
            • 40

            #6
            Ok, sorry. I used the term message, since the RichTextBox was part of the bigger dialog.

            Comment

            • MarwaAlSagheer
              New Member
              • Nov 2008
              • 36

              #7
              Do you mean by Meesage richtextbox ??? HOW

              Comment

              Working...