| |

VerySource

 Forgot password?
 Register
Search
View: 669|Reply: 4

DataGrid is bound to the dataset problem ... Comrades help

[Copy link]

2

Threads

3

Posts

4.00

Credits

Newbie

Rank: 1

Credits
4.00

 China

Post time: 2020-2-1 14:20:02
| Show all posts |Read mode
The DataGrid is bound to a data set, and the text box is also bound to the same data set, but when the DataGrid moves,

Why doesn't the data in the text box follow the data in the DataGrid?

Comrades, tell me how should I bind ...


private void BindText ()
{
//this.txtBH .DataBindings.Add ("Text", this.bsEmployee1, "employee.bh");
this.txtBH.DataBindings.Add (new Binding ("TEXT", bsEmployee1, "employee.bh"));


this.txtBM .DataBindings.Add ("Text", this.bsEmployee1, "employee.bm");
this.txtJIANZHAO.DataBindings.Add ("Text", this.bsEmployee1, "employee.jianzhao");
this.txtPHOTO.DataBindings.Add ("Text", this.bsEmployee1, "employee.photo");
this.txtXM.DataBindings.Add ("Text", this.bsEmployee1, "employee.xm");
this.txtZW.DataBindings.Add ("Text", this.bsEmployee1, "employee.zw");
this.dtpBDR.DataBindings.Add ("Text", this.bsEmployee1, "employee.bdr");

}
private void frm_Main_Load (object sender, System.EventArgs e)
{
this.EmpSqlcmd.Fill (this.bsEmployee1.employee);
          BindText ();
SetDataComponentState (true);


}

The above code, where else to add something ...
Reply

Use magic Report

0

Threads

64

Posts

45.00

Credits

Newbie

Rank: 1

Credits
45.00

 China

Post time: 2020-3-14 01:00:01
| Show all posts
Traditional Chinese is so tired, how did you move it, did you put it in DIV
Reply

Use magic Report

0

Threads

52

Posts

34.00

Credits

Newbie

Rank: 1

Credits
34.00

 China

Post time: 2020-3-14 08:15:02
| Show all posts
If you want to achieve what you said
Using the BindingManagerBase class
Reply

Use magic Report

2

Threads

3

Posts

4.00

Credits

Newbie

Rank: 1

Credits
4.00

 China

 Author| Post time: 2020-3-19 10:15:01
| Show all posts
Big brother above, can you give me an example?


Traditional Chinese is so tired, how did you move it, did you put it in the DIV?

Yes.

thank you all.
Reply

Use magic Report

0

Threads

110

Posts

63.00

Credits

Newbie

Rank: 1

Credits
63.00

 China

Post time: 2020-3-20 10:45:01
| Show all posts
Why bind a TextBox?

When the selected row of the DataGrid changes, does the record value of the current row of the DataGrid be directly taken into several TextBoxes?
Reply

Use magic Report

You have to log in before you can reply Login | Register

Points Rules

Contact us|Archive|Mobile|CopyRight © 2008-2023|verysource.com ( 京ICP备17048824号-1 )

Quick Reply To Top Return to the list