Solved

A very simple data binding question

Posted on 2007-04-04
7
216 Views
Last Modified: 2016-08-29
Here is my current code: https://filedb.experts-exchange.com/incoming/ee-stuff/3084-MyTest.zip

The question is so simple: I want clicking the next/previous button on the binding navigator to change the values of the two textboxes on the right, to that of the selected row. But I can't remember how to do it.

Please advice

Huji
0
Comment
Question by:huji
  • 5
  • 2
7 Comments
 
LVL 19

Accepted Solution

by:
Rimvis earned 500 total points
ID: 18849679
Hello huji,

Textbox1->(DataBindings)->Text. Should be "Table1BindingSource - name", not "DbDataSet - Table1.name"
DO the same for NumericUpDown1


Regards,

Rimvis
0
 
LVL 14

Author Comment

by:huji
ID: 18852067
Thank you so much. I'm so glad I've got an answer after all. Would you follow me on my next relevant questions, if I post a link to them here, please?
0
 
LVL 14

Author Comment

by:huji
ID: 18852362
Actually, I have a little problem. Get this file: https://filedb.experts-exchange.com/incoming/ee-stuff/3090-MyTest.zip

When the Save button is pressed, I would like to save the change made to the Score value (the NumericUpDown) to be stored in the database. Also, I want the checkbox (in the datagridview) for the row of the data which is being shown to be changed to checked (so the Checked field in the database would be set to True)

Your recommendations are precious for me

Huji
0
3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

 
LVL 19

Expert Comment

by:Rimvis
ID: 18856448
1) Code under save button should be:
        Me.Validate()
        Me.Table1BindingSource.EndEdit()
        Me.Table1TableAdapter.Update(Me.DbDataSet.Table1)

2) Remove databinding from NumericUpDown1.Tag property. Not sure why, but this prevents data from being saved.

3) If you want to mark record as "Checked" upon saving:
Go to Data->Show data sources. Drag "checked" field to your form.
In Form_Load:
CheckedCheckBox.Visible = False

In  Button1_Click:
        CheckedCheckBox.CheckState = CheckState.Checked
        Me.Validate()
        Me.Table1BindingSource.EndEdit()
        Me.Table1TableAdapter.Update(Me.DbDataSet.Table1)
0
 
LVL 14

Author Comment

by:huji
ID: 18856631
Everything works fine based on your last comment, except, the changes are not stored in the database. It seems the datatable is updated in the memory, but not in the database. Any idea?

Get this file: https://filedb.experts-exchange.com/incoming/ee-stuff/3097-MyTest.zip

Compile it. Press save for one of the items. (Checkbox is checked) close the window and open it again. The checkbox is clear again!
0
 
LVL 14

Author Comment

by:huji
ID: 18856641
Oops got it! I was recompiling it to reopen the window, thus the database was overwritten with the original version.

Thanks a lot
Huji
0
 
LVL 14

Author Comment

by:huji
ID: 18856732
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Welcome my friends to the second instalment and follow-up to our Minify and Concatenate Your Scripts and Stylesheets (http://www.experts-exchange.com/Programming/Languages/.NET/ASP.NET/A_4334-Minify-and-Concatenate-Your-Scripts-and-Stylesheets.html)…
Today I had a very interesting conundrum that had to get solved quickly. Needless to say, it wasn't resolved quickly because when we needed it we were very rushed, but as soon as the conference call was over and I took a step back I saw the correct …
This tutorial gives a high-level tour of the interface of Marketo (a marketing automation tool to help businesses track and engage prospective customers and drive them to purchase). You will see the main areas including Marketing Activities, Design …
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).

863 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now