encryption - Encrypting datagridview values C# -


i'm working on winforms application let user fill in account , password information in datagridview, datasource datatable connected mysql server using .net mysql connector.

when user saves datatable data needs encrypted mysql database, incase hacks mysql server data useless.

for encrypting , decrypting use class called simpleaes (simple insecure two-way "obfuscation" c#)

this works great textboxes , such, how can loop thru datagridview encrypt values given user?

i tried following.

    private void encryptaccounts()         {             simpleaes simpleaes1 = new simpleaes();              string password; password= datagridviewaccounts[4,0].value.tostring();              datagridviewaccounts[4,0].value = simpleaes1.encrypttostring(password);         } 

this encrypt password first row, how can create loop every row

how can create loop every row

private void encryptaccounts() {     simpleaes simpleaes1 = new simpleaes();      // iterate on dgv rows     (int r = 0; r < datagridviewaccounts.rows.count; r++)     {         if (datagridviewaccounts[4, r].value != null)         {           string password = datagridviewaccounts[4, r].value.tostring();           datagridviewaccounts[4, r].value = simpleaes1.encrypttostring(password);         }     }      // or      foreach (datagridviewrow row in datagridviewaccounts.rows)     {         if (row.cells[4].value != null)         {           string password = row.cells[4].value.tostring();           row.cells[4].value = simpleaes1.encrypttostring(password);         }     } } 

Comments

Popular posts from this blog

php - failed to open stream: HTTP request failed! HTTP/1.0 400 Bad Request -

java - How to filter a backspace keyboard input -

java - Show Soft Keyboard when EditText Appears -