tags:

views:

106

answers:

2

Im using c# .net.. in that im 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 mulitilines 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

+1  A: 

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