Like I've said in an answer to a previous question of yours: implement MVVM. Do not work in the code-behind, instead bind from the XAML in your View bind from the XAML in your View to its ViewModel.
But more importantly: first you need to stop using DataTable
s and start using well-defined objects. Your code already shows that currently you need to add comments to remember that for instance the sixth item of an ItemArray
that's attached to your row contains the Company Telephone. Now what if you simply had a List<Company>
where each Company
had a property called Telephone
-- wouldn't that be far easier and less error-prone?
Note that your code still contains the same bad practices we warned about in your two previous questions, e.g. OleDbDataAdapter
is IDisposable
so it needs to be inside a using
. You need to apply our remarks not just to the small bit of code you offer for review, but you need to apply those lessons to all of your code.
Like I've said in an answer to a previous question of yours: implement MVVM. Do not work in the code-behind, instead bind from the XAML in your View to its ViewModel.
But more importantly: first you need to stop using DataTable
s and start using well-defined objects. Your code already shows that currently you need to add comments to remember that for instance the sixth item of an ItemArray
that's attached to your row contains the Company Telephone. Now what if you simply had a List<Company>
where each Company
had a property called Telephone
-- wouldn't that be far easier and less error-prone?
Note that your code still contains the same bad practices we warned about in your two previous questions, e.g. OleDbDataAdapter
is IDisposable
so it needs to be inside a using
. You need to apply our remarks not just to the small bit of code you offer for review, but you need to apply those lessons to all of your code.
Like I've said in an answer to a previous question of yours: implement MVVM. Do not work in the code-behind, instead bind from the XAML in your View to its ViewModel.
But more importantly: first you need to stop using DataTable
s and start using well-defined objects. Your code already shows that currently you need to add comments to remember that for instance the sixth item of an ItemArray
that's attached to your row contains the Company Telephone. Now what if you simply had a List<Company>
where each Company
had a property called Telephone
-- wouldn't that be far easier and less error-prone?
Note that your code still contains the same bad practices we warned about in your two previous questions, e.g. OleDbDataAdapter
is IDisposable
so it needs to be inside a using
. You need to apply our remarks not just to the small bit of code you offer for review, but you need to apply those lessons to all of your code.
Like I've said in an answer to a previous question of yours: implement MVVM. Do not work in the code-behind, instead bind from the XAML in your View to its ViewModel.
But more importantly: first you need to stop using DataTable
s and start using well-defined objects start using well-defined objects. Your code already shows that currently you need to add comments to remember that for instance the sixth item of an ItemArray
that's attached to your row contains the Company Telephone. Now what if you simply had a List<Company>
where each Company
had a property called Telephone
-- wouldn't that be far easier and less error-prone?
Note that your code still contains the same bad practices we warned about in your two previous questions, e.g. OleDbDataAdapter
is IDisposable
so it needs to be inside a using
. You need to apply our remarks not just to the small bit of code you offer for review, but you need to apply those lessons to all of your code.
Like I've said in an answer to a previous question of yours: implement MVVM. Do not work in the code-behind, instead bind from the XAML in your View to its ViewModel.
But more importantly: first you need to stop using DataTable
s and start using well-defined objects. Your code already shows that currently you need to add comments to remember that for instance the sixth item of an ItemArray
that's attached to your row contains the Company Telephone. Now what if you simply had a List<Company>
where each Company
had a property called Telephone
-- wouldn't that be far easier and less error-prone?
Note that your code still contains the same bad practices we warned about in your two previous questions, e.g. OleDbDataAdapter
is IDisposable
so it needs to be inside a using
. You need to apply our remarks not just to the small bit of code you offer for review, but you need to apply those lessons to all of your code.
Like I've said in an answer to a previous question of yours: implement MVVM. Do not work in the code-behind, instead bind from the XAML in your View to its ViewModel.
But more importantly: first you need to stop using DataTable
s and start using well-defined objects. Your code already shows that currently you need to add comments to remember that for instance the sixth item of an ItemArray
that's attached to your row contains the Company Telephone. Now what if you simply had a List<Company>
where each Company
had a property called Telephone
-- wouldn't that be far easier and less error-prone?
Note that your code still contains the same bad practices we warned about in your two previous questions, e.g. OleDbDataAdapter
is IDisposable
so it needs to be inside a using
. You need to apply our remarks not just to the small bit of code you offer for review, but you need to apply those lessons to all of your code.
Like I've said in an answer to a previous question of yours: implement MVVM. Do not work in the code-behind, instead bind from the XAML in your View to its ViewModel.
But more importantly: first you need to stop using DataTable
s and start using well-defined objects. Your code already shows that currently you need to add comments to remember that for instance the sixth item of an ItemArray
that's attached to your row contains the Company Telephone. Now what if you simply had a List<Company>
where each Company
had a property called Telephone
-- wouldn't that be far easier and less error-prone?
Note that your code still contains the same bad practices we warned about in your two previous questions, e.g. OleDbDataAdapter
is IDisposable
so it needs to be inside a using
. You need to apply our remarks not just to the small bit of code you offer for review, but you need to apply those lessons to all of your code.