Celsius To Fahrenheit Conversion With Loops

Mar 28, 2011

I've been looking at this code for about 3 days now and I can't seem to get what I did wrong. When I run it as a console application I get "0 : 32" a lot of times.

The purpose of this code is to start at 0 degrees Celsius and work our way up to 100 by 10's. IE:

0 degrees C = 32 degrees F
10 degrees C = 50 degrees F
etc.. too
100 degrees C = 212 degrees F

Module Module1

Sub Main()
'Program: Celsius to Fahrenheit Conversion
'Programmer: T

[CODE]...

View 2 Replies


ADVERTISEMENT

Fahrenheit To Celsius - Conversion From String "" To Type 'Single' Is Not Valid?

Feb 20, 2012

I have already completed most of the program and it works, except when there is no input in the Fahrenhiet or is left blank.I get the following exception: on this code: Inputsingle = CSng(TextBox1.Text).Conversion from string "" to type 'Single' is not valid.Here is my code:

'Project" Convert Tempertures

'Progammer: Cathy R. Hjelm

'Description: Convert Fahrenheit temperture to Centigrade Temperature using a convert button and output Text Box[code]....

View 14 Replies

.net - Run And Ask For Celsius Instead Of Fahrenheit?

Feb 1, 2011

This is what i have i need for it to run and ask for celsius instead of fahrenheit but it is not doing it..

[code]...

I am not understand this at all i am suppose also ask users to input a celsius degree for this part.its telling me i nedd to change formula to calculate the fahrenheit temp for this part.

View 3 Replies

How To Change Celsius To Fahrenheit

Jan 31, 2011

I am not quite understanding I am working with Microsoft Visual basic .Net programming and I Have this so far

Sub Main()
Dim fahrenheit, celsius As Double
Console.WriteLine("Enter a value for fahrenheit tempature:")

[code].....

View 2 Replies

Develop A Fahrenheit / Celsius Converter?

Mar 27, 2012

I've got this far with my interface and layout and buttons. I cannot figure out to do the functions for converting to and from celsius and fahrenheit.[code]...

View 2 Replies

VS 2008 Convert Celsius To Fahrenheit?

Apr 2, 2011

I've figured out the Variable declaration and coding to make it work:

Dim Celsius, Fahrenheit As Double
Try
Celsius = CDbl(txtCelsius.Text)

[Code]....

I'm gettting an "error": Option strict on dissallows implicit conversions from string to double? I have a textbox for celsius input that I want stored and converted into a label with the Convert Button Click Event.

View 6 Replies

TryParse Used In Function - Convert Celsius To Fahrenheit

Mar 28, 2010

I am creating a program that will convert Celsius to Fahrenheit and visa versa. The program must use a function to return the answer. I'm using a string function that will return either the temperature in Celsius or Fahrenheit or "Please enter a valid temperature" if anything but a number is entered. TryParse is used to check if the input is valid.

When using the TryParse method in the function I am trying to use a parameter to pass the variable that will store the converted data type value [Code] The line " If Double.TryParse(tempTextBox.Text, scale) Then " is supposed to check if the conversion is possible and if it is pass either F or C as a variable to the scale parameter. It seems to verify the conversion all right but it doesn't actually do the conversion. Why isn't doing the conversion? Both F and C remain 0. I can get it to work by using two more TryParse methods (one in each branch of the If else statement in the function), but I'd rather not do this.

View 8 Replies

How To Make Temperature (Celsius) Conversion Program

May 2, 2010

I'm new to visual basic and have decided to make a temperature conversion program. I've attached a screenshot to aid in my description. The program reads the temperatures on the left(from text boxes), converts them, and displays the answers on the right in text boxes. The program has a fever check at the bottom which displays whether or not the converted values are a fever.

I've managed to get this to work no problem, but I'm trying to get it so if the user enters the temperatures directly into the "result" textboxes, that the fever check still works. Unfortunately I'm having no luck, the fever check will only display a message if the values have been converted, not directly entered by the user. Here is the code I tried(fever.Text is what is displayed in a textbox above the fever check button):

Private Sub FeverCheck_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles FeverCheck.Click
'Turn string values entered into Decimal Values so they can be compared to decimal values
Dim fahrfever As Decimal
Dim Celsfever As Decimal
'The following two lines have problems when debugging
[Code] .....

View 3 Replies

Monthly Payment Calculation, For Loops To Do While Loops?

Oct 8, 2011

the purpose of the program is to display the monthly payments on the loan.My homework is to use do while loops instead of for loop.Here is the code for the for loop.

Option Explicit On
Option Strict On
Option Infer Off

[code].....

Now I'm having some trouble displaying the output using the do while loop, and I'm pretty sure it's a loop problem on my code. However, I cannot seemed to find out what's wrong. I looked at the examples of do while loop in my textbook, but I couldn't find anything useful to my problems of my program.This is the output for the do while loop.

Here's the do while loop code

Option Explicit On
Option Strict On
Option Infer Off

[code].....

View 3 Replies

Contain Functions(They All Have For Loops) Don't Work In For Loops?

