Solved

A very simple data binding question

Posted on 2007-04-04
7
218 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

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.

Question has a verified solution.

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

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 …
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
Windows 10 is mostly good. However the one thing that annoys me is how many clicks you have to do to dial a VPN connection. You have to go to settings from the start menu, (2 clicks), Network and Internet (1 click), Click VPN (another click) then fi…

786 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