Question Getttig problem with binding

Felipejjr

New member
Joined
Sep 28, 2020
Messages
2
Programming Experience
5-10
My problem is that I wrote a method in C #, to which I pass a form and a datarow, this is in charge of creating everything related to data management, everything goes well but I have noticed that when in the form there is data that They are filled through a search, that is, they are not entered via keyboard, all other data is removed from the datamember and if I modify its any other data, the one that was searched is emptied. I can't find a reason for it. Could someone help me?
 
Without seeing the code that you are talking about it's kind of hard to even guess at what is happening.

What kind of binding are you using in your WinForms code? Are you using the built in .NET Framework WinForms binding, or did you roll your own binding mechanism?
 
Without seeing the code that you are talking about it's kind of hard to even guess at what is happening.

What kind of binding are you using in your WinForms code? Are you using the built in .NET Framework WinForms binding, or did you roll your own binding mechanism?i
thank skydiver.
i am using BindingSource built in .NET Framework.

the problem isnt the code, all work fine, except in the case that i look for external data and plece it in the BindingInfo.FeldName of the control directly or in text propertie of the textbox to left binding do his work.
this is the code example, when it is executed, all others BindingInfo.FeldName luss the data previously binded, if i modify data in any other textbox all became again and desapear the searched.
C#:
                if (txtNoProv.Text != ""
                    && (Lib.MyLib.MyLocate("Proveedor"
                            , new string[] { "Proveedor" }, new string[] { txtNoProv.Text }, false)
                    || Lib.MyLib.MyLocate("Proveedor"
                            , new string[] { "Nombre" }, new string[] { "%" + txtNoProv.Text + "%" }, true)))
                {

                    //Lib.wData.wSetValue(txtNoProv, Lib.MyLib.SelectedRow[0]["Proveedor"].ToString());
                    //Lib.wData.wSetValue(txtNombreProvedor, Lib.MyLib.SelectedRow[0]["Nombre"].ToString());
                    //Lib.wData.wSetValue(txtcontacto, Lib.MyLib.SelectedRow[0]["Contacto"].ToString());
                    //Lib.wData.wSetValue(txtRNC.Text, (string.IsNullOrWhiteSpace(txtRNC.Text))? Lib.MyLib.SelectedRow[0]["RNC"].ToString(): txtRNC.Text);
                    txtNoProv.Text = Lib.MyLib.SelectedRow[0]["Proveedor"].ToString();
                    txtNombreProvedor.Text = Lib.MyLib.SelectedRow[0]["Nombre"].ToString();
                    this.txtcontacto.Text = Lib.MyLib.SelectedRow[0]["Contacto"].ToString();
                    txtRNC.Text = (string.IsNullOrWhiteSpace(txtRNC.Text))? Lib.MyLib.SelectedRow[0]["RNC"].ToString(): txtRNC.Text;
                }
 

Attachments

  • bindiing_bug.pdf
    44.5 KB · Views: 14
Last edited by a moderator:
Back
Top Bottom