VB.NET - DataGridView Question - Formatting data as it's being typed

Asked By Al on 20-Aug-14 04:51 PM
I want to add "-" (dash) in a number as it's being typed in a cell in datagridview control.

For example, as a user is entering a SSN, I'd like to not make the user enter the "-" separator.

I have looked around and can't find something that will help me with this. Can I get some help, please?
Robbe Morris replied to Al on 20-Aug-14 04:55 PM
You'll need to do this in JavaScript.

http://stackoverflow.com/questions/7685175/autoformat-ssn-while-entering-the-number

In the onload or document load of the page, you'd need to iterate through all of the applicable textboxes on your grid and initialize the jquery .keyup event on each one.
Henry Taylor replied to Al on 14-Oct-14 10:56 AM
ALL HANDS - STOP USING GRIDVIEWS AS DATA ENTRY FORMS.

You are only putting your own b_lls in a vice.  GVs are great for displaying data a.k.a. providing the user a "peek" at what is "out there." Put another way use GVs as a stepping stone to the actual data that is then displayed in A FORM where it can be edited/viewed in it's entirety.

As for your problem use a masked edit textbox.

That's all I've got to say about that.