Avatar of Shezad Ahmed
Shezad Ahmed
Flag for United Kingdom of Great Britain and Northern Ireland asked on

Allow DataGridView Column to allow new line

Hi

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

Visual Basic.NET

Avatar of undefined
Last Comment
Nasir Razzaq

8/22/2022 - Mon
Shezad Ahmed

ASKER
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
ASKER CERTIFIED SOLUTION
Nasir Razzaq

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
I started with Experts Exchange in 2004 and it's been a mainstay of my professional computing life since. It helped me launch a career as a programmer / Oracle data analyst
William Peck