Mar 6, 2011

When I use a For loop in a For loop the Contains Statement dosen't work! Even my custom one! I even tested mine and it works 100% And neither that or the String.Contains function work inside of For Loops And, I know both of them use loops to search through a string.

My function(It will atleast search once):

Function RealContains(ByVal load As String, ByVal needle As String) As Boolean
load = load.ToLower

[CODE].....................

View 10 Replies

Convert Centigrade To Fahrenheit?

Mar 24, 2010

The formula is F = 9/5C + 32 where F is Fahrenheit and C is centigrade temperature.I've this code but the result shows 32 no matter what I enter. How come?

Dim intTemp As Integer
Dim intResult As Integer
' calculation
intResult = (1.8 * intTemp) + 32

[code]....

View 10 Replies

Convert From Both Cecilius And Fahrenheit Using Two Sub Procedures?

Oct 22, 2009

The lesson exercise is to convert from both Cecilius and Fahrenheit using two sub procedures. I thought I had this one in the bag..seemed pretty easy when I was doing it but my calculations are always 0..

This includes two radio buttons one for F and one for C the tempature text box and the results lbl along with two buttons, convert and exit. (see attached screen clipping)

Option Explicit On
Option Strict On
Option Infer Off

[Code].....

View 2 Replies

Make A Temperature Converter That When Fahrenheit Is Entered Into Textbox1?

Mar 3, 2009

I am working on a school project to make a temperature converter that when fahrenheit is entered into textbox1 and then tabbed, the conversion to celsius, rankine, and kelvin is displayed in textbox 2,3, and 4.My instructor showed me how to input the code for this, but it isn't working correctly. I know I need more code to get this right but I am a newbie to programming and my instructor doesn't insruct very well. Can someone please tell me what I need to do to finish this coding? This is what I have so far:
Public Class Form1

[Code]...

View 2 Replies

Conversion Error On Line 5 Stating 'Conversion From String 'S' To Type 'Double' Is Not Valid

Apr 8, 2009

a user will enter a number, n, which ranges from 1 to 30. they will also enter a "P" or an "S" (sum or product). depending on which was selected, it will calculate the sum or product of the numbers from 1 to n.i'm having a conversion error on line 5 stating "Conversion from string "S" to type 'Double' is not valid." [code]

View 2 Replies

Text -> Excel Conversion (with Extensive Formatting Required After Conversion)?

May 11, 2012

I'm creating a program in VB.net that does the following:At a high level I receive a file in email, put the attachment in a monitored folder, import the text file to excel, format the excel, and then email the excel file to a list of recipients.

Here is my plan:

Completed: Outlook VBA to monitor all incoming email for specific message. Once message is received drop attached .txt file in a specific network folder.

Completed: (VB.net) Monitor folder, when text file is added begin processing

Not Complete: (VB.net) Import text file to Excel

Not Complete: (VB.net) Format Excel Text file.(add in a row of data,format column headers with color/size, add some blank columns, add data validation to some of the blank columns that allow drop down selections)

Completed: (VB.net) Save file.

Completed: (VB.net) Send file to list of recipients.

Obviously the items above that are not complete are the bulk of the work, but I wanted to get some advice on what some of you think would be the best way to approach something like this. The import and formatting of the file are causing me some problems because I just can't decide what would be the most efficient way to do this.

The way stated above. Import to excel -> format Having a template excel that contains all of the formatting already done for me and attempting to transition the data to this document (no clue if/how I can do this). Is it even feasible? Have the template already created and then import the text file to a new excel file, then transition that data to the excel template?

Something I thought about, in terms of formatting the document, was to record a macro of me doing all of the formatting that I'm going to need and then attempt to convert that macro into my vb.net code, but I'm not sure if that will work. I will need to verify that the text file comes in the EXACT format every time correct?

View 5 Replies

Java Conversion To .net Conversion Errors

Aug 31, 2009

Here's 2 questions that I hope someone can help me on. This is in VB.net. I keep on getting this error 'java.io.bufferedInputstream.count is not accessible in this context because it is 'Protected Friend'. Does anyone know how to fix this error?

The other errors i get are "Overload resolution failed because no accessible 'Val' accepts this number of arguments". I have listed below the code that I have coverted from Java. Where is my mistake?'the underlined areas are where it is giving me errors.

[Code]...i

View 7 Replies

For Loops In VB?

Nov 24, 2011

I have a 5 by 5 matrix I want to populate and I would like to simplify this into for loops. As I understand, I would need 2 for loops to complete this task?

Dim x(4, 4) As Char
x(0, 0) = Mid(key, 1, 1)
x(0, 1) = Mid(key, 2, 1)
x(0, 2) = Mid(key, 3, 1)

[code]....

View 1 Replies

Use Loops In .NET?

Apr 23, 2012

EDIT:I have a ItemList : Dim ItemList As New List(Of String)I wanna append each element from itemlist to a new list for 10 times each, then to start over again.How can I make a loop for each element while there are still elements in the list (10 times each)?I tried this but it's not working.

