new line in datagrid cell

J

jareksmcp

Hello

I have got a datagrid control on window form. One of its column should
comprise long text (note) . Not too long. Let's say that 255
characters. But I want to allow users to press enter key in order to
add new line character. My idea is to override ProcessCmdKey and catch
processing of enter key. I can add character at the end of text object
of CurrentCell but ControlChars.NewLine just simply move cursor to the
begining of text not ot the begining of the new line. What am I doing
wrong?
Mayby another idea how to achieve this.

Personal remark:
As I remember VS.NET was suppoused to improve writing application. It
should be quicker, better and all of this. But in order to achieve just
a little of (let's say) Sybase PowerBuilder functionality I must write
a huge lines of code. There are problems with almost everything. I
can't use combo box in datagrid in simply way - I must write many lines
of codes. I don't even say about multicolumn combobox. Is there anybody
having the same feeling?
 
J

jareksmcp

I've just found the solution. It was enough to set SelectionStart
property at the value of text length


(e-mail address removed) napisal(a):
 
C

Cor Ligthert [MVP]

Jarek,

I only have it for a datagridview

http://www.vb-tips.com/default.aspx?ID=0f172b8e-cbc3-483f-a622-9ec47f79cd27

Your feeling about going from A to B is normal. It is the same as that you
would start working in the Ukraine or Germany. You would find the behaviour
there strange because you are used to your old habbits. After a while you
would see the good things, although some things will forever stay strange
for you.

Despite of that, the Datagrid is missing a lot that is now in the
DataGridView. Working with that last makes life easier.

It does not help if you don't have version 2005, but despite of that my idea
was to give you this answer so I hope it helps something.

Cor
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top