Share via

C# textbox data

Jordan Halgunseth 1 Reputation point
2021-08-26T15:45:48.423+00:00

here is data in 5 line textbox
string log = "Date Time Port Conc. Height Area Ln_Area F_Area F_Ratio Peak Stand Begin P_cur End E_Cur \r\n"

  • "02 / 10 / 2020 06:50:48 Dn 10.8 ppb 516 3129.6 1099.0 1.0920 0.01803 97.9 28650 89.7 28146 107.3 28674 \r\n"
  • "02 / 10 / 2020 06:55:45 Dn 10.5 ppb 509 3040.0 1067.3 1.0606 0.01779 97.8 28652 90.3 28156 105.4 28676 \r\n"
  • "02 / 10 / 2020 07:01:43 Dn 11.1 ppb 542 3218.2 1130.1 1.1227 0.01893 97.9 28656 90.0 28127 105.8 28678 \r\n"
  • "02 / 10 / 2020 06:50:48 Dn 10.8 ppb 516 3129.6 1099.0 1.0920 0.01803 97.9 28650 89.7 28146 107.3 28674 \r\n"
  • "02 / 10 / 2020 06:55:45 Dn 10.5 ppb 509 3040.0 1067.3 1.0606 0.01779 97.8 28652 90.3 28156 105.4 28676 \r\n"
  • "02 / 10 / 2020 07:01:43 Dn 11.1 ppb 542 3218.2 1130.1 1.1227 0.01893 97.9 28656 90.0 28127 105.8 28678 \r\n"
  • "02 / 10 / 2020 06:50:48 Dn 10.8 ppb 516 3129.6 1099.0 1.0920 0.01803 97.9 28650 89.7 28146 107.3 28674 \r\n"
  • "02 / 10 / 2020 06:55:45 Dn 10.5 ppb 509 3040.0 1067.3 1.0606 0.01779 97.8 28652 90.3 28156 105.4 28676 \r\n"
  • "02 / 10 / 2020 07:01:43 Dn 11.1 ppb 542 3218.2 1130.1 1.1227 0.01893 97.9 28656 90.0 28127 105.8 28678 \r\n"
  • "02 / 10 / 2020 06:50:48 Dn 10.8 ppb 516 3129.6 1099.0 1.0920 0.01803 97.9 28650 89.7 28146 107.3 28674 \r\n"
  • "02 / 10 / 2020 06:55:45 Dn 10.5 ppb 509 3040.0 1067.3 1.0606 0.01779 97.8 28652 90.3 28156 105.4 28676 \r\n"
  • "02 / 10 / 2020 07:01:43 Dn 11.1 ppb 542 3218.2 1130.1 1.1227 0.01893 97.9 28656 90.0 28127 105.8 28678 \r\n";
    I want to be able to scroll down with first line staying,
    so you know what data means.
    How can this be done
Developer technologies | C#
Developer technologies | C#

An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.


3 answers

Sort by: Most helpful
  1. Castorix31 91,876 Reputation points
    2021-08-27T15:09:22.193+00:00

    It can be done with EM_SETRECT, splitting header + data and drawing header in WM_PAINT,
    but the formatting of your header + colums is bad (not same size)
    I just added space to the date/time column with a GenericMonospace font, but other columns cannot be aligned with this format (titles width > data width)

    127155-richtextbox-setrect.gif

    Was this answer helpful?

    1 person found this answer helpful.
    0 comments No comments

  2. Timon Yang-MSFT 9,611 Reputation points
    2021-08-27T07:10:13.317+00:00

    If you want to display one row at a time and switch through the scroll wheel, then combobox should be closer to your needs.

    The problem is that the combobox cannot keep the first line.

    But since the title is unchanged, you can put a label on it, or you can rewrite the combobox to make it display multiple lines.

    Multiline combobox dropdown list


    If the response is helpful, please click "Accept Answer" and upvote it.
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    Was this answer helpful?

    0 comments No comments

  3. Joel Martinez 96 Reputation points Microsoft Employee Admin
    2021-08-26T18:06:57.977+00:00

    Looks to me like you are trying to display somewhat tabular data ... realistically, you will need to parse out the content in the string "log" to separate the headers from the content. Then at that point you can create a layout that leaves the first line content steady while letting you scroll the bottom content below it.

    That being said, you've not indicated whether this is a web application you're working on, or uwp, etc. so any additional implementation details would vary obviously.

    Was this answer helpful?

    0 comments No comments

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.