datagrid.textbox -maxlength problem

  • Thread starter Thread starter Sze
  • Start date Start date
S

Sze

I had set the maxlenght to 20, it is valid for me to input 20 chars
However, it also allow me to input 20 chinese words .
In fact, I only want to store 10 chinese words & 20 english chars.

How can I do that ??
Thanks
 
Sze,

I think that in this newsgroup very few people are active who really deeply
know Mandarin (I thought to know one who know something about it) therefore
you can better ask it in a Chinese newsgroup because there are people
knowing Mandarin (and other Chinese languages).

Cor
 
Thanks, could you tell me what is that news group name ?
I had search chinese but find nothing.
 
Sze said:
I had set the maxlenght to 20, it is valid for me to input 20 chars
However, it also allow me to input 20 chinese words .
In fact, I only want to store 10 chinese words & 20 english chars.

How can I do that ??

Assuming a DataGrid behaves the same as a DataGridView, then you can attach
a handler to the editing control:

Private Sub myDGV_EditingControlShowing(ByVal sender As Object, ByVal e As
DataGridViewEditingControlShowingEventArgs) Handles
myDGV.EditingControlShowing
RemoveHandler e.Control.KeyDown, AddressOf cellEditingKeyHandler
AddHandler e.Control.KeyDown, AddressOf cellEditingKeyHandler
End Sub

Friend Sub cellEditingKeyHandler(ByVal sender As Object, ByVal e As
KeyEventArgs)
' Your code to detect the length of the cell content
End Sub

Where "Your code to detect the length of the cell content" determines how
many characters have been entered in the Sender. Presumably you know some
way of distinguishing between Chinese and English graphemes; perhaps if
AscW(someChar)>255 you can assume it's Chinese.

Andrew
 
Back
Top