In the provided sample project named BugsTracker, how did the textboxes in the detailPageView bind to a selected row of that bugsGrid?
I mean, there will be corresponding detail message shown in the textboxes when I select one row of bugsGrid.
How was that done?I read the codes but I couldn't find out the entry.
thanks in advance.
5 Answers, 1 is accepted
Thank you for writing.
The editors are bound to the underlying DataSet via simple data binding:
see the BindControls() method.
I hope that you find this information useful. Should you have any other questions, do not hesitate to contact us.
thank you for your answer.
I thought this titleTextBox.DataBindings.Add() method just bind titleTextBox's Text property to the dataTable's Title property.
There is a OnSelectedRowChange event handler,but it is just used for ReadOnlyControls() method.The ReadOnlyControls() method just change controls' ReadOnly Property rather than Text Property.
Then how could titleTextbox know when the selected row of dataGrid changes and after that it can changes its own Text property?
It knows as both the text box and the grid are bound to the same data source. So when the grid changes the selected row, the CurrencyManager Position will change, which will notify the text box and it will automatically change its text, thanks to the data binding I mentioned in my previous post.
Here is a nice article on the data bindings in WinForms, which you might find useful: http://www.akadia.com/services/dotnet_databinding.html.
I hope that the provided information addresses your question.
So that's how it is!
Sorry for bothering with this kind of question.
And I really appreciate your patience in reply.
Thank you very much and have a good day!