Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

A very simple data binding question

Posted on 2007-04-04
7
Medium Priority
?
225 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 2000 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
Cloud Training Guides

FREE GUIDES: In-depth and hand-crafted Linux, AWS, OpenStack, DevOps, Azure, and Cloud training guides created by Linux Academy instructors and the community.

 
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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

In my previous article (http://www.experts-exchange.com/Programming/Languages/.NET/.NET_Framework_3.x/A_4362-Serialization-in-NET-1.html) we saw the basics of serialization and how types/objects can be serialized to Binary format. In this blog we wi…
It’s quite interesting for me as I worked with Excel using vb.net for some time. Here are some topics which I know want to share with others whom this might help. First of all if you are working with Excel then you need to Download the Following …
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…

705 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