Click here to Skip to main content
15,076,465 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hi to all

I have a datagridview, 2 textbox and 1 combobox

Is there any way to check BEFORE insert in datagridview if the 2 textbox and combobox in not null

Thanks and regards....
Updated 14-Nov-20 8:15am
Prerak Patel 26-Apr-11 7:25am
Just use If. Don't you like to try?!

whats hard in that..
Before you call your insert function check something like

If textBox1.Text IsNot Nothing OrElse textBox1.Text <> "" Then

//code to insert..
End If
Vagelisr 26-Apr-11 7:33am
I dont have any code for insert in my datagridview (i use data sources)
For this reason i'm asking how to catch the add new record in a datagridview.....
I think you could use the datagrid "RowValidting" event:

If textbox1.Text is nothing or textbox1.Text = ""
(*** Code for manage error ***)
e.Cancel = true
End if

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900