0

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

2
Contributors
1
Reply
2
Views
7 Years
Discussion Span
Last Post by nick.crane
0

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?

Edited by nick.crane: n/a

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.