Click to See Complete Forum and Search --> : Binding vs Not Binding.
Danial
Aug 9th, 2004, 06:47 AM
Before upgrading to C#, I programmed in VB6 for many years. While using VB6 i never used binding and always discouraged everyone from doing so. Most of the time i have used ListView to display data instaead of FlexGrid or DataGrid.
Since moving to .net i have noticed that (in Books and online Tutorial) there is a lot of people who are using Binding. I know DataGrid in .net is better then VB6 grids, but is it adviseable to use Binding. Even in .net I am avoiding Binding and using DataGrid and as opposed to ListView for display tabular data. I find it to be more flexible. Just want to hear what you guys use. What are the pros and cons of using Binding in .net.
I am looking for professional opinion.
Thank you for any of your thoughts and opinion.
Danial
mendhak
Aug 9th, 2004, 07:05 AM
I asked this exact same question when I started off with ADO.NET, and here's what I figure:
Data Binding isn't as bad as it was back in VB6, they have improved upon it.
Advantages of this: Easy to use (duh), and the code gets generated for you.
Disadvantage: Again, this promotes laziness. I actually cringe whenever I see someone with the drag-n-drop dataadapters and datasets in the IDE, and truthfully, it's a little confusing working with that.
I prefer doing it manually. The advantage of doing it manually is that you know what you're doing, and you are in control. Most of the 'better' coders I've seen at my workplace and in these forums, as I've seen, do it manually. The basics remain the same; the more flexible it is for you, the better it is. Having control is good.
Now, a bit more, just to confuse you a little bit:
You could actually bind the listview or datagrid to your own class. And, to satisfy you, you write the class yourself so that you know what you want and what you can control in there. You can be assured of efficiency (or inefficiency ;) ) there.
HTH
mendhak
Aug 9th, 2004, 07:07 AM
Originally posted by Danial
I am looking for professional opinion.
I'm so professional, I fart in loose change :)
Danial
Aug 9th, 2004, 07:19 AM
Originally posted by mendhak
I asked this exact same question when I started off with ADO.NET, and here's what I figure:
Data Binding isn't as bad as it was back in VB6, they have improved upon it.
Advantages of this: Easy to use (duh), and the code gets generated for you.
Disadvantage: Again, this promotes laziness. I actually cringe whenever I see someone with the drag-n-drop dataadapters and datasets in the IDE, and truthfully, it's a little confusing working with that.
I prefer doing it manually. The advantage of doing it manually is that you know what you're doing, and you are in control. Most of the 'better' coders I've seen at my workplace and in these forums, as I've seen, do it manually. The basics remain the same; the more flexible it is for you, the better it is. Having control is good.
Now, a bit more, just to confuse you a little bit:
You could actually bind the listview or datagrid to your own class. And, to satisfy you, you write the class yourself so that you know what you want and what you can control in there. You can be assured of efficiency (or inefficiency ;) ) there.
HTH
Like you I would never use drag and drop to Generate Dataset, i prefer doing it all manually. I am always against auto generating code as it makes maintainance harder.
When it comes to ComboBox i always use DataReader and write the item manually instead of DataSet + Binding.
Since DataGrid is designed to be used(mostly) with DataSet, its not easy to use DataReader & DataGrid, as a result i stick to ListView.
I am aware that you can Bind Array, Object/Class with DataGrid, but not aware that you could to the same with ListView. I would be interested to know how that is done.
Thanks for your reply.
Danial
Danial
Aug 9th, 2004, 07:20 AM
Originally posted by mendhak
I'm so professional, I fart in loose change :)
Any other confession ;)
Tewl
Aug 9th, 2004, 12:22 PM
Well I am not a professional by any means, but I have to agree it is horrible going behind people after they have used the drag-n-drop dataadapters an trying to edit their existing code. I started with csharp using the commandline compiler in the sdk. It took a lot longer than with the ide but it was very educational :)
hellswraith
Aug 11th, 2004, 12:51 AM
I don't use drag-drop, but that is a far different thing than data binding. Data Binding is only when you set a data source of a control. I use data binding for controls such as a combo box and even data grids. I bind to strongly typed collections instead of data sets.
I say use it where it makes sense. Don't use it everywhere, and don't stay away from it completely. It is a powerful thing when used right. Don't be afraid, just use good judgment.
Danial
Aug 14th, 2004, 09:10 AM
Originally posted by hellswraith
I don't use drag-drop, but that is a far different thing than data binding. Data Binding is only when you set a data source of a control. I use data binding for controls such as a combo box and even data grids. I bind to strongly typed collections instead of data sets.
I say use it where it makes sense. Don't use it everywhere, and don't stay away from it completely. It is a powerful thing when used right. Don't be afraid, just use good judgment.
HW, thank you for your input. From time to time i do use binding, thats only if i am using DataGrid, other then that I try to use ListView and DataReader.
Thanks.
vbforums.com
Copyright Internet.com Inc., All Rights Reserved.