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");
                else
                {
                    if (!IsValidEmailAddress(email))
                        MessageBox.Show("Invalid email address");
                    else
                        MessageBox.Show("valid email");
                }
                }

y is the value entered not taken tothe variable

thankxxxxxxx

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?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.