Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
  HOME    TRACKER    Visual Basic

English To Metric Conversion Program

I'm a college student New to VB. My Instructor keeps telling us to read the book he is no help. I'm a hands on learner. So I'm here to see if someone could help me. I have designed the box. It has Miles, Yards, Feet, and Inches. It has Kilometers, Meters, Centimeters, and a Cnvert English to Metric Button. The names are all Labels. For Miles, Yards, Feet and Inches are Numbupdown boxes. For Kilometers, meters, and centimeters I used textboxes. Using the following formula to change the English Measurement to inches: Total Inches = 63,360 x Miles + 36 x Yards + 12 x Feet + Inches. This formula to determine the equivalent meters:
Meters = Total Inches / 39.37.
It says to declare constants for all numeric values in the two formulas above. The variable used to represent the number of meters and the numeric constant 39.37 must be declared as the data type Double. The constanats and data type in 1st formula should be declared as intergers. Convert the Total Inches in s2nd formula to a Double data type before using it in the calculation. Set Option Strict On in the code. Use the folling to test data 2miles, 5yards, 2ffet, and 7inches. Should be 3kilometers, 224meters, and 5.38...centimeters. Please someone help me with the code for this project. I have done what I thought was right but it doesn't calculate when I hit the button. I know this is a lot to ask. Thanks!!! Cindy

View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
Source Code For Metric To English
I'm new at VB. I'm trying to write source code that will convert miles to kilometers and vise versa. I wanted to have a Frame that would have two buttons on with miles to kilometer and the other kilometers to miles. I want the user to enter a number in text box and depending on what button is pushed it would give them the answer in a box labeled answer.

Conversion To Metric...
I'm suppose to create a program that will convert a U.S. Customary System Length in miles, yards, feet, and inches to a Metric System length in kilometers, meteres, and centimeters.
The program must have a 4 text boxes (for miles, yards, feet, and inches to be input), a command button (to convert to metric), and a picture box (to print results).

I have the layout done, but I'm having some trouble getting the required results. I'm sure that I'm forgetting something or there is just some major errors in my logic. I was hoping that someone could take a look at the following code and tell me exactly what I'm doing wrong.

Private Sub cmdConvert_Click()
Dim miles As Single
Dim yards As Single
Dim feet As Single
Dim inches As Single
Dim totalInches As Single
Dim kilometers As Single
Dim meters As Single
Dim centimeters As Single
miles = Val(txtMiles.Text)
yards = Val(txtYards.Text)
feet = Val(txtFeet.Text)
inches = Val(txtInches.Text)
totalInches = 63360 * miles + 36 * yards + 12 * feet + inches
kilometers = Int(meters / 1000)
meters = totalInches / 39.37
centimeters = 100 * totalMeters
picAnswer.Print "The metric length is..."
picAnswer.Print kilometers, "kilometers"
picAnswer.Print meters, "meters"
picAnswer.Print centimeters, "centimeters"
End Sub

As you can see, I'm very new to VB, but any help would be appreciated. When I convert miles(5), yards(20), feet(2), and inches(4) to metric, the following needs to be printed:

The metric length is 8 kilometers, 65 meters, and 73.5 centimeters.

There's not much in the way of assistance regarding programming on my campus, so I figured that I would try here.

Also, the formulas that I have for the program are as follows:

- total inches = 63360 * miles + 36 * yards + 12 * feet + inches
- total meters = total inches / 39.37
- kilometers = Int (meters / 1000)

Thanks, in the meantime I'll be reading the first 139 pages of my text book and looking over my lecture notes to see where I'm going wrong.

Metric Conversion
I am trying to write a small program that will convert the entered miles, yards, feet, and inches into kilometers, meters, and centimeters. The number for kilometers comes out fine, but the meters are way off. What doesn't make sense is that the kilometers are found by using the data from meters. The code is as follows:

