Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8880957
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T20:15:12+00:00 2026-06-14T20:15:12+00:00

Public Class FRM_GPACalculator Dim dt As New DataTable Dim j As Integer = 1

  • 0
Public Class FRM_GPACalculator

    Dim dt As New DataTable
    Dim j As Integer = 1
    Dim sumOfCreditHours As Double = 0
    Dim sumOfGPA As Double = 0

    Sub calculateGpa()
        sumOfCreditHours = 0
        sumOfGPA = 0
        For i As Integer = 0 To dt.Rows.Count - 1
            sumOfCreditHours = sumOfCreditHours + DGV_GpaCalculation.Rows(i).Cells("Credit Hours").Value
            sumOfGPA = sumOfGPA + DGV_GpaCalculation.Rows(i).Cells("GPA").Value
        Next
        LBL_TotalNumberOfSubjects.Text = j
        LBL_TotalCreditHour.Text = sumOfCreditHours
        LBL_TotalGPA.Text = sumOfGPA
        LBL_GPA.Text = sumOfGPA / sumOfCreditHours
    End Sub

    Private Sub BTN_ADD_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BTN_Add.Click
        Try
            Dim values() As Object = {j, TXT_SubjectName.Text.ToString(), CDbl(TXT_Grade.Text), CDbl(TXT_CreditHour.Text), CDbl(TXT_Grade.Text) * CDbl(TXT_CreditHour.Text)}
            dt.Rows.Add(values)
            DGV_GpaCalculation.DataSource = dt
            calculateGpa()
            j = j + 1
        Catch ex As System.Exception
            MsgBox(ex.Message)
        End Try
    End Sub

    Private Sub FRM_GPACalculator_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        dt.Columns.Add("Index", Type.GetType("System.String"))
        dt.Columns.Add("Subject Name", Type.GetType("System.String"))
        dt.Columns.Add("Grade", Type.GetType("System.String"))
        dt.Columns.Add("Credit Hours", Type.GetType("System.String"))
        dt.Columns.Add("GPA", Type.GetType("System.String"))
    End Sub

End Class

I created a GPA Calculator in VB.NET, as you can see the code as well!!

Here you have to enter your subject name, GPA, and credit hours and in a result it gives you total GPA, credit hours and CGPA!

Now how can I add a clear button that could clear everything?
and as we input GPA,Cridete Hours and Subject name i add a text filed for iputing marks of the subject as well now how i can add Marks column in DataTable and how i could Calculate the persentage ?

plz help me I will be very thankful!!!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T20:15:13+00:00Added an answer on June 14, 2026 at 8:15 pm
     Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
        dt.Rows.Clear()
        DataGridView1.Refresh()
     End Sub
    

    EDIT didnt see the second part of your question. Could you clarify that part

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

public class Test { public static void main(String[] args) { DemoAbstractClass abstractClass = new
public class HttpPostTask extends AsyncTask<Void, Integer, Void> { TextView txtStatus = (TextView)findViewById(R.id.txtStatus); @Override protected
This is my code for connection: Imports System.Data.SqlClient Public Class frm_edit_patient Dim con As
public class tryAnimActivity extends Activity { /** * The thread to process splash screen
public class MyClass { public string MyProperty{ get; set; } Now, I would like
public class Test1<Type> { public Type getCompositeMessage(Type... strings) { Type val = (Type) ;
public class Knowing { static final long tooth = 343L; static long doIT(long tooth)
public class A { private A(int param1, String param2) {} public static A createFromCursor(Cursor
public class WeeklyInspection : Activity { WebView view = (WebView) FindViewById(Resource.Id.inspectionWV); view.Settings.JavaScriptEnabled = true;
public class User { public long Id {get;set;} [References(typeof(City))] public long CityId {get;set;} [????]

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.