Solved

A very simple data binding question

Posted on 2007-04-04
7
222 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

 
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

Salesforce Made Easy to Use

On-screen guidance at the moment of need enables you & your employees to focus on the core, you can now boost your adoption rates swiftly and simply with one easy tool.

Question has a verified solution.

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

It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …

617 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