private Sub cmdConvert_Click()
miles = Val(txtMiles.Text)
yards = Val(txtYards.Text)
feet = Val(txtFeet.Text)
inches = Val(txtInches.Text)
totalInches = Val(63360 * miles + 36 * yards + 12 * feet + inches) ' takes all valuse entered into the text boxes and converts them to inches
totalMeters = Int(totalInches / 39.37) ' this does not come out right, but kilometers do, even though kilometers (below) use this value.
kilometers = Int(totalMeters / 1000) ' works fine.
centimeters = Int(kilometers / 0.01) ' comes out a little higher than it should.
picDisplay.print "The metric length is:"
picDisplay.print kilometers; "kilometers,"
picDisplay.print totalMeters; "meters, and"
picDisplay.print centimeters; "centimeters."
End Sub

If you enter 5 in the box for miles, 20 for yards, 2 for feet, and 4 for inches, the values should read 8 kilometers, 65 meters, and 73.5 centimeters. Can anyone help me?


English To Nepali Date Conversion
I need to convert english date to nepali date. I tried doing it but there are some problems.

Today here is Nepal,
English date is (MM/DD/YY) - 11/13/2002
Nepali date is (YY/MM/DD) - 2059/07/27

In Nepali date, the minimum days in a month is 29 and maximum is 32.
Nepali date is 56 years, 8 months and (I'm not sure but it is either 15 or 16 days) ahead of English date. I'm only confused on the days. The number of years and months are correct.

Here are few English dates and their Nepali equivalents according to Nepali calender.

English Date(MM/DD/YY) - Nepali Date(YY/MM/DD)
04/14/02 - 59/01/01
05/14/02 - 59/01/31
07/16/02 - 59/03/32 - only this date is shown correctly by the program I wrote
08/16/02 - 59/04/31
09/01/02 - 59/05/16
11/13/02 - 59/07/27

Here is the code I've written so far;

Private Sub Form_Load()
'get the engilsh date
txtEnglishDate.Text = "07/16/02"

Dim strEnglishDate As String
strEnglishDate = txtEnglishDate.Text

Dim strYear As String
Dim strMonth As String
Dim strDay As String

'get the day of the english date
strDay = Mid$(strEnglishDate, 4, 2)
'get the month of the english date
strMonth = Mid$(strEnglishDate, 1, 2)
'get the year of the english date
strYear = Mid$(strEnglishDate, 7, 2)

'since Nepali day is 16 days ahead of English day
strDay = strDay + 16
'if the number of day is more than 32 then we enter the next month of the year
If strDay > 32 Then
'get the day of the next month
strDay = strDay - 32
'increase the month by 1 to get to next month
strMonth = strMonth + 1
End If

'since Nepali month is 8 months ahead of English month
strMonth = strMonth + 8
'if the number of month is more than 12 then we enter the next year
If strMonth > 12 Then
'get the month of the next year
strMonth = strMonth - 12
'increase the year by 1 to get to next year
strYear = strYear + 1
End If

'since Nepali year is 56 years ahead of English year
strYear = strYear + 56

'format the month and day
If Len(strMonth) = 1 Then strMonth = "0" & strMonth
If Len(strDay) = 1 Then strDay = "0" & strDay

'print the nepali date
txtNepaliDate = strYear & "/" & strMonth & "/" & strDay

End Sub
Is there anything more that I have to consider?


English-piglatin Conversion RESOWLVERED
Can someone help me code this???? i need very simple code... also, remember words that start with vowels need way at the end and no change.. it has to be a line of either 1 word or more... so its hard for me

VB6 Language Conversion: English => Japanese And German

I have a decent sized VB6 project that needs to be converted to Japanese and German. From what I hear, converting to German should be fairly simple. Japanese is another story. If anyone has done a conversion like this, could you please share the most important items (things to consider) to make a conversion like this successful.

Thank you.

English To Hindi/Marathi (Indian Languages) Conversion

I am working on project for my class, where i have to convert the text typed in english to hindi & marathi.

The question is will there be a need to do this conversion within VB or will it be taken care of internally ?

Will ASCII conversion work? or i need to use ISCII conversion. Or i need to do something else.

Thanking in anticipation.

English To Hindi/Marathi (Indian Languages) Conversion

I am working on project for my class, where i have to convert the text typed in english to hindi & marathi.

The question is will there be a need to do this conversion within VB or will it be taken care of internally ?

Will ASCII conversion work? or i need to use ISCII conversion. Or i need to do something else.

Thanking in anticipation.

How To Swap Non English Unicode Characters Instead Of English Letters Pressed?
Hi all i am trying to create a program that when i type certain english keywords it goes writes non english unicode of that character. All the equivelents chars are predfined . For example if i type/press letter K on keyboard in the text box it prints ك and so fort for the rest of charecters. I just want to know how i can replace charecters pressed with predefined non english charecters. Furthermore, add a checkbox that when it checke it do the swap of english letters to non english ones,otherwise it just type the english key that is pressed on the keyboard. If the key is Thanks

How To Swap Non English Unicode Characters Instead Of English Letters
Hi all i am trying to create a program that when i press a certain english letter, it goes writes non english unicode of that letter instead. All the equivelent letters are predfined . For example if i press letter K on keyboard ,in the textbox or word type document it prints ? and so fort for the rest of letters.

I just want to know how i can replace letters pressed with predefined non english letters. Furthermore, I want add a checkbox that when it checked it do the swap of english letters to non english ones,otherwise it just type the english letter that is pressed on the keyboard.Thanks

Metric Trig Functions ?
This is kind of a strange question but I will ask it anyway - Is there such a thing as metric trig functions? I realize that an angle such as 30 degrees is the same in both inch and metric system but would a function such as cosine 30 degrees be the same number for inch and metric system?

Change Metric System In VB6
Hi guys,

I'm rebuilding some forms in VB.NET which were originally created in VB6. And the first thing I noticed was that the metric system used in VB6 is different with the one in .NET. How can I change the metric system in VB6 to the same one used in VB.NET?

Having A Problem With Coverting Metric System
and as for my first problem for the metric system program Im totally stuck on it i dont know what to do thats the thing i dont know how to explain it either basically this is what i have done
Dim num1 As Single
Dim num2 As Single
Dim num3 As Single
Dim num4 As Single
num1 = Miles
num2 = yards
num3 = feet
num4 = inches
totalinches = 63360 * Miles + 36 * yards + 12 * feet + inches
totalmeters = totalinches / 39.37
picoutput.Print Int(totalmeters / 1000)
picoutput.Print totalinches
picoutput.Print totalmeters

The program is that i put in numbers for Miles/Yards/Feet/Inches then it comes out in Kilometers/meters/centimeters

when i put in
Miles 5
Yards 20
Feet 2
Inches 4
i should get 8km 65meters and 73.5 cm but instead i get this

If anyone could please point me in the right direction that would be great help

im totally lost

Conversion Program
Hi, I have made a conversion program for temperature, weight, capacity and distance in vb. At the moment, i do not kno how to limit the output of characters that are in the label with the answer of the calculation. I do not know either how to insert a degrees symbol or anything in the output label that contains the answer. Please can somebody help?
If anybody needs the vb file/more info - please msg me on msn (


WAV Conversion Program
Hello everyone.

Is there a good wav converison program so i can convert my sound effects to the type of wave files described in this tutorial. Preferably a free program.

Many thanks chris

Text Conversion Program
I am very new to VB. I just decided to take on the language. I started with a few simpler programs, but I need help with this one. This is the code from a button that I want to convert a message from Text1 Box into numbers (like a=1 b=2 c=3 and so on) and display the outcome in Text2 box,

Private Sub Convert_Click()
If (Text1 = "") Then
Text2 = ""
MsgBox "You didn't enter anything!"
End If
If (Text1 > "") Then
Text2 = Text1
End If
End Sub

Like I said, I'm new, so there isn't much there. Can someone help me with this? I obviously need a lot of help.

Problems With Conversion Program
I'm trying to create a conversion program that converts feet to meters, celsius to fahrenheit, etc..
I have created 2 combo boxes filled with 4 different Index values each. When one value is selected in either box, the corresponding value is automatically selected in the other box. Now I need a way to access those 4 different values so that I can declare what happens when they are selected and the user converts a number with them selected. Any help would be appreciated.

(Sorry if my terminology doesn't make sense, I'm new)

Program Conversion From Access To SQL Server2000
I have developed a vb6 application which works off of an Access database. Originally it was to be an interim solution but I believe the powers that be want to make it a more permanent solution. This being the case, I need to get this program working off of a SQL Server database before it grows too far out of hand as an Access database.

My question: What would be involved in migrating an application based on Access over to be one based on SQL Server? Will the connection string change? Will I need to rewrite the SQL for my select/update/insert/delete queries?

I've never developed anything that used SQL Server before so this is all new to me, any advice or insight from anyone who has been down this road before would be greatly appreciated.

Many thanks!

Need Simple Currency Conversion Program
I have an instructor from ****! and need a program by tomorrow that converts currency from several countries to U.S. dollars. We have never covered this in class, and it is not in our text, so I am assuming we get it from research - so, please help and thanks for helping me get through this VB course!

Homework>write A Code That Converts Metric System Into Kilometers, Meters, And Centim
im stuck can anyone help me make this program far i did this

Dim num1 As Single
Dim num2 As Single
Dim num3 As Single
Dim num4 As Single
num1 = Miles
num2 = yards
num3 = feet
num4 = inches
totalinches = 63360 * Miles + 36 * yards + 12 * feet + inches
totalmeters = totalinches / 39.37
picoutput.Print (63360 * Miles + 36 * yards + 12 * feet + inches)
picoutput.Print (totalinches / 39.37)
picoutput.Print Int(totalmeters / 1000)

Edit: This doesnt look much like C++ to me..... moving to General

Color Conversion - Conversion Problem?
Hi all,

    I want to convert color schemes used in web to the compatible windows colors. I have a color code #EFF5FC. how do i convert it so that i can use it in vb backcolor.?


When you are laughing, you are in a state of meditation.
b'caz laughing and thinking cannot be done together.

Non English Version
I have to develop an application in VB for a non English version
of windows, how can I find out what My Documents is called?

[vb6] What Is The Structure English Of VB 6?
Private Sub cmdCalc_Click()
On Error GoTo help
Dim Prices As Double

Prices = (CCur(txtConsPrice) * (1 + (fColor + fWood))) + (CCur(txtFloorPrice) * (100 * fFloor)) + CCur(txtHardPrice) + CCur(txtGlassPrice)
txtCost.Text = Format(Prices, "Currency")
Exit Sub
MsgBox "Please Make Sure All Of Prices Are Filled!"
End Sub

Can someone show me the Structure English of these code?


Force English
Does anyone know how to force a session in English in VB? I'm asking because running my application on different country setups messes up some of my date functions.

English Dictionary
is there any way to have dictionary in vb program

Query With No English
I would lime to ask what i should to get an alphabetical order of words written in greek,words starting with vowels. These vowels can be accentuated or not and that's the problem i'm facing...I mean that i can't get alphabeticla order of words but rather accentuated first and then not accentuated ones...I hope you know what i mean. I suppose german has the same thing. For example, ber and Und.
For english i use

dtaEntries.RecordSource = "SELECT * FROM terms WHERE trmEng LIKE 'a%" & "'" & "ORDER BY trmEng"

SetWindowsHook English
People, I need him to guide me with the following thing:

The Api SetWindowsHook is good among other things to detect mouse movements and of keyboards, when we give the thread to the system so that he/she calls to a function of my program.
That is to say, if we don't type anything, my program doesn't receive anything. Certain?.
Good, is what I need to know as knowing when the system or does the user execute an application? with this Api or with any other one.
That is to say that the same system warns him my program that a new process has been created.

I constantly can scanear the system looking for the handles of those so many that are open, but he/she wastes away resources of the CPU that I want to avoid, since when I am writing in Word, unless he/she opens menus or ToolTips, any handle is not added.

My program would have to receive from the system a warning that for example a process has opened up, then I take that handle and I notice if it is an application "x" and in consequence I make something.
If they need more specifications, don't doubt to consult me to the email, he/she would thank them to him very much, since it is very important for an application that I am developing.
From I am already to disposition of who can give me a help. Thank you.

excuse my terrible Englishbe terrible.

Get All English Words
is there any site or any other possibility to obtain a complete
list of the words of the english language? (in plain text form)


Please Help With Non English Characters
I found excellent example which works with archiver like rar, zip, etc.
But here some problem for me.
It does good with english characters, but not for non english. Can you help me solve this problem?

Unicode - Need To Keep It In English
I have a program that's in english. Everything needs to stay in english. A few of my users have secondary language packs such as chinese installed. When they run my program and the program populates textboxes with data saved in a config file, it's all garbled. When they turn off that language option, the text looks fine...

I need all users to run one version that works by displaying the english characters whether or not they have a secondary language pack.

I ran across a message thread here that mentioned this for writing and writing:

VB Code:
Private Sub Command1_Click()    Dim barTemp() As Byte    barTemp = Text1.Text    Open "unicode.txt" For Binary As #1        Put #1, , barTemp    Close #1End Sub Private Sub Command2_Click()    Dim barTemp() As Byte    ReDim barTemp(FileLen("unicode.txt") - 1)    Open "unicode.txt" For Binary As #1        Get #1, , barTemp    Close #1    Text1.Text = barTempEnd Sub

Is this what I want? I've found tons of making VB6 work for many languages but nothing for "make it only work for one language."


SQL Syntax In English

Does this exist ? Is there anything that would take an SQL statement, and translate it into English ? Sometimes, I've created a long and complex statement, and either get my statement rejected, or it doesn't return the results I expect. Sometimes, I've checked a statement time and time again, but when I finally find what was wrong, I think I should have seen it at the start. If there was another eye looking at my statement, I might get my problem solved earlier. I think it would be fun to write such a tool myself, but has someone else done the hard work for me ?


Monthname() Always English???
does the function Monthname always return the name in English?? If I use it on a french machine it still returns a English month name. This is not good for my app wich will be deployed in several different languages

Monthname() Always English???
does the function Monthname always return the name in English?? If I use it on a french machine it still returns a English month name. This is not good for my app wich will be deployed in several different languages

From English To Code
Sorry guys, I know it's quite troublesome for you guys to help me slove this problem but with my skills alone I doubt I can make it..

Situation :

I have a richtext box and there's already a whole lot of lines ..

eg = " This is a pear.
I Bought this pear
It cost me $6
This is an apple.
I Bought this apple.
It cost me $2"

I would like any experts to suggest the best command for..

Search for ( { 0-9})
If present Then
Copy that line and copy upwards
Until I see another {0-9}
End If

I know it may be quite hard and please bear with me.. Sorry and Thanks

English Query
Hello Everybody,

Can anyone tell me what is an English Query in SQL Server. How is it different from the normal sql query? What are it's advantages and disadvantages. Please let me know.



Explain This In English?
Sorting routines are among the commonest operations in programming. Numbers can be sorted in ascending or descending order. Also, text can be sorted alphabetically.

Typically, sorting routines read data from an external file. The values are placed into an array, so that each number has a unique identity. ie:

number(1) = 22
number(2) = 13
number(3) = 38

The sorting routine then uses a decision structure (such as IF-THEN-ELSE) to compare the first item of the list (n) with the second item (n+1), and then make the necessary substitutions.

We will look at two types of sorting routines:


BUBBLE SORT: (largest to smallest)

This method repeated compares the first item in list to the second item in a list in a repetition structure.
These items must be arrays.

If the first item is smaller than the second item, then the value in the first item is assigned to a "temporary" variable as a holding spot.

Then the second variable is assigned to the first variable's spot and the value stored in the "temporary" holding place is assigned the second place on the list.

The bubble sort then goes on to compare the second item on the list, to the third item on the list, to repeat the procedure until the end of the list is reached.

When the end of the list is reached, the process must start over again because the swaps were only done with adjacent values. A really big number would take many iterations (repetitions) to "bubble" its way to the top.

During the second iteration, for example, the program will need to compare the first item in the list to the {perhaps) new second item in the list.

i'm a idiot

Plain English
I have an Excel s/sheet with vb code.
It performs some tasks & i've been told it uses:
'BDC session through OCX controls'
to perform the tasks.

Can anyone tell me what that's all about?

What Does This Mean? Can You Interpret In English?
Dim lStyle As Long
lStyle= GetWindowLong(frm.hwnd, GWL_STYLE)
lStyle= lStyle Or WS_CHILD 'Append "WS_CHILD"

Call SetWindowLong(frm.hwnd, GWL_STYLE, lStyle)

*****---English To Pig Latin!!--*******
Hello i have saved all the words from a text field into an array called MyString(). This array has each words saved separatly, so if the text file says "Hello my name is" then the array saves "Hello" and "my" and "name" and "is" in itself. The problem is that I am trying to convert all the words in this array into PIG LATIN: here is what my code looks like:

Make a new function

Function EnglishToPig(EngWord As String) As String
Dim strConvert As String
strConvert = EngWord

strConvert = Right(EngWord, Len(EngWord) - 1) & Left(EngWord, 1) & "ay"

If Left(EngWord, 1) = UCase(Left(EngWord, 1)) Then
strConvert = UCase(Left(strConvert, 1)) _
& LCase(Right(strConvert, Len(strConvert) - 1))
End If
EnglishToPig = strConvert
End Function


Save words into an array:

For i = 1 To Len(LineOfText)
If Mid$(LineOfText, i, 1) <> " " Then
ReDim Preserve MyString(Words)
Do Until Mid$(LineOfText, i, 1) = " " _
Or Mid$(LineOfText, i, 1) = "," Or Mid$(LineOfText, i, 1) = "." _
Or Mid$(LineOfText, i, 1) = ":" Or Mid$(LineOfText, i, 1) = "-" _
Or i > Len(LineOfText)
MyString(Words) = MyString(Words) & Mid$(LineOfText, i, 1)
i = i + 1
Words = Words + 1
End If
Next i


this is how i am trying to output it into another text field but it gives me an error.

ReDim Preserve MyString(0 To Words)
Dim temp As String

For i = 0 To Words
temp = temp & EnglishToPig(MyString())
Next i
txtmain2.Text = temp

PLEASE HELP!!!!!!!!!!

Any English Peeps That Can Help Me???
Okay im looking to buy vb6 in england, but i havent been able to find where to buy it or how much, and if you can get disconuts for being a student, can anyone help me with this, as i am still using vb5 learning edition :o( Also can someone please explain what the different verions of vb6 are, and what makes them different,

Using Chr() In English Win And Chinese Win
I found that I will get different result when I use in Eng. Windows and Chinese Windows:


in Eng. Windows, it display 200 and in Chinese Windows, it display 0?

Is it able to solve this problem? Or other then the function Chr(), did I have other function that can convert ASCII value to character which will not have the problem mentioned about?


Iam working in project in which data in Mdb is maintained in hindi , now iam looking for utility with which i can retrieve the data in English plz help.

English To Hindi
Hi friends,
I have got a problem! My boss has asked me to make a form where names written in english will be converted into names in hindi. For example my name in english "gautam" would be written in hindi. I know this has some thing to do with the Susha font. If some of u guys out there has already done it then please help.
bye and take care

Still For The Non English Character
i use chrw() to get those character out of range of 0-255.but in vb ,it display "?"instead of the char i want.i download add-ins(multilanguage).is it possible to solve this problem?


English Query With VB
Is anybody in this forum know how to connect English query in SQL Server with VB

Somebody said that there are samples with EQ which I couldn't find out.

How To Display Language Other Than English
I have created a COM-ADDIN to Word. There are several forms, in the form, there are many textbox.

When a user typed Chinese Word, or Japanese Word, all the characters have changed to "?". They can't be displayed properly. How can I allow the user type characters other than English? and how can i know they are not english and able to read them properly?

Thx a lot!

English-French Unistallation.
Please, I need the uninstallation messages of my Visual Basic application in French or English. The setup1.res file is not the answer, I tried... Could you send me your st6unst.exe file from your computer? Im thinking its the solution...
My Mail is:

<P ID="edit"><FONT class="small"><EM>Edited by jorgevisu on 03/28/01 02:34 AM.</EM></FONT></P>

Laguage Other Than English Not Supported
hi,i am using webbrowser control to navigate to some pages on web.and using its document property to to get document of visited page. using ihtmlelement property to get capture some text of webpage.

now i visit webpage which is in other language than English ,i did able to get those data from page but all come to me is just"?????????????" just a question mark.
so anyone tell me how to have those data in that language????????

i am able to see these data perfectly on webbrowser control.
is there any setting so that i can get those data in other language than language?

RTB Hebrew And English Get Mixed Up.
Hello Everybody,
Can you please tell me how can i use RTL Language And LTR Language together on a RTB?

if I use both Languages i get mixed sentances and it dosent look good.

USING RichTextBox1.TextRTF I CAN see it well
But USING RichTextBox1.Text - make it Mixed up.


Thank you all in advance,

Copyright 2005-08, All rights reserved