Results 1 to 5 of 5

Thread: [RESOLVED] Adding a new line into a cell of a DataGridView

Threaded View

  1. #1

    Thread Starter
    Frenzied Member MrGTI's Avatar
    Join Date
    Oct 2000
    Location
    Ontario, Canada
    Posts
    1,277

    Resolved [RESOLVED] Adding a new line into a cell of a DataGridView

    Hello.

    I have searched for this, and not been able to find any examples where someone has done this. I'm trying to add a new line into the cell of a DataGridView so the text appears on 2 lines (of the same cell). Here's some code to explain what i'm doing:

    Code:
    Dim DS As New DataSet("aa")
    Dim tbl As DataTable = DS.Tables.Add("bb")
    Dim xRow2 As DataRow = tbl.NewRow()
    xRow2("Equipment") = "-Lawnmower" & vbCrLf & "-Logcutter"
    tbl.Rows.Add(xRow2)
    grdRented.DataSource = DS.Tables("bb")
    But the entries keep showing up on the same line with an unknown character code (ie: -Lawnmower[]-Logcutter) instead of being on two separate lines. How can i make it bump the text down a line (inside the cell) so that it appears like this?:

    -Lawnmower
    -Logcutter

    I've seen this code done (and work) in VB6 with a grid control, so i'm confused as to why i can't get it to work now. Am i missing some super top secret setting that allows it to span two lines?
    .
    Last edited by MrGTI; Oct 11th, 2011 at 09:41 AM. Reason: resolved
    ~Peter


Tags for this Thread

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