Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- '------------------------------------------------------------------------------------------
- ' Notice of My Copyright and Intellectual Property Rights
- '
- ' Any intellectual property contained within the program by Joseph L. Bolen remains the
- ' intellectual property of the Joseph L. Bolen. This means that no person may distribute,
- ' publish or provide such intellectual property to any other person or entity for any
- ' reason, commercial or otherwise, without the express written permission of Joseph L. Bolen.
- '
- ' Copyright © 2015. All rights reserved.
- ' All trademarks remain the property of their respective owners.
- '-------------------------------------------------------------------------------------------
- ' Program Name: LocalDB 1st App
- '
- ' Author: Joseph L. Bolen
- ' Date Created: Jul 2015
- '
- ' Description: A simple Parent/Child table maintenance form using an embeded LocalDB
- ' SQL database. The strongly typed DataSet has had the relation
- ' (FK_Orders_Customers) between the Parent table and the Child table
- ' modified to have the Update Rule: Cascade, the Delete Rule: Casecade and
- ' the Accept/Reject Rule: None.
- '
- ' Documentation: Code at: http://pastebin.com/KU0U1bXR
- ' Video Tutorial at: https://www.youtube.com/user/BolenPresents/
- '
- '-------------------------------------------------------------------------------------------
- Public Class MainForm
- Private Sub CustomersBindingNavigatorSaveItem_Click(sender As Object, e As EventArgs) _
- Handles CustomersBindingNavigatorSaveItem.Click
- Me.Validate()
- Me.CustomersBindingSource.EndEdit()
- Me.OrdersBindingSource.EndEdit()
- Me.TableAdapterManager.UpdateAll(Me.SampleDBDataSet)
- End Sub
- Private Sub MainForm_Load(sender As Object, e As EventArgs) _
- Handles MyBase.Load
- ' Make DataGridView Column Headings bold.
- Me.OrdersDataGridView.ColumnHeadersDefaultCellStyle.Font =
- New Font(Me.OrdersDataGridView.ColumnHeadersDefaultCellStyle.Font, FontStyle.Bold)
- ' Fill the Customer (Parent) table in the DataSet with all records from the database.
- Me.CustomersTableAdapter.Fill(Me.SampleDBDataSet.Customers)
- ' File the Orders (Child) table in the DataSet with all records
- ' From the database after the Parent table.
- Me.OrdersTableAdapter.Fill(Me.SampleDBDataSet.Orders)
- End Sub
- Private Sub OrdersBindingSource_AddingNew(sender As Object, e As System.ComponentModel.AddingNewEventArgs) _
- Handles OrdersBindingSource.AddingNew
- ' When adding a new row to the Child table,
- ' push From the form the Parent table's data.
- CustomersBindingSource.EndEdit()
- End Sub
- End Class
Advertisement
Add Comment
Please, Sign In to add comment