Private crt As Integer = 0
Private limit As Integer = 0
Private Function getline() As String
Dim line As String = ""

[code]....

but I didn't know where to add the 10 times limit and also the current item number(crt)

View 1 Replies

Doing Loops In .net Using Regexs?

Mar 30, 2012

I'm writing a super small interpreter in vb.net because i need to execute a simple (invented) language so the app understand it and do what ever it needs to do.Everything went well until i reached the control structures and the loops.So my question its, in a code that its executed line by line using a simple for each how can i match the "WHILE ;" AND "ENDWHILE;" and execute the code within it?

The first thing that came to my mind its kind of flag the line of the reader and read the content from that line until find "ENDWHILE;" and the store that to execute late, so keep isolating the code in parts until I've all parts and then execute it.But i'm not so sure how to code it or if my reasoning its correct.PD: I'm using regexs.

View 1 Replies

For Each In Combobox - Loops Twice

Mar 22, 2011

I did For each Loop in my combobox, but I noticed that it loops twice. When it reaches the last item, it loops back to the first item. I code it typically: For each itm As Object in combobox.Items

[Code]....

View 5 Replies

For..Next Loops VB 2008?

Dec 7, 2009

have a problem where I have an application that allows someone to enter two integers. The app then displays all the odd numbers between both integers and all of the even numbers between both integers. There are two text boxes and two labels: even and odd. How would I code a For..Next loop for this type of app. The part where I get confused is what do I determine and how do I

View 18 Replies

How To Simplify Loops

Dec 5, 2011

I would like to simplify a do loop.

View 1 Replies

Looping Through Loops In XML?

Mar 24, 2010

This is for .net frameworke 3.5 and visual studio 2008 in VB.Net.Two things we would like to do: 1) loop repeating node blocks 2) loop (through repeating node blocks) within repeating node block loop
First thing:

How do you loop through an xml that has repeating node block (<STRUS name="1000A") and extract the following node? For example you want to extract the IdentificationCode in the node that has <SVALU name="ZRT" and is from pos="9".So, the following example has the IdentificationCodes (TGJ23, PGA12, TPX12)

<?xml version="1.0" encoding="UTF-8"?>
<DocSplitterReport xmlns:xsi="http://www.w3.org/2001/X .......
<STRUS name="ROOT" lineStart="-1" lineEnd="-1">
<STRUS name="TAC" lineStart="1" lineEnd="194">
<SVALUs>

[Code]...

View 9 Replies

Merge Two For Loops Into One?

Jun 27, 2009

Is it possible to merge two For Loops into one? I need this because I am using two for loops (1 to 100,000) to work with the data in a collection. The problem with this code is that it takes more than two hours two finish:

[Code]...

View 1 Replies

More Efficient For Each Loops?

Jul 26, 2011

Is there a more efficient way of doing this code?

For Each row As DataRow In dt.Rows
Dim ts1 As String = row(0).ToString
For index As Integer = 1 To 9[code]....

View 2 Replies

Using Names In Loops?

Sep 30, 2011

Im somewhat new to VB, my first time writing a mildly long program... have a program that will create an unknown number of textboxes, then later I will need it to manipulate those textboxes. I set it up so it names them txt1, txt2, txt3 etc..How can I write a loop that will refer to each of these textboxes by name so I can do what I need with them, ie for example in

For i =1 to x
txti.text = i
next

this would make no sense...how do i write the names correctly so the computer can understate and loop them as txt1, txt2,...?

View 3 Replies

Calculating From Multiple Txt Using Loops?

Oct 17, 2011

Basically I have 4 empty textboxes. I need to calculate the total and averages of the numbers entered in them. So far, I've declared 4 variables and made it equal to the text that was input by the user. I'm stuck with the calculations tough. The user doesn't have to use all 4 boxes. So if he/she only entered 2 numbers, the total is divided by 2, not by 4 for the average. I think I'm supposed to use a for... next loop because the maximum iterations I should do is 4, but I'm not sure how to the code even if it is supposed to use a for loop. Otherwise, the rest of my project seems to work fine.

View 5 Replies

Cinema Tickets Using Loops?

Mar 19, 2012

im new to this site and also a beginner on visual basic During form load, the number items required in the Adult ticket and Child ticket CBO's must be populated with code using a single For Loop.The Items Collection in Design mode must not be used to populate these CBO's1. Movie ticket prices, taxes, and fees are as follows:a. Adult Matinee - $9.25

[Code]...

View 19 Replies

Euclid's Algorithm And While Loops

Mar 17, 2011

I have visual studio 2008, and we have been given specific tasks to carry our for our course, we have been asked to implement euclid's algorithm by using a while loop, doing so without the visual part of visual basic whatever that means an example of a question they gave was 1)HCF(88,26)=2 how I would go about doing this, as I am thoroughly confused, and deadlines are fast approaching.

View 3 Replies

Factorial Calculations Using Loops?

Jul 17, 2010

Trying to figure out how to calculate factorials via loops. Cant seem to figure out where to start when using loops.

View 9 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved