Allow DataGridView Column to allow new line


I need to be able to hit the Enter key in cell which creates a new line.
At the moment it goes to the next cell.
Shift and Enter does work.

Below is my code.

Open in new window

Shezad AhmedAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Shezad AhmedAuthor Commented:
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        DataGridView1.DataSource = Linq_Datatable

        DataGridView1.AllowUserToAddRows = False

        DataGridView1.AllowUserToDeleteRows = False

        DataGridView1.AutoSizeRowsMode = DataGridViewAutoSizeRowsMode.AllCells
        Me.DataGridView1.DefaultCellStyle.WrapMode = DataGridViewTriState.True

        Me.DataGridView1.Rows(0).Height = Me.DataGridView1.RowTemplate.Height

        Dim column As DataGridViewColumn = DataGridView1.Columns(0)
        column.Width = 70
        column.ReadOnly = True
        column.Visible = False

        Dim column2 As DataGridViewColumn = DataGridView1.Columns(1)
        column2.Width = 170
        column2.ReadOnly = True

        Dim column3 As DataGridViewColumn = DataGridView1.Columns(2)
        column3.Width = 620

    End Sub
New row is created as the last row. Do you want to create it below the current row? Also, you have set the AllowUserToAddRows to false.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic.NET

From novice to tech pro — start learning today.