Hi,
I have a form1 that is databound to a customers table and when I run this form it shows the customerID in a textbox.Let's say I hit the next button on the binding navigator and the customer id is :"2".
On form1 I have a button that opens a second form called form2.
On form2 I have a text box called customerID (cos I am thinking of the original customerIDtextbox.text from form1).
So this is my question.....How do I get this textbox value in form2 to be the same as the one in form1?
I am using a dataset and I want to then insert the form2 textbox value into a database.
Am new to programming so please excuse the poor questioning style.
Thanks
Mahesh DeoPosted Nov 24, 2008, 7:38 AM
Manuel BPosted Nov 24, 2008, 2:56 PM
Thank you very, very much Mahesh Deo.
I used your answer
Best regards
Manuel BPosted Nov 24, 2008, 5:16 AM
Hi and thanks for the reply.
I have read your article but this is not really helping me because it is not what I am trying to achieve or maybe it is too complicated for me to understand at this point.
What I am using is a db with 2 tables (customers and orders)..they are related and so if I use the datagridview for orders it relates to customers. What I am trying to achieve is to be able to insert new orders via a separate form and not by using the datagrid add/edit functionality....I want to able to add/edit with a clean form and that is where I run into the following problem of which I give you the code of my save event.
con.Open();
visitsBindingSource.EndEdit();
this.ordersTableAdapter.Insert(lblDateTime.Text, txtNotes.Text, ................ , cboProcedure.Text);
con.Close();
".........." represents my problem ie: the customeridtextbox of the customers details form. If I put txtcustomerid.text into this insert method it returns "" into my table.
I am using this because if I can get the current customerID into the orders table so that the added order will relate to that specific customer.
This only occurs for a databound textbox; if I put in another textbox.text whose text = "Hello" then it works ok and I get "Hello" into my table.
I am reading up about ADO for the moment but any shortcut to solve this problem would be greatly appreciated.
Thanks
M
Bechir BejaouiPosted Nov 22, 2008, 5:22 PM