tag:blogger.com,1999:blog-33753991.post3694910905092164344..comments2023-09-01T06:00:23.693-07:00Comments on Geek Goddess: Keeping DataGrids And Other UI Controls In SyncBonniehttp://www.blogger.com/profile/11241425687786973525noreply@blogger.comBlogger2125tag:blogger.com,1999:blog-33753991.post-46999440202635357242013-12-05T06:57:52.557-08:002013-12-05T06:57:52.557-08:00Bayu -- that's pretty much the same thing that...Bayu -- that's pretty much the same thing that I showed in my second example (and that's the way I prefer to do it also; not using "DataMember" as shown in my first example).<br /><br />The only difference between what you posted and what I posted is that you set up a separate variable, dt, to hold the instance of MyDataSet.Tables["MyTable"]. That is only for easier readability of the DataBinding statements and is perfectly OK to do (I do that myself frequently ... readability is important!). However, you don't need to create the DataTable first. Do it like this:<br /><br />DataTable dt = MyDataSet.Tables["MyTable"];<br />Bonniehttps://www.blogger.com/profile/11241425687786973525noreply@blogger.comtag:blogger.com,1999:blog-33753991.post-74463029911047193682013-12-05T00:52:28.598-08:002013-12-05T00:52:28.598-08:00how about this ?
// starts here
DataTable dt = ne...how about this ?<br /><br />// starts here<br />DataTable dt = new DataTable();<br />dt = MyDataSet.Tables["MyTable"];<br />this.oGrid.DataSource = dt;<br />// then use this syntax for TextBoxes<br />this.txtLastName.DataBindings.Add("Text",dt,"LastName");<br />// end here<br /><br />I do not like "DataMember" because in my point of view a dataset is easier to understand as "a set of related table(s)".<br />is there any performance cost ? thank you ...Anonymoushttps://www.blogger.com/profile/05282865659055596961noreply@blogger.com