Plz how to handle exception in datagrid

yub140000

Member
Joined
Feb 17, 2005
Messages
7
Programming Experience
Beginner
Hello every one
I have a question and i would like to share it with you all and that is if I have a datagrid which is bound to datatable Tblitems .The columns of Tblitems are
ItmNo(Not Null) and ItmName
if the user did not insert a value in ItmNo column in the datagrid and moved to 2nd row then
a message will be displayed automatically stating that ItmNo column can not be null so how to have control over this message(I would like to display my own message like plz enter ItmNo this is for exambole).I mean if I want to display my own message instead of this message then how is the way.plz any help
 
VB.NET:
Private Sub DataGrid1_CurrentCellChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles DataGrid1.CurrentCellChanged
		If IsDBNull(DataGrid1.Item(DataGrid1.CurrentCell.RowNumber, 0)) Then
			MessageBox.Show("Please input the item number")
			Exit Sub
		End If
	End Sub
 
Back
Top