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 8596465
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T00:41:13+00:00 2026-06-12T00:41:13+00:00

When I try to run the program to calculate payment and total intrest I

  • 0

When I try to run the program to calculate payment and total intrest I get “Conversion from string “” to type ‘Double’ is not valid.”

What am I doing wrong?

Dim P As Double
Dim R As Double
Dim N As Double
Dim Payment As Double
Dim totalInterest As Double

Private Sub btnAnalyze_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnAnalyze.Click

P = CDbl(txtAmount.Text)
N = CDbl(txtDuration.Text)
R = CDbl(txtInterestRate.Text)

Payment = (P * R) / (1 - (1 + R) ^ (-N))
totalInterest = (N * Payment) - P

Payment = CDbl(txtPayment.Text)
totalInterest = CDbl(txtInterest.Text)

If P < 0 Then
MessageBox.Show("Please enter in loan amount")

End If

If R <= 0 Then
MessageBox.Show("Please enter in loan amount")

End If

If N <= 0 Then
MessageBox.Show("Please enter in loan amount")

End If


End Sub
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-06-12T00:41:15+00:00Added an answer on June 12, 2026 at 12:41 am

    One of your TextBox items has not been filled in.

    As such, when you use CDbl, such as P = CDbl(txtAmount.Text), if the TextBox is empty, it will cause this error.

    A better option would be to use Double.TryParse instead of CDbl, as it will allow you to raise a proper message:

    Private Sub btnAnalyze_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnAnalyze.Click
    
    If Not Double.TryParse(txtAmount.Text, P) Then
         MessageBox.Show("Please correct the loan amount")
         Exit Sub
    End If
    
    ' Do the same for all other CDbl checks
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I get Segmentation Fault when I try to run my program. Can someone please
When I try and run my program I get this warning and some weird
I get this error when i try to run the program: Error C2440: 'function'
i get a bad_access error when i try to run my program, normally i
I get the following error when I try to run my program. Any reasons
When I try to run this program, I get an error in Firefox saying
I try to run one program in myeclipse where after creating one web project
when i try to run a program in eclipse with adt and od a
I try run jconsole with jar that contains my classes like: cd C:\Program Files\Java\jdk1.6.0_26\bin
When I try to run the sample find_obj.cpp or any OpenCV SURF program I

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.