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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T02:52:27+00:00 2026-05-15T02:52:27+00:00

I have a project to do in Visual Basic. My problem is that the

  • 0

I have a project to do in Visual Basic.
My problem is that the outcome is always wrong (ex. instead of 2011 it gives 2000). And i cannot set as Desired unit the Inch(1) or feet(3), it gives the Infinity error. And if i put as Original and Desired unit the inch(1), the outcome is “Not a Number”.

Here’s the code i made so far. The project is about arrays. Any help appreciated.

Public Class Form1

Private Sub btnConvert_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnConvert.Click

    Dim original(9) As Long
    Dim desired(9) As Long
    Dim a As Integer
    Dim o As Integer
    Dim d As Integer
    Dim inch As Long, fathom As Long, furlong As Long, kilometer As Long
    Dim meter As Long, miles As Long, rod As Long, yard As Long, feet As Long

    a = Val(Input3.Text)
    o = Val(Input1.Text)
    d = Val(Input2.Text)

    inch& = 0.0833
    rod& = 16.5
    yard& = 3
    furlong& = 660
    meter& = 3.28155
    kilometer& = 3281.5
    fathom& = 6
    miles& = 5280

    original(1) = inch
    original(2) = fathom
    original(3) = feet
    original(4) = furlong
    original(5) = kilometer
    original(6) = meter
    original(7) = miles
    original(8) = rod
    original(9) = yard

    desired(1) = inch
    desired(2) = fathom
    desired(3) = feet
    desired(4) = furlong
    desired(5) = kilometer
    desired(6) = meter
    desired(7) = miles
    desired(8) = rod
    desired(9) = yard

    If o < 1 Or o > 9 Or d < 1 Or d > 9 Then
        MessageBox.Show("Units must range from 1-9.", "Error", _
        MessageBoxButtons.OK, _
        MessageBoxIcon.Information)
        Return
    End If

    Output.Text = (a * original(o)) / desired(d)

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-05-15T02:52:28+00:00Added an answer on May 15, 2026 at 2:52 am

    Geia sou Manoli,

    usually arrays are zero based.
    Also inch, meters etc should be declared as double, not long.

    This code will do the convertion corectly

        Private Sub btnConvert_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnConvert.Click
        Dim original(8) As Double
        Dim desired(8) As Double
        Dim a As Integer
        Dim o As Integer
        Dim d As Integer
        Dim inch As Double, fathom As Long, furlong As Double, kilometer As Double
        Dim meter As Double, miles As Long, rod As Double, yard As Double, feet As Long
    
        a = CInt(Val(Input3.Text))
        o = CInt(Val(Input1.Text))
        d = CInt(Val(Input2.Text))
    
        inch = 0.0833333333
        rod = 16.5
        yard = 3
        furlong = 660
        meter = 3.2808399
        kilometer = 3280.8399
        fathom = 6
        miles = 5280
    
        original(0) = inch
        original(1) = fathom
        original(2) = feet
        original(3) = furlong
        original(4) = kilometer
        original(5) = meter
        original(6) = miles
        original(7) = rod
        original(8) = yard
    
        desired(0) = inch
        desired(1) = fathom
        desired(2) = feet
        desired(3) = furlong
        desired(4) = kilometer
        desired(5) = meter
        desired(6) = miles
        desired(7) = rod
        desired(8) = yard
    
        If o < 0 Or o > 8 Or d < 0 Or d > 8 Then
            MessageBox.Show("Units must range from 0-8.", "Error", _
            MessageBoxButtons.OK, _
            MessageBoxIcon.Information)
            Return
        End If
    
        Output.Text = CStr((a * original(o)) / desired(d))
    
    End Sub
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 499k
  • Answers 500k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer This is not pretty but it works: rm -R $(ls… May 16, 2026 at 12:45 pm
  • Editorial Team
    Editorial Team added an answer Yes. Override the base1 and base2 methods in Derived to… May 16, 2026 at 12:45 pm
  • Editorial Team
    Editorial Team added an answer No, you can't. Unfortunately, UIEvent doesn't expose any public way… May 16, 2026 at 12:45 pm

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Related Questions

No related questions found

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.