Solved

A very simple data binding question

Posted on 2007-04-04
7
215 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
Comment Utility
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
Comment Utility
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
Comment Utility
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
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 
LVL 19

Expert Comment

by:Rimvis
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
0

Featured Post

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

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 …
Wouldn’t it be nice if you could test whether an element is contained in an array by using a Contains method just like the one available on List objects? Wouldn’t it be good if you could write code like this? (CODE) In .NET 3.5, this is possible…
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

771 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

16 Experts available now in Live!

Get 1:1 Help Now