Skip to main content

Write a VB.NET program to accept the details of customer (CName,Contact_No,Email_id). Store it into the database with proper validation and display appropriate message by using Messagebox.(Use MS Access )

· One min read
Kaustubh Kulkarni

Write a VB.NET program to accept the details of customer (CName,Contact_No,Email_id). Store it into the database with proper validation and display appropriate message by using Messagebox.(Use MS Access )

file.vb
PublicClass Form1  
PrivateSub CustomerBindingNavigatorSaveItem_Click(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles CustomerBindingNavigatorSaveItem.Click
Me.Validate()
Me.CustomerBindingSource.EndEdit()
Me.TableAdapterManager.UpdateAll(Me.CustDataSet)
EndSub
PrivateSub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs)
HandlesMyBase.Load
'TODO: This line of code loads data into the 'CustDataSet.customer' table. You
can move, or remove it, as needed.
Me.CustomerTableAdapter.Fill(Me.CustDataSet.customer)
EndSub
PrivateSub btninsert_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btninsert.Click
IfMe.CustomerTableAdapter.InsertQuery(txtname.Text, txtcontact.Text,
txtemail.Text) Then
MsgBox("Data inserted")
Me.CustomerTableAdapter.Fill(Me.CustDataSet.customer)
Else
MsgBox("Data not inserted")
EndIf
EndSub
EndClass