Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Data Grid View Character Casing Issue

Status
Not open for further replies.

Auguy

Programmer
May 1, 2004
1,206
US
Having trouble with a data grid view.
Three columns, first one I want to be uppercase, second one normal, and third numbers only.
Third column works fine.
If I click on the second column it appears in uppercase, but ONLY the first time I enter the column.
Seems strange, what am I missing?
Code:
  Private Sub dgvException_EditingControlShowing(ByVal sender As Object, ByVal e As DataGridViewEditingControlShowingEventArgs) Handles dgvException.EditingControlShowing
    If TypeOf e.Control Is TextBox Then
      Select Case dgvException.CurrentCell.ColumnIndex
        Case ExceptionIDColNbr
          DirectCast(e.Control, TextBox).CharacterCasing = CharacterCasing.Upper
        Case DescriptionColNbr
          DirectCast(e.Control, TextBox).CharacterCasing = CharacterCasing.Normal
        Case SortNbrColNbr
          AddHandler CType(e.Control, TextBox).KeyPress, AddressOf TextBox_keyPress2
      End Select
    End If
End Sub

Auguy
Sylvania/Toledo Ohio
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top