Hi,
I'm new to visual basic. I have a problem. i connected the database to the form and i added the code below to prompt if there is any blank textbox. When nothing is entered into the textbox and when the first box is left blank, there should be a prompt that says please enter rented videos. However that does not appear and instead there is an error. "Me.Rented_Vide osBindingSource .EndEdit()" is highlighted and a message box appears saying NoNullAllowedEx ception. Please help me. Thanks alot in advance! Smile Smile
This is the program.
I'm new to visual basic. I have a problem. i connected the database to the form and i added the code below to prompt if there is any blank textbox. When nothing is entered into the textbox and when the first box is left blank, there should be a prompt that says please enter rented videos. However that does not appear and instead there is an error. "Me.Rented_Vide osBindingSource .EndEdit()" is highlighted and a message box appears saying NoNullAllowedEx ception. Please help me. Thanks alot in advance! Smile Smile
This is the program.
Code:
Public Class RentedVideos
Private Sub Rented_VideosBindingNavigatorSaveItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Rented_VideosBindingNavigatorSaveItem.Click
Me.Validate()
Me.Rented_VideosBindingSource.EndEdit()
Me.TableAdapterManager.UpdateAll(Me.Digital_Video_DatabaseDataSet1)
If Rented_VideosTextBox.Text = "" Then
MessageBox.Show("Please enter rented videos.")
ElseIf (Videos_IDTextBox.Text = "") Then
MessageBox.Show("Please enter videos ID.")
ElseIf (PriceTextBox.Text = "") Then
MessageBox.Show("Please enter Price.")
ElseIf (Customers_NameTextBox.Text = "") Then
MessageBox.Show("Please enter customers name.")
ElseIf (Customers_ContactTextBox.Text = "") Then
MessageBox.Show("Please enter Customers Contact.")
Else
Dim RentedVideos As New RentedVideos
Rented_VideosTextBox.Text = ""
Videos_IDTextBox.Text = ""
Customers_NameTextBox.Text = ""
MessageBox.Show("Customer Database successfully added.")
End If
End Sub
Private Sub RentedVideos_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'TODO: This line of code loads data into the 'Digital_Video_DatabaseDataSet.Videos_Titles' table. You can move, or remove it, as needed.
Me.Videos_TitlesTableAdapter.Fill(Me.Digital_Video_DatabaseDataSet.Videos_Titles)
'TODO: This line of code loads data into the 'Digital_Video_DatabaseDataSet1.Rented_Videos' table. You can move, or remove it, as needed.
Me.Rented_VideosTableAdapter.Fill(Me.Digital_Video_DatabaseDataSet1.Rented_Videos)
End Sub
Comment