DataGridViewTextCell accept Enter

0
0

Hello,

I need to setup a multiline textbox inside of a DGV cell.

I managed to set the properties of the input to accept the Enter key as below:

Private Sub GridView1_ShowingEditor(sender As Object, e As DataGridViewEditingControlShowingEventArgs) Handles Me.EditingControlShowing

Dim theMLTextBox = TryCast(e.Control, TextBox)
If theMLTextBox IsNot Nothing Then
theMLTextBox.Multiline = True
theMLTextBox.AcceptsReturn = True

End Sub

It works, except one problem: the cell lost focus each time user press Enter.

How to prevent this ?

Thank you.

  • You must to post comments
0
0

Hi Tung,

enhancement #2518 is included in our latest Wisej release (2.2.29).

Best regards
Frank

  • You must to post comments
0
0

Hi Tung,

We’ve completed the enhancement (#2518) and it will be available in the next build that we release!

You’ll find a few new properties as part of the DataGridViewTextBoxColumn

  • AcceptsTab (bool) Specifies whether the DataGridViewTextBoxCell accepts the tab key.
  • AcceptsReturn (bool: Specifies whether the DataGridViewTextBoxCell accepts the enter key.
  • Multiline (bool): Specifies whether the DataGridViewTextBoxCell uses a multiline TextBox.

These three properties correspond to the same properties that are on the TextBox control.

When AcceptsReturn is set to true, it overrides the DataGridView cell losing focus when pressed.

If you have any questions or issues with these, please let me know!

Best regards,

Levie

  • You must to post comments
0
0

Hi Tung,

Sorry for the delayed response.

We’re looking into enhancing the DataGridView to support this through the DataGridViewTextBoxColumn. See issue #2518.

I’ll keep you updated as we make progress on it!

Best regards,

Levie

  • You must to post comments
Showing 3 results
Your Answer

Please first to submit.