5

I'm using C# .net.. in that I'm working with windows form application

I have a datagrid view with two columns. the first column is readonly and the other is editable. now I want every cell of the second column to support for multilines in each cell. I want to press enter key and come to the next line in the same cell. But now if I press enter key it is going to the next cell below it. I want the cursor to be in the next line of the same cell

Cœur
  • 37,241
  • 25
  • 195
  • 267
saeed
  • 673
  • 3
  • 12
  • 22
  • as in my knowledge i think cell is single line object you just make space in words and after saving it your data will appear in wrap format. – Emaad Ali Apr 01 '10 at 11:47

1 Answers1

2

Maybe you can:

  1. hook to the KeyDown event
  2. check if Enter was hit, if true:
  3. add a linebreak to the cell's string value, and:
  4. mark the event has handled by setting e.SuppressKeyPress to True
M.A. Hanin
  • 8,044
  • 33
  • 51