473,507 Members | 2,395 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

DatagridView User Control Can not input certain characters.

I add a user control (a simple textbox control) to customize
datagridview column to test how to add user control to datagridview. I
found a weired behavior. I can not input "q", "!", "#".
But I can input other keys (e.g. "Q", "@", "W")

Anybody found this question? It looks like the textbox eat the input
'q' and does not show up in the text.

Public Class DataGridViewEditorButtonEditingControl
Inherits TextBox
Implements IDataGridViewEditingControl
#Region "Vars"

'The grid that owns this editing control
Private dataGridViewControl As DataGridView
'Stores whether the editing control's value has changed or not
Private valueIsChanged As Boolean = False
'Stores the row index in which the editing control resides
Private rowIndexNum As Integer
#End Region

#Region "Implements IDataGridViewEditingControl"
Public Sub ApplyCellStyleToEditingControl(ByVal
dataGridViewCellStyle As System.Windows.Forms.DataGridViewCellStyle)
Implements
System.Windows.Forms.IDataGridViewEditingControl.A pplyCellStyleToEditingControl

End Sub

Public Property EditingControlDataGridView() As
System.Windows.Forms.DataGridView Implements
System.Windows.Forms.IDataGridViewEditingControl.E ditingControlDataGridView
Get
Return dataGridViewControl
End Get
Set(ByVal value As System.Windows.Forms.DataGridView)
dataGridViewControl = value
End Set
End Property

Public Property EditingControlFormattedValue() As Object
Implements
System.Windows.Forms.IDataGridViewEditingControl.E ditingControlFormattedValue
Get
Return Me.Text
End Get
Set(ByVal value As Object)
If TypeOf value Is [String] Then
Me.Text = value
Else
Me.Text = ""
End If
End Set
End Property

Public Property EditingControlRowIndex() As Integer Implements
System.Windows.Forms.IDataGridViewEditingControl.E ditingControlRowIndex
Get
Return rowIndexNum
End Get
Set(ByVal value As Integer)
rowIndexNum = value
End Set
End Property

Public Property EditingControlValueChanged() As Boolean
Implements
System.Windows.Forms.IDataGridViewEditingControl.E ditingControlValueChanged
Get
Return valueIsChanged
End Get
Set(ByVal value As Boolean)
valueIsChanged = value
End Set
End Property

Public Function EditingControlWantsInputKey(ByVal keyData As
System.Windows.Forms.Keys, ByVal dataGridViewWantsInputKey As Boolean)
As Boolean Implements
System.Windows.Forms.IDataGridViewEditingControl.E ditingControlWantsInputKey
Select Case (keyData)
Case Keys.Enter
Return True
Case Else
Return False
End Select
End Function

Public ReadOnly Property EditingPanelCursor() As
System.Windows.Forms.Cursor Implements
System.Windows.Forms.IDataGridViewEditingControl.E ditingPanelCursor
Get
Return MyBase.Cursor
End Get
End Property

Public Function GetEditingControlFormattedValue(ByVal context
As System.Windows.Forms.DataGridViewDataErrorContexts ) As Object
Implements
System.Windows.Forms.IDataGridViewEditingControl.G etEditingControlFormattedValue
Return Me.Text
End Function

Public Sub PrepareEditingControlForEdit(ByVal selectAll As
Boolean) Implements
System.Windows.Forms.IDataGridViewEditingControl.P repareEditingControlForEdit
'Do not select all the text, but position the caret at the
start of the text
Me.SelectionStart = 0
Me.SelectionLength = 0
End Sub

Public ReadOnly Property
RepositionEditingControlOnValueChange() As Boolean Implements
System.Windows.Forms.IDataGridViewEditingControl.R epositionEditingControlOnValueChange
Get
Return False
End Get
End Property
#End Region

End Class

Jun 7 '06 #1
0 2497

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
5067
by: der | last post by:
Hello all, I want to use fgets() to read lines. Now, if the user has entered more characters than it was supposed to, the next call to fgets() would read these characters, which I don't want to...
11
11098
by: Ron L | last post by:
I have a barcode scanner which uses a "keyboard wedge" program so that the data it scans comes through as if it was typed on a keyboard. I am trying to have the data in the barcode be displayed in...
9
5825
by: chuck | last post by:
I need some help with validating user input. I am writing a C computer program for an intro to C course. Here is the situation. I am creating an application that will do currency conversions. ...
3
11930
by: joey.powell | last post by:
I have a datagridview where I set its "DataSource" property to a DataSet and its "DataMember" property to a table within the DataSet. I need for the DataGridView to "sort" through the contents of...
7
16335
by: Ryan | last post by:
I have a DataGridView which displays numeric (Int32) data from an underlying database. I want the numbers to be displayed in numeric format "#,###" (with commas). I want to also limit the user so...
3
1822
by: Johnny E. Jensen | last post by:
Hello Dot sure if this it the right group but here goes. I'am using the DataGridView multiple times in my application, and then i'll read a book on inherience, and that opend a new world for...
1
7764
by: Karl | last post by:
Hi all... This is a good one. You'll like this... I am working on a course management tool that allows certain Courses to be cross referenced with Job Roles and, when they are, whether the...
1
2466
by: Jeff | last post by:
Hey ..NET 2.0 I've created a User Control which contain a DataGridView. This User Control is displayed on a TabPage. This TabPage is added to the TabControl during runtime. The problem is...
0
5635
by: priyamtheone | last post by:
I'm trying to make a datagridview column to act like a datetimepicker column (C#.Net 2005). These are the behaviours that the dgv should have: 1) Initially all the cells of the dtp column should be...
0
7223
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7111
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
1
7031
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7485
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
1
5042
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4702
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3191
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3179
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
760
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.