salut
j'ai un datagridview et des textBoxes et une bindingsource et un binding navigator
je veut que le binding navigator fonctionne(movenext...)
quand je positionne le curseur sur le datagrid les textboxes changes mais le bindingnavigateur non!!!
voici le code:
formload:
et la methode creaersource
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13 private void Form1_Load(object sender, EventArgs e) { creaersource(); dg.DataSource = bs.DataSource; this.t1.DataBindings.Add(new System.Windows.Forms.Binding("Text", bs.DataSource, "c001", true)); this.t2.DataBindings.Add(new System.Windows.Forms.Binding("Text", bs.DataSource, "c002", true)); this.t3.DataBindings.Add(new System.Windows.Forms.Binding("Text", bs.DataSource, "c003", true)); this.t4.DataBindings.Add(new System.Windows.Forms.Binding("Text", bs.DataSource, "c004", true)); this.t5.DataBindings.Add(new System.Windows.Forms.Binding("Text", bs.DataSource, "c005", true)); this.t6.DataBindings.Add(new System.Windows.Forms.Binding("Text", bs.DataSource, "c006", true)); bnd.BindingSource = bs; }
est ce qu'il faut ajouter du code dans les boutons de binding navigator???
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 public void creaersource() { con.ConnectionString=" workstation id=Standard;packet size=4096;user id=sa;" + "password=;data source=standard;" + "persist security info=False;" + "initial catalog=gB001;"; cmd.Connection = con; cmd.CommandType = CommandType.StoredProcedure; cmd.CommandText = "sp_select"; da.SelectCommand = cmd; da.Fill(ds,"ali"); bs.DataSource = ds.Tables[0]; bnd.BindingSource = bs; manager = this.BindingContext[bs.DataSource]; }
(j'ai créé tous sa avec le code)
merci d'avance
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6 DataSet ds = new DataSet(); BindingSource bs = new BindingSource(); SqlConnection con=new SqlConnection(); SqlCommand cmd = new SqlCommand(); SqlDataAdapter da = new SqlDataAdapter();
Partager