Results 1 to 9 of 9

Thread: Adding Values

  1. #1

    Thread Starter
    New Member
    Join Date
    May 2009
    Posts
    5

    Question Adding Values

    Hi guys,

    First of all I want to say Hi to everyone as I'm a new member and then second I want to applogize if I posted this at the wrong section.

    Ok basically I've created a database in MS Access with a list of prodcuts with a corresponding price and a Yes/No column at the end. I've imported the database in VB (I'm using VB 2008) and I've put a textbox. What I'm aiming for is basically when I tick one or more products on the database, the prices to be added in textbox. I'm guessing I will need to build an expression but I have no clue how to do that. Can anyone help out?

  2. #2

    Thread Starter
    New Member
    Join Date
    May 2009
    Posts
    5

    Re: Adding Values

    Please people, its URGENT!

  3. #3
    Super Moderator si_the_geek's Avatar
    Join Date
    Jul 2002
    Location
    Bristol, UK
    Posts
    41,974

    Re: Adding Values

    Welcome to VBForums

    Please do not bump your threads. For some of the reasons, see this. People will read your thread (and hopefully reply) when they get the time to do so.

    For now the best I can do is recommend you spend some time reading our Database Development FAQs/Tutorials (at the top of the this forum), particularly the VB.Net section. You may also need to check out the SQL section.

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

    Re: Adding Values

    Are you saying that you don't know how to get the data from the Access database into your application? When you say that you've "imported" the database, do you mean that you've just added it to your project or have you used the Data Source wizard to generate a typed DataSet?
    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

  5. #5

    Thread Starter
    New Member
    Join Date
    May 2009
    Posts
    5

    Re: Adding Values

    Quote Originally Posted by jmcilhinney View Post
    Are you saying that you don't know how to get the data from the Access database into your application? When you say that you've "imported" the database, do you mean that you've just added it to your project or have you used the Data Source wizard to generate a typed DataSet?
    No, no, no. I didn't make myself very clear and forgive me for that. I have the database on the form and when I run the program its there but what I need to do now is when I tick a given product on the database, the corresponding prices to be added in the textbox I've created on that form. Take a look at that screenshot I've uploaded and you'll get a better idea of what I'm aiming for


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

    Re: Adding Values

    How exactly did you get that data displayed? Did you populate a DataTable and then bind that to a DataGridView? If so, did you put a BindingSource between them?
    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

  7. #7

    Thread Starter
    New Member
    Join Date
    May 2009
    Posts
    5

    Re: Adding Values

    All of the above.

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

    Re: Adding Values

    OK then. You should handle the CurrentItemChanged event of the BindingSource, which is raised every time a field in the current record is changed. In that event handler you can loop through all rows and simply add up the ones where your Yes/No column is True. The result goes in the TextBox.
    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

  9. #9

    Thread Starter
    New Member
    Join Date
    May 2009
    Posts
    5

    Re: Adding Values

    I seriously have NO clue how to follow all these steps

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