hi there,

i have a email textbox in the datagrid view, when i try to validate the datagrid view cell in the cellvalidating event, the current value is not take to the email varialbe, it is showed as null. y is that.

how can i solve this.

if(e.ColumnIndex == 2)
                int row = dgvSubContractor.CurrentCell.RowIndex;

String email = string.Format("" + dgvSubContractor[2, e.RowIndex].Value);

                if(email != null)
                if (pp.validateSubEmial(email))
                    MessageBox.Show("email address is unique, enter different email address");
                    if (!IsValidEmailAddress(email))
                        MessageBox.Show("Invalid email address");
                        MessageBox.Show("valid email");

y is the value entered not taken tothe variable


You are using string.Format incorrectly.

string.Format("Format text only and no value returns null")

You don't need the string.Format.

Also, y o y do U use y ! why?