views:

1666

answers:

2

Hi,

I've DGV with my custom List<myClass> as DataSource.

I want the "DataGridViewTextBoxColumn" that in this DataGridView to support Multiline property.

Could you help me with this please ?.

Thank you very much.

+3  A: 

You should be able to achieve this by setting the WrapMode of the DefaultCellStyle of your DataGridViewTextBoxColumn to true.

Tim S. Van Haren
Thank u That's worked :)
Wahid Bitar
+1  A: 

apart from setting wrap mode of the defaultcellstyle, you need to catch GridView's EditingControlShowing() Event, cast EventArgs object's Contorl property to one you want (textbox,checkbox or button) and using that Type of variable just change its mode as its done below...

`    private void MyGridView_EditingControlShowing(object sender, DataGridViewEditingControlShowingEventArgs e)
    {
        TextBox TB = (TextBox)e.Control;
        TB.Multiline = true;            
    }

`

Hope this works

usman Majeed