You are on page 1of 54

Electro-Team

Interesting Education Visual Basic 2010 DataBase Part 2

electroteam__@hotmail.com

Open new project

Rename it

Open solution explorer and right click on customers \Add\New Item

Select Service-base Database

Click Next

Click Next

Double click on Database1

Database explorer will be open

Right click on table\Add new table

Add table fields

Set Identity property of Id to yes and remove allow null checkbox

Click yes

Rename your table

From Data menu bar \Add New Source

Click next

Click Next

Click Next

Click Finish

From Data menu bar\Show Data Sources

Right Click on customers and select data

Drag and Drop customers on your Form

Right Click on Customers and select DataGrid View

Drag and Drop Customers on your Form

Run Time

Click AddNew And start type new data in the textboxes

Add Groupbox And five Buttons

Select the Groupbox and from Format menu bar select Center in form

Change Text Property of Buttons to AddNew, Save, Delete, Update and Exit

Private Sub Button1_Click


Me.CustomersBindingSource.AddNew()

End Sub

Private Sub Button2_Click


Me.Validate() Me.CustomersBindingSource.EndEdit() Me.TableAdapterManager.UpdateAll(Me.Database1DataSet1)

End Sub Private Sub Button3_Click


Me.CustomersBindingSource.RemoveCurrent()

End Sub

Private Sub Button4_Click


Me.Validate() Me.CustomersBindingSource.EndEdit() Me.TableAdapterManager.UpdateAll(Me.Database1DataSet1)

End Sub

Private Sub Button5_Click


End

End Sub

Run Time

Private Sub Button6_Click


Me.CustomersBindingSource.MoveLast()

End Sub Private Sub Button7_Click End Sub Private Sub Button8_Click End Sub Private Sub Button9_Click End Sub
Me.CustomersBindingSource.MoveFirst() Me.CustomersBindingSource.MovePrevious() Me.CustomersBindingSource.MoveNext()

Add Search engine to your project

If you want to search for Names you must name your query to name

Select Name Field

In the filter Column Type LIKE @name

Click Ok

Change the text property of name button search bar to Search

Double Click on Search button and then Add & %

Run Time

Run Time

Make Interactive Search Textbox By placing Search code in the Text_change sub

Double click on search button and select all it`s code \cut this selection

Double click on textbox in the search bar

Select TextChange Event

Paste Searching Code

End Of Part 2

Produced by

Electro-Team

You might also like