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

  • Home
  • SEARCH
  • 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 7526875
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T03:57:20+00:00 2026-05-30T03:57:20+00:00

just had a walkthrough in class and the example code our teacher gave us

  • 0

just had a walkthrough in class and the example code our teacher gave us does not return a value. I am having alot of trouble with my current assignment because I do not see whats wrong with it. It is supposed to take two numbers entered by the user and add them together for a total with a tax rate, but it continues to return all 0’s
heres what the code looks like:

Public Class Form1

Private Sub BtnCalc_Click(ByVal sender As System.Object, _ 
 ByVal e As System.EventArgs) Handles BtnCalc.Click

    Dim amount1 As Decimal
    Dim amount2 As Decimal
    Dim myinvoice As Invoice

    myinvoice = New Invoice

    myinvoice.setlineitemamount(amount1 = Convert.ToDecimal(TextBoxAmt1.Text))
    myinvoice.setlineitemamount2(amount2 = Convert.ToDecimal(TextBoxAmt2.Text))

    LblTotal.Text = myinvoice.calculateinvoicetotal

    MessageBox.Show(myinvoice.getlineitemamount2)

    amount1 = TextBoxAmt1.Text
    amount2 = TextBoxAmt2.Text

End Sub

End Class

And heres the code inside my class:

Public Class Invoice
'created new class for my invoice functions

Private lineItemamount1 As Decimal
Private lineItemamount2 As Decimal
Private lineItemamount3 As Decimal
Private lineItemamount4 As Decimal
Private invoiceDate As Date
Private customer As Integer
Private invoicetotal As Decimal
Private invoicetaxrate As Decimal = 0.1

Public Function getlineitemamount()
    Return lineItemamount1
End Function

Public Sub setlineitemamount(ByVal amount1 As Decimal)
    lineItemamount1 = amount1
End Sub

Public Function getlineitemamount2()
    Return lineItemamount2
End Function

Public Sub setlineitemamount2(ByVal amount2 As Decimal)
    lineItemamount2 = amount2
End Sub

Public Function calculateinvoicetotal()
    Return (lineItemamount1 + lineItemamount2) * invoicetaxrate
End Function

End Class
  • 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-05-30T03:57:23+00:00Added an answer on May 30, 2026 at 3:57 am

    Can you try this plz

    amount1 = Convert.ToDecimal(TextBoxAmt1.Text)
    myinvoice.setlineitemamount(amont1)
    

    And

    Public Function getlineitemamount2() as decimal
    

    when it’s a function you need to specify the TYPE of the returned value
    but i’m not sure it’s your problem but it worths a try

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

Sidebar

Related Questions

Just had a question regarding the UILabel class. I know that the UITextField control
I just had a discussion with a coworker concerning code in header files: He
Alrighty, coding in Perl and just had a quick question. I have class created
We just had our Rails app spit an error when ActionMailer was trying to
I just had a pretty painful troubleshooting experience in troubleshooting some code that looked
I just had to re-install mysql and I am having a problem starting it
I just had a task in where I needed to replace each 3rd value
I just had a quick question for all devs out there, what does +=
I just had a friend of mine look over some code I'm using to
We just had an interesting experience in trying to link a set of code

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.