473,320 Members | 1,969 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

new line in datagrid cell

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?

Jun 20 '06 #1
2 4438
I've just found the solution. It was enough to set SelectionStart
property at the value of text length
ja*******@gazeta.pl napisal(a):
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?


Jun 20 '06 #2
Jarek,

I only have it for a datagridview

http://www.vb-tips.com/default.aspx?...2-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
Jun 20 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Terry | last post by:
Hey, Having somewhat of an issue, I have a datagrid which is giving me issues. The Datagrid is setup for the user to double click the row, the row is selected and data within that row populates a...
0
by: Emerson | last post by:
The following assumes a System.Windows.Forms.DataGrid with a System.Data.DataTable set as the DataSource. I'm programming in C# Here's my scenario I click in a cell on a DataGrid. I enter some...
3
by: PeterZ | last post by:
G'day, After doing much searching and pinching bits of ideas from here there and everywhere I came up with a fairly 'clean' solution of including a comboBox into a dataGrid column. You can...
2
by: Daniel Walzenbach | last post by:
Hi, I created an ASP.NET Datagrid where a single row can be selected by clicking anywhere on the row (according to...
1
by: strout | last post by:
I know it's dumb ... sometimes frustrating I want the text and a dropdownlist align with both side of a table cell, i.e. text align left and dropdownlist align right. I cannot add more cells to...
13
by: Lyners | last post by:
I have a web page writen in ASP.NET that contains some javascript so that when a user presses a button, or edits a certain field in a datagrid, another cell in the datagrid is filled with a value....
4
by: Suzanne | last post by:
Hi all, I'm having problems with datagrids and the currentcellchanged event. My problem is this: I have a datagrid on a form, if the user changes the text in a cell on the datagrid then tries to...
4
by: tg | last post by:
Visual Studio 2003 My problem is that I am dynamically creating a datagrid on pageload. The datagrid is completely dynamic as it is based on the number of columns returned from a recordset. The...
13
by: pmcguire | last post by:
I have a DataGrid control for which I have also created several new extended DataGridColumnStyles. They behave pretty nicely, but I can't figure out how to implement Selected Item formatting for...
10
by: JohnR | last post by:
I have a datatable as the datasource to a datagrid. The datagrid has a datagridtablestyle defined. I use the datagridtablestyle to change the order of the columns (so they can be different than...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.