[Webinar] Streamline your web hosting managementRegister Today

x
?
Solved

convert Hundredths of a Pound to oz - pounds.oz (vb.net-2008-windows form)

Posted on 2010-03-28
7
Medium Priority
?
4,768 Views
Last Modified: 2012-08-13
i need to convert Hundredths of a Pound to oz and oz to pounds.oz
anyone know how to do this in vb.net(2008) on a windows form please

i got this chart from a microwave manual if you can believe that. but i dont know enough about math to make a formula or know how in vb.net to do this

thank you in advance for any code or help you may provide


Ounces
0
1-2
3-4
5
6-7
8
9-10
11-12
13
14-15
Tenths of
a Pound
0.0
0.1
0.2
0.3
0.4
0.5
0.6
0.7
0.8
0.9
Hundredths of
a Pound
.96 - .05
.06 - .15
.16 - .25
.26 - .35
.36 - .45
.46 - .55
.56 - .65
.66 - .75
.76 - .85
.86 - .95
0
Comment
Question by:Johnny
7 Comments
 
LVL 30

Accepted Solution

by:
Alexandre Simões earned 1200 total points
ID: 28895571
Hi,
1 pound = 16 ounces

so based on this relation you can do everything you need.

oz = p * 16
p = oz / 16

ex: convert 5 pounds to ounces.
oz = 5 * 16
oz = 80     this means that 5 pounds equal 80 ounces.
0
 
LVL 10

Assisted Solution

by:RohitBagchi
RohitBagchi earned 400 total points
ID: 28896436
Adding to AlexCode's correct formula, divide the result by 100 when you are working with hundredths of a pound, obviously.

If you are looking for the actual code, here is a link to get you going : http://www.dreamincode.net/forums/index.php?showtopic=121316

Cheers.
RB.
0
 

Author Comment

by:Johnny
ID: 28898944
20 = 3.2 oz
(20/100) = 0.2
0.2*16 = 3.2 oz

if i read this right then it would be
            Try         ' read PackageDimensions.Weight
                Result_Box.AppendText("PackageDimensions.Weight: " & item.ItemAttributes.PackageDimensions.Weight.Value & vbCrLf)
                '20 = 3.2 oz | (20/100) = 0.2 | 0.2*16 = 3.2 oz
                Dim b_Weight As Integer = FormatNumber(CStr(CDbl(((item.ItemAttributes.PackageDimensions.Weight.Value) / 100) * 16)), 2)
                Result_Box.AppendText("PackageDimensions.Weight - OZ: " & b_Weight.ToString & vbCrLf)
            Catch ex As Exception
                textboxauth.Text = "Error reading PackageDimensions.Weight: " & ex.ToString()
            End Try

but its not doing 3.2 its returning 3
any ideas on how to fix please?


0
Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

 
LVL 83

Assisted Solution

by:CodeCruiser
CodeCruiser earned 400 total points
ID: 28899454
Its being rounded to int instead of decimal.

Change this

Dim b_Weight As Integer

to

Dim b_Weight As Decimal
0
 

Author Closing Comment

by:Johnny
ID: 31708074
thank you all of you for the help
0
 

Author Comment

by:Johnny
ID: 28900164
works now thank you all for the help
now to get the inches right now too for the dimensions (ugh yet another post/question)
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This tutorial demonstrates one way to create an application that runs without any Forms but still has a GUI presence via an Icon in the System Tray. The magic lies in Inheriting from the ApplicationContext Class and passing that to Application.Ru…
Introduction When many people think of the WebBrowser (http://msdn.microsoft.com/en-us/library/2te2y1x6%28v=VS.85%29.aspx) control, they immediately think of a control which allows the viewing and navigation of web pages. While this is true, it's a…
There may be issues when you are trying to access Outlook or send & receive emails or due to Outlook crash which leads to corrupt or damaged PST file. To eliminate the corruption from your PST file, you need to repair the corrupt Outlook PST file. U…
Stellar Phoenix SQL Database Repair software easily fixes the suspect mode issue of SQL Server database. It is a simple process to bring the database from suspect mode to normal mode. Check out the video and fix the SQL database suspect mode problem.
Suggested Courses

611 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question