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
Emma Emma
NA
101
55.4k
C# int and ushort computation
Jun 26 2013 4:26 AM
Hi,
I have one problem now:
I need to get the last row first column cell value from datagridview. Then minus 100 to get the finally value. Then convert this value to ushort as a parameter to one function.
Here is my code:
int
line = dataGridView.Rows.Count-1;
int
min = 100;
int
minu=
Convert
.ToInt16(dataGridView.Rows[line].Cells[0].Value.ToString()) - min;
ushort
max = (
ushort
)minu;
but I get the error said that:
Object reference not set to an instance of an object. in this line :
int
minu=
Convert
.ToInt16(dataGridView.Rows[line].Cells[0].Value.ToString()) - min;
I do not understand what is wrong. I read a lot about int and ushort...but still do not understand..
anyone help me...
Reply
Answers (
2
)
Input string was not in correct format
how to read HttpFileCollection