Quantcast
Channel: Windows Forms Data Controls and Databinding forum
Viewing all articles
Browse latest Browse all 2535

How to handle Upper Case in specified column in datagridview

$
0
0

Hi there,

I'm trying to handle Upper Case in one single column in my datagridview, but is not working, all the columns are converted to Upper case

Here is my code:

 private void myDataGrid_EditingControlShowing(object sender, DataGridViewEditingControlShowingEventArgs e)
        {
            if (myDataGrid.CurrentCell.OwningColumn.Index == 0)
            {
                ((TextBox)e.Control).KeyPress += new KeyPressEventHandler(toUpperCase);
            }
        }

//And the method toUpperCase
 protected void toUpperCase(object sender, KeyPressEventArgs e)
        {
            e.KeyChar = Char.ToUpper(e.KeyChar);
        }

Any help would be apreciated

Thanks

Bere


Viewing all articles
Browse latest Browse all 2535

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>