SIMIN Posted September 17, 2008 Posted September 17, 2008 DataGridViewX.CurrentRow.Cells.Item(0).Value.ToString If the item is blank and no data is entered it will throw a null exception, so the question is that how can I check if the item is null or not? Even using this: If DataGridViewX.CurrentRow.Cells.Item(0).Value.ToString IsNot Nothing Then ... Will thro the exception! Please help me. Quote
Administrators PlausiblyDamp Posted September 20, 2008 Administrators Posted September 20, 2008 You could just check to see if the .Value is nothing, trying to convert the value to a string will fail if the value is null. Quote Posting Guidelines FAQ Post Formatting Intellectuals solve problems; geniuses prevent them. -- Albert Einstein
davearia Posted September 25, 2008 Posted September 25, 2008 I normally use: If DataGridViewX.CurrentRow.Cells.Item(0).Value IsNot System.DBNull.Value Then '??? End If Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.