Results 1 to 5 of 5

Thread: Multi line Datagridview cell

  1. #1

    Thread Starter
    Member
    Join Date
    Dec 2022
    Posts
    46

    Multi line Datagridview cell

    I have a Datagridview that I add multiple lines of text to each cell. I have that working fine. Now I'm trying figure out how to be able to delete a single line of text without deleting all text in the cell. Any suggestions?

  2. #2

    Thread Starter
    Member
    Join Date
    Dec 2022
    Posts
    46

    Re: Multi line Datagridview cell

    I do thanks

  3. #3

    Thread Starter
    Member
    Join Date
    Dec 2022
    Posts
    46

    Re: Multi line Datagridview cell

    One more question, How to Split each line and put them into separate text boxes.

  4. #4
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    110,984

    Re: Multi line Datagridview cell

    Are you asking how to do it in the UI or programmatically? I assume the latter. In that case, the Value of the cell is a String, just like any other. If you have line breaks in the text, rather than just relying on word wrap, you can split the String on the line breaks, remove the desired line from the result and then join the remaining lines back together. This applies to any String and has nothing specific to do with your grid. String.Split and String.Join are the tools you want.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  5. #5

    Thread Starter
    Member
    Join Date
    Dec 2022
    Posts
    46

    Re: Multi line Datagridview cell

    Tanks FordPrefect that's exactly what I ended up doing.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width