TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
sudhir kumar
NA
19
63.6k
Calculation in Data Grid
Apr 17 2011 1:11 AM
// Please solve this problem
Object cannot be cast from DBNull to other types.
private void dataGridView1_CellEndEdit(object sender, DataGridViewCellEventArgs e)
{
if (e.ColumnIndex == 0 || e.ColumnIndex == 1)
{
int cell1 = Convert.ToInt32(dataGridView1.CurrentRow.Cells[0].Value);
int cell2 = Convert.ToInt32(dataGridView1.CurrentRow.Cells[1].Value);
if (cell1.ToString() != "" && cell2.ToString() != "")
{
dataGridView1.CurrentRow.Cells[2].Value = cell1 + cell2;
}
}
}
// I am doing this. but it is showing below error...
Object cannot be cast from DBNull to other types.
so please try to solve.
Attachment:
data grid.zip
Reply
Answers (
6
)
how define (number range) enum in c#
Crystal Report