Results 1 to 9 of 9

Thread: Data Binding, is it fine in VB.Net

  1. #1

    Thread Starter
    Software Carpenter dee-u's Avatar
    Join Date
    Feb 2005
    Location
    Pinas
    Posts
    11,127

    Arrow Data Binding, is it fine in VB.Net

    In VB6.0 data binding was setting a textbox's datasource to a datacontrol (or something sort of... It's about using data-bound controls), is it still the way it's done in VB.Net? I havent actually done database stuff yet but it seems I often read about data binding in here? In VB6.0 I never really bind or use any data-bound control so I wish to be clarified about this case in VB.Net...
    Regards,


    As a gesture of gratitude please consider rating helpful posts. c",)

    Some stuffs: Mouse Hotkey | Compress file using SQL Server! | WPF - Rounded Combobox | WPF - Notify Icon and Balloon | NetVerser - a WPF chatting system

  2. #2
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: Data Binding, is it fine in VB.Net

    Data-binding involves linking the data displayed in a control to some other source. The data source is most often a DataTable, either stand-alone or part of a DataSet, or a whole DataSet in the case of some DataGrids. It can be other objects though, like an array or collection. The beauty of data-binding is that you can programatically alter the underlying data source and the changes will be refelected in the control, and the user can alter the data in the control and the changes will be reflected in the data source. There is no need to laboriously fill a control using loops or retrieve the edited data when done. Basically, data-binding is a really, really good thing.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  3. #3
    Member
    Join Date
    Aug 2005
    Posts
    37

    Re: Data Binding, is it fine in VB.Net

    Quote Originally Posted by dee-u
    In VB6.0 data binding was setting a textbox's datasource to a datacontrol (or something sort of... It's about using data-bound controls), is it still the way it's done in VB.Net? I havent actually done database stuff yet but it seems I often read about data binding in here? In VB6.0 I never really bind or use any data-bound control so I wish to be clarified about this case in VB.Net...
    It most certainly is in VB 2005 Express Edition Beta 2! However, it is more advanced than before, allowing you to open a dialog in order to set the bindings to just about anything you can imagine - even to bind it to other properties in order to extend functionality.

    Quote Originally Posted by MSDN Express
    Use data binding to connect many of the properties of a TextBox control to a data source. Doing so enables the property values to be determined at run time.

  4. #4

    Thread Starter
    Software Carpenter dee-u's Avatar
    Join Date
    Feb 2005
    Location
    Pinas
    Posts
    11,127

    Re: Data Binding, is it fine in VB.Net

    I noticed I even have a link in my signature (Data Binding Is Evil), if you will care to read would you tell me that it doesn't apply to VB.Net? I just want to be enlightened...
    Regards,


    As a gesture of gratitude please consider rating helpful posts. c",)

    Some stuffs: Mouse Hotkey | Compress file using SQL Server! | WPF - Rounded Combobox | WPF - Notify Icon and Balloon | NetVerser - a WPF chatting system

  5. #5
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: Data Binding, is it fine in VB.Net

    It sounds to me like VB6 data binding and VB.NET data binding are two quite different things. They seem to be saying that ADO is a better alternative to data binding, but ADO.NET is not an alternative to data binding in .NET. Rather the two work together to make data access easier and quicker. Like any technology that hides complexity, it can make programmers lazy to a certain degree. Many people use data binding without really understandaing what it is they are doing. I would highly recommend that you understand data binding and how it works, as well as the alternatives, but feel more than free to use data binding in VB.NET wherever it is appropriate.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  6. #6

    Thread Starter
    Software Carpenter dee-u's Avatar
    Join Date
    Feb 2005
    Location
    Pinas
    Posts
    11,127

    Re: Data Binding, is it fine in VB.Net

    It's somewhat really confusing as I've havent really started doing database stuff with VB.Net (I'll soon do, with a small app I will convert from VB6.0 to Vb.Net), so you would recommend that I would use data-binding in VB.Net? It seems it was easier (in VB6.0) not to use data-binding, well I had experienced data-binding in the early part of my learning process of VB6.0 and I encountered lots of troubles with it, when I junk it then all became smooth for me so I want to know what would be the advantages and disadvantages of employing data-binding in VB.Net to clarify things up...
    Regards,


    As a gesture of gratitude please consider rating helpful posts. c",)

    Some stuffs: Mouse Hotkey | Compress file using SQL Server! | WPF - Rounded Combobox | WPF - Notify Icon and Balloon | NetVerser - a WPF chatting system

  7. #7
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: Data Binding, is it fine in VB.Net

    Like I said, data binding creates a two way relationship between a data source and a control, which negates the need for you to manually transfer data form a data source to a control initially and then back again after editing. When I say "data source" I mean an object in memory, not the actual database. To be used properly in all instances there is still a reasonable amount to know about data binding in .NET, but if done properly it will simplify your life greatly. Use it.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  8. #8

    Thread Starter
    Software Carpenter dee-u's Avatar
    Join Date
    Feb 2005
    Location
    Pinas
    Posts
    11,127

    Re: Data Binding, is it fine in VB.Net

    In VB6.0 when I used to bind my controls to data controls the main problem I could remember was when trying to modify a certain textbox then tried to close the form the changes are automatically reflected in the database, so is moving to the next record, the changes are automatically saved, is it the same case in VB.Net?
    Regards,


    As a gesture of gratitude please consider rating helpful posts. c",)

    Some stuffs: Mouse Hotkey | Compress file using SQL Server! | WPF - Rounded Combobox | WPF - Notify Icon and Balloon | NetVerser - a WPF chatting system

  9. #9
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: Data Binding, is it fine in VB.Net

    Quote Originally Posted by jmcilhinney
    When I say "data source" I mean an object in memory, not the actual database.
    Data binding in VB.NET knows nothing of the database itself. You are binding your controls to objects in memory. Usually those objects will be individual DataTables or a DataSet. Any changes you make in the bound controls will be reflected in that data source, but the database itself is, as always, disconnected from that data and is not updated until you explicitly do so.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width