• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 261
  • Last Modified:

DataGridView Data

I would like to have a datagrid in which I can enter

this is text (newline)
this is more text

How do I enter a newline in a DataGridView Cell??

Also I would like to add label controls to a cell how can I do that?
0
Rowdyone52
Asked:
Rowdyone52
  • 2
  • 2
1 Solution
 
JigitCommented:
Adding new line can be done by Ctrl-Enter or Shift-Enter.
Adding static label controls can be easily done by just putting <TD> in the datagrid; adding dynaminc (bound) label controls can be also easily done by binding the desired field to the DataGrid.
0
 
Rowdyone52Author Commented:
How do I shift enter when I do it by coding, rather than manually entering it?

Datagrid1.rows[0].cells[0].value = ?
0
 
Rowdyone52Author Commented:
Can you give me an example to binding the control?

I only see how to bind it to datagridview1.control.add(), but I need to do it on the cell level.
0
 
JigitCommented:
How do I shift enter when I do it by coding, rather than manually entering it?
Datagrid1.rows[0].cells[0].value = "First line\r\nSecond line";
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: C++ 11 Fundamentals

This course will introduce you to C++ 11 and teach you about syntax fundamentals.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now