Results 1 to 4 of 4

Thread: [RESOLVED] [2005] Set Form to DataSet

  1. #1

    Thread Starter
    Fanatic Member Jumpercables's Avatar
    Join Date
    Jul 2005
    Location
    Colorado
    Posts
    592

    Resolved [RESOLVED] [2005] Set Form to DataSet

    Its is possible to set a form to a particular DataSet?

    I have created a DataSet related to a database I have connected to my project. I want to now create a form that uses this particular dataset kinda like in Access you can set the form to a RecordSource of some Sql Statement or Table, then everything on the form will be related to that table.


    Is this possible if so what property do I need to set? I did read something about a form wizard but cannot seem to find it in VS2005.


    Thanks

    C# - .NET 1.1 / .NET 2.0

    "Take everything I say with a grain of salt, sometimes I'm right, sometimes I'm wrong but in the end we've both learned something."
    _____________________
    Regular Expressions Library
    Connection String
    API Functions
    Database FAQ & Tutorial

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

    Re: [2005] Set Form to DataSet

    All sorts of controls can be bound to all sorts of data. One of the most common scenarios is binding a DataSet to a DataGridView. To do this you simply assign the DataSet to the grid's DataSource property and the name of the table you want to display to the DataMember property. There are all sorts of ways to display data in controls. VS 2005 has numerous tools to help you do this in the designer with zero code. A good place to start would be the Home & Learn tutorial in my signature, which gives a simple example. You could then check out some of the other tutorials and also search for "data binding" on MSDN and Google.
    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

    Thread Starter
    Fanatic Member Jumpercables's Avatar
    Join Date
    Jul 2005
    Location
    Colorado
    Posts
    592

    Re: [2005] Set Form to DataSet

    Good point jmcilhinney I was jsut curious if you get set a form to a dataset like you could in .NET 2003.

    Thanks

    C# - .NET 1.1 / .NET 2.0

    "Take everything I say with a grain of salt, sometimes I'm right, sometimes I'm wrong but in the end we've both learned something."
    _____________________
    Regular Expressions Library
    Connection String
    API Functions
    Database FAQ & Tutorial

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

    Re: [RESOLVED] [2005] Set Form to DataSet

    You couldn't "set a form to a dataset" in 2003. If you're talking about the Data Form Wizard then that was just a way of building a form with some controls already added and the data-binding a DataGrid already set up. VS 2005 uses the Data Sources window to create much more sophisticated relationships between data and controls, plus allows you much more flexibility. For instance, once you have added a Data Source to your project you can simply drag a field from it onto a form and the appropriate type of control will be added and bound to that field. The data access capabilities of VS 2005 are very advanced, or you can chosse to do some or all of the work yourself in code to maintian more control. All up, very powerful and very flexible.
    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