none
How to display the sum of two columns in another column RRS feed

  • Question

  • I am very new in using visual basic to develop database. I am developing a workers payroll and want to automatically display the sum of Basic Salary and Allowances in the Gross Salary field, in Visual Studio 2015 but I couldn't write the code.

    Please I will appreciate if someone can help me successfully do it.

    Thanks


    I am happy to enroll on your forum. I am a new student and want to learn how to use the Microsoft Visual Basics and I hope the forum will guide me

    Tuesday, April 24, 2018 11:38 PM

All replies

  • I am very new in using visual basic to develop database. I am developing a workers payroll and want to automatically display the sum of Basic Salary and Allowances in the Gross Salary field, in Visual Studio 2015 but I couldn't write the code.

    Please I will appreciate if someone can help me successfully do it.

    Thanks


    I am happy to enroll on your forum. I am a new student and want to learn how to use the Microsoft Visual Basics and I hope the forum will guide me

    Tuesday, April 24, 2018 11:29 PM
  • The short answer is yes it's possible but another question is, should it be done it code or in the database table? The answer is "it depends", the wrong answer is because someone wants to write code in the project rather than in the database.

    Looking at SQL-Server, Arithmetic Operators, math functions.

    For MS-Access, operators, functions.

    For code "it depends", in a class you can do math operations in read-only properties or a function. For a DataTable create a DataColumn with an expression.

    If the data changes often in real-time then you may need a delegate to raise an event or events for a DataTable.

    No matter how you decide to go, think about the architecture, data operations belong in a class while interacting with data can go in a form but not touching database tables.


    Please remember to mark the replies as answers if they help and unmark them if they provide no help, this will help others who are looking for solutions to the same or similar problem. Contact via my Twitter (Karen Payne) or Facebook (Karen Payne) via my MSDN profile but will not answer coding question on either.
    VB Forums - moderator
    profile for Karen Payne on Stack Exchange, a network of free, community-driven Q&A sites

    Tuesday, April 24, 2018 11:53 PM
    Moderator