How to Use BindingNavigator control in Windows Forms Application

By
BindingNavigator control is  basically used for Binding the Database values to the control (Text Box,label etc.).In this tutorial ,i am going to bind  the Text Box control Data at Run time using BindingNavigator control.Here I am using Microsoft Sql server Database .You can Use any Database for this binding.
There are some steps which are given below:-
Step : 1 First open your visual studio-->File-->New-->Project-->Windows Forms Application-->OK-->Now Drag and Drop Label,Text Box and Binding Navigator control on the  Form  from tool Box as shown below:
see it:




Step : 2 Now open SQL Server Management Studio-->Create  a table(student) and insert some values also.
see it:

Step : 3 Now Go Text Box Properties --> Expand DataBindings-->Click Text  as shown below:

Step : 4 Now click Add Project Data Source which is shown above image.



Step : 5 Now select Database and  click Next Button.



Step : 6 Now select Dataset and click Next button.



Step : 7 Now click New Connection Button -->Select Server Name-->Select or enter database name -->Click Text Connection Button-->OK.



Step : 8 Now click Next Button.


Step : 9 Now again click Next Button --> check your Table  Name (student) -->click Finish 



Step : 10 Now Go back your Form --> go properties of Sid Text Box -->Expand DataBindings --> Text --> double click on Sid column-->same way follow for Name and Age also.
see it:

Step : 11 Now  go properties of the BindingNavigator control--> Select BindingSource.
see it

Step : 12 Now Run the Application(press F5).
Output:



For more information:
  1. Insert Data in SQL Server.
  2. Data Integrity
  3. XML File
  4. Properties in C#
Download whole Attached Application
           Download

1 comment:

Powered by Blogger.