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
ADVERTISEMENT
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
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
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
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
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
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
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
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
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
May 10, 2009
I'm trying to learn how to use procedures?
Public Function mgboc(ByVal mboc1 As String, ByVal mboc2 As String) As String
Return mboc1, mboc2
End Function
But it doesnt work. I want it to "return" the parameters, but it won't even compile.
View 2 Replies
Jan 12, 2010
Why we use CLR procedures. Is there any significance of CLR Procedures or any example where CLR Procedure is the only solution?
View 4 Replies
Jan 20, 2012
How can i call a procedure to calculate the cost of the suv and compact car mileage twice with that same procedure? Thats the only part i cant figure out with this function/procedure stuff. Also am i doing the procedures right?
Quote:
'Developer: John Nelson
'Date: Janurary 18 , 2012
'App Name: Compare Fuel Cost
[code]....
View 5 Replies
Feb 28, 2011
i have made some stored procedures for the first time and now i want to use them in vb.net code
'"Insert Procedure"
Sub InsertSettingz()
'Store the settings for the reports
[code]......
View 2 Replies
Nov 23, 2011
I have a function in my program that adjust sales for multiple days. Sometimes it needs to adjust up to 3 months and the tasks takes a while so I decided to split up the work between multiple threads. The way I have it working is say I need to adjust 3 months. I have the first thread adjust sales for the 1st month, the second thread adjust sales for the 2nd month and finally a third thread that will adjust sales for the 3rd month. Since all three threads are performing the same tasks except for different date range they use the same procedures. Within those procedures I make a call to the database to extract the sales for the given month. At some point it seems like the threads start to use the same SQL Data Objects because I am receiving the below error."There is already an open DataReader associated with this Command which must be closed first."Below is the first procedure that is ran by each thread up to the line where it errors out.
Private Sub Process_Adjustments(ByRef objAdjustBillCodeThreadParameters As clsAdjustBillCodeThreadParameters)
Dim cmd As SqlClient.SqlCommand
[code]....
So all three threads call this subroutine and the first thread does the data fill with no issues and then sometimes even the second thread does the data fill with no issue but then the third thread crashes and produces the above error. It seems as though the threads are sharing the same SQL Objects when all objects are local to the sub and I always thought each thread had it's own memory to work with. So I thought each thread would call the sub create it's own objects in memory, but that does not seem like what it's doing. I have other multithreading processes in my application that work perfectly fine, this is the first time I am attempting to multithread in this manner where I am using the same procedure within multiple threads.
Just thought of something that I might be doing wrong. The subroutine in question is in the same class where the threads are created. Should the subroutine be in it's own class, and therefore each instantiation of that class?
View 3 Replies
Feb 3, 2010
I created a subprocedure to change the background color of the selected matching labels in this concetration game. Now I want to change it back to silver when all the labels are selected I tried all the insertion points I could think of for a EndGame function but none have worked. I'm thinking I'm barking up the wrong tree.[code]
View 1 Replies
Feb 18, 2010
I've lived in the VB6 world for the last 15 years and am only now starting to learn .NET. I've got a long way to go, but I am hung up on a fundamental issue about collections.I live and die by collections in VB6; I use them for just about everything I do.So I am very used to having the abilities that the intrinsic VB6 Collection has.Things like adding items with keys, referencing items by key or index, having the "Add" method return an instance of the object, being able to add custom procedures to the collection, having it strongly typed, etc.But all of the collection information I have read about in .NET doesn't really do all of this.(I am starting out in VB.NET, with the possibility of moving to C# at a later time, so i am trying to stay away from the Microsoft.VisualBasic namespace.)
View 11 Replies
Jul 25, 2009
Some question about Ado.net and SQL Server stored procedures. We have a stored procedure in SQL Server as described below
Procedure dob.PendingCalls
@UsID As Char(10), @Sts As Integer OUTPUT , @Msg As VarChar(100) OUTPUT
AS
Begin
[code]....
we are using vb.net in visual studio 2003. Now if ExecuteNonQuery is used then we do not get rows. If ExecuteReader is used then we get rows [ with forward-only access which is of no use to us] but we cannot get output parameters values returned by stored procedure?
View 13 Replies
Nov 4, 2011
I have a Custom.ascx file that is used on a number of pages. Custom.ascx contains a couple of controls and a button called cmdCustomPageButton. When the user click on cmdCustomPageButton, cmdCustomPageButton executes a Protected Sub that gets some data from a database.
Page1.aspx that is using Custom.ascx has its own set of controls and procedures that it executes. It contains a button called cmdPage1Button and a procedure called RetriveData that is being called by other procedures as well within Page1.aspx. When cmdPage1Button is clicked it calls RetriveData. RetriveData is only applicable to Page1.aspx. Page2.aspx and Page3.aspx both has a procedure similar to RetriveData but is only relevant to its own page.
Try to explain using code:
Custom.ascx
Public Class Custom
Protected Sub cmdCustomPageButton_Click(Byval sender as Object, ByVal e as EventArgs) Handels
[CODE]..............
The question. How do I call the different RetriveData procedure form the relevant pages being it Page1, Page2 or Page3 when cmdCustomPageButton is clicked ?
View 2 Replies
Jun 3, 2011
Im currently working on a car service program on Visual Basic. The user simply selects some radio buttons, enters a couple of values and at the end the lablels are SubTotal, VAT and Total. Can anyone tell me how I calculate the VAT, the VAT rate I need to use is 20%. I currently have an appropiate answer for the Sub Total. I know I need to multiply the SubTotal amount by 0.2 but how do I do this using Procedures and Functions?
View 5 Replies
Jul 10, 2009
calling stored procedures using ADO.NET. We have an application developed, which uses SQL Sever as backend and Visual foxpro as front end. In this application every thing is done by database only. That is all insert, update, delete operations are done by SQL Server only. So we have to provide some input and output paramaters to stored procedures. Some time these procedure carry out insert, update, delete operations as well as return some data in the form of tables.
View 4 Replies
Dec 29, 2011
I have a block of related sub routines I would like to "group" together within class to make navigating a littel easier. When I say group, I mean achieve the same functionality of being able collapse and expand a block of code as would with single procedure or class. Two alternative ways I can think to accomplish this is either use a partial class for those procedures or use namespace. I just wanted to see if VS for VB.Net had another way to be able group and collapse blocks of procedures.
View 3 Replies
Jun 11, 2012
Am looking for a Currency Text Box control that will accept numeric key input and display entry as Currency according to Users Regional Settings.
Additionally, when an assignment is made such as Currencycontrol.text= 123.45 + 500 , user will see value displayed as $623.45 or formatted to regional specifications.
I do need a control rather than formatting procedures since my form could have 24 or more currency fields.
View 4 Replies
Nov 30, 2011
If I write many subs and functions in my code, the tools on the interface will stop responding to some of the subs and functions. What can I do about that?
View 1 Replies
Jul 26, 2010
The code below is right to execute more store procedures?
Dim mySQLCommand1 As New SqlCommand("sTruncate", myConn)
Dim mySQLCommand2 As New SqlCommand("sAddress", myConn)
Dim mySQLCommand3 As New SqlCommand("sProvider", myConn)
[code]....
View 1 Replies
Jun 9, 2010
I am new to LINQ and trying to learn it. I have a stored proc which returns XML Raw and I need to call this proc using VB.NET and LINQ...
View 3 Replies
Aug 6, 2009
I initially posted this in the wrong forum. I need help getting this to run properly. I'm trying to construct a fractions calculator. In order to complete it, I need to do it like this:Using Select Case statements, four Function procedures should be called based on the operation selected. Each Function procedure will calculate the correct operation and return the Decimal value to the calling procedure. The original procedure will print the result.
Now, the result should be calculated to the hundreths place and the input values should be validated by a Try-Catch Block.And of course, I've been having trouble with how to do this. I've attempted many times and this is what I have so far:
[Code]...
View 2 Replies
May 10, 2009
I just happened to be reading through a post and stumbled upon this and was curious. As I was remiss to go off topic in someone else's post, I've dragged it out here.What we are doing here is logically incorrect. We loop thru all the records and set the sheet locked state and button image. But since the button is just one element, so effectively the image set would be that of the last record.We need to separate the two procedures and the events they take effect too.Ideally we should set the sheet locked state while loading it. (maybe the form_load event etc.). And we should set the button image when we switch the sheets (e.g. sheet change/activate events). The selection of events however depends on your requirements and wisdom.
[code]...
I noticed how the image was accessed above. My question is this, what is the differences between the above method and Image = Image.FromFile(Path) and if any, what are the advantages/disadvantages of each? This is just for knowledge purpose and is not pertaining to any particular problem.
View 1 Replies
Mar 30, 2009
I want to call a Stored Procedure using SqlDataSource. I've been reading the library documentation of the classes but i'm getting slightly confused. To call a stored procedure, I understand that I have to change the selectcommandtype and then set the selectcommand property to the name of the procedure.
'Change command type to stored procedure
SqlDataSource1.SelectCommandType = SqlDataSourceCommandType.StoredProcedure
'set name of stored procedure
[code].....
View 5 Replies
Aug 28, 2009
For some reason my stored procedures are all executing twice! I have a static function that runs an SP given its name and the parameters and fills a datatable.
Public Shared Function RunSP(ByVal spName As String, ByRef spParams As Dictionary(Of String, String), ByRef pDataTable As DataTable) As Integer
Dim cmd As New SqlCommand
Dim lAdapter As SqlDataAdapter
[code]....
Is there something wrong with the code? I've checked with the debugger and the appropriate SPs are definitely only being called once, i.e. this function only runs once for a particular insertion function, but two things are inserted into the table.
View 2 Replies