Click here to Skip to main content
15,921,660 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hai,

How to Bind the two textbox Values Dynamically in Datagridview using c#?
Posted

 
Share this answer
 
You can bind any control to the DataBase by creating DataSets or DataView.
First create New DataView.
C#
public void CreateDataView()
       {
       OleDbDataAdapter objda = new OleDbDataAdapter();
       objda.SelectCommand = new OleDbCommand();
       Conn.Open(); //Openning DataBase Connection
       objda.SelectCommand.CommandText = "Select * FROM TableName";
       objda.Fill(objdataset, "TableName");
       dv = new DataView(objdataset.Tables("TableName"));
       }

Call CreateDataView on Form_Load Event.
Then bind your TextBox with DataView
C#
this.TextBox1.DataBindings.Clear();
this.TextBox1.DataBindings.Add("Text", dv, "TableFieldName");


-MKB :)
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900