Click here to Skip to main content
15,889,440 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
why this error happening here?errors in columnIndex
Error -
System.Windows.Forms.DataGridViewEditingControlShowingEventArgs does not contain a definition for ColumnIndex and no extension method ColumnIndex accepting a first argument of type System.Windows.Forms.DataGridViewEditingControlShowingEventArgs could be found (are you missing a using directive or an assembly reference?)




C#
private void dtvregister_EditingControlShowing(object sender, DataGridViewEditingControlShowingEventArgs e)
       {

           if (e.ColumnIndex == 2)
           {
               TextBox tb = e.Control as TextBox;
               if (tb != null)
               {
                   tb.PasswordChar = '*';
               }
           }


       }


What I have tried:

i have created password textbox and used text filed as 'use system password'.. i need to hide password character in datagridview,,or i need to encrypt in datagridview,, is it possible? plz give me solution.. thank you
Posted
Updated 19-May-16 0:34am
Comments
Dave Kreskowiak 19-May-16 8:32am    
My first question was WHY?

Why are you even showing passwords in a DGV? This leads me to believe that you're storing passwords in clear text which is a HUGE security risk!
Rifath apps 19-May-16 12:32pm    
ya correct.. currently m doing, i have create one list and stored into bin file.. so if i register one user with password itz successfully stored all data and showing in DGV. but the problem is the "the dVG shows password also", i need to stored all data and the same time i need to hide password from datagridview also.. is it possible?
Dave Kreskowiak 19-May-16 13:06pm    
Yeah, don't show the password at all! Setting the PasswordChar property on a TextBox does NOT encrypt the password in memory. It can STILL ne retrieved fairly easily if you know what you're doing. So, the secure way of doing it is to NOT show the password at all.

Now, if you're storing password in clear text in a file, you should be smacked in the face. This is a MASSIVE security risk. There are plenty of articles on the web that show how to properly store password as cryptographic hashes, like Password Storage: How to do it.[^] and Salted Password Hashing - Doing it Right[^].

1 solution

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900