Error message in Convert.ToString
Error message in Convert.ToString
Error message in Convert.ToString
Error message in Convert.ToString
Error message in Convert.ToString
Error message in Convert.ToString Error message in Convert.ToString Error message in Convert.ToString Error message in Convert.ToString Error message in Convert.ToString Error message in Convert.ToString Error message in Convert.ToString Error message in Convert.ToString
Error message in Convert.ToString Error message in Convert.ToString
Error message in Convert.ToString
Go Back  Xtreme Visual Basic Talk > > > Error message in Convert.ToString


Reply
 
Thread Tools Display Modes
  #1  
Old 01-04-2010, 05:23 PM
Madsnipe Madsnipe is offline
Newcomer
 
Join Date: Jan 2010
Posts: 14
Default Error message in Convert.ToString


I think that my previous post wasn't what I should have been asking. I think my issue has to do with Convert.ToString in my code I have this 3 times, I have no errors while writing the code, only when I debug it I get the error message "input string was not in correct format"

Private Sub DisplayBill()

lblSlicesTotal.Text = Convert.ToString(numofSlice * Slicefee)

lblFriesTotal.Text = Convert.ToString(numofFries * Friesfee)

lblDrinksTotal.Text = Convert.ToString(numofFries * Drinksfee)
lblSubTotal.Text = GetGrandTotal().ToString()

End Sub
End Class

Shouldn't I have it as an Integer? I am not sure what is wrong with this code can anyone help me out please? Thank you in advance.
Reply With Quote
  #2  
Old 01-04-2010, 05:42 PM
AtmaWeapon's Avatar
AtmaWeaponError message in Convert.ToString AtmaWeapon is offline
Fabulous Florist

Forum Leader
* Guru *
 
Join Date: Feb 2004
Location: Austin, TX
Posts: 9,500
Default

What are the values for the input that raises the exception? What are the types of the variables involved? Which line throws the exception?
__________________
.NET Resources
My FAQ threads | Tutor's Corner | Code Library
I would bet money 2/3 of .NET questions are already answered in one of these three places.
Reply With Quote
  #3  
Old 01-04-2010, 05:56 PM
Iceplug's Avatar
IceplugError message in Convert.ToString Iceplug is offline
MetaCenturion

Retired Moderator
* Guru *
 
Join Date: Aug 2001
Location: Iowa, USA
Posts: 16,583
Default

In regards to this and the other, more detailed post,
Input String was not in a correct format is more associated with converting from a string rather than converting to a string.
Did you confirm that you had numeric text in all of the textboxes?
1 2 3 4 etc.
Otherwise, you'll get this error if the text cannot be converted to an integer
e.g. empty strings, words "cow" "nine" "dozen" "sparrow", can't be converted to an integer.

Also, why are you charging fees for fires in the other example?
__________________

Iceplug, USN
Quadrill 1 Quadrill 2 (full) Quadrill 3 JumpCross .NET Website is ALIVE! - DL Platform Tour for VB.NET! Posting Guidelines Hint: Specify your location in your user cp profile if you want compassion!
Reply With Quote
  #4  
Old 01-04-2010, 06:12 PM
Madsnipe Madsnipe is offline
Newcomer
 
Join Date: Jan 2010
Posts: 14
Default

Yes, I put numbers inside of the boxes but it still gives me that error, that is what my project is, it is for how many slices of pizza, fries, or drinks so it has to be an integer
Reply With Quote
  #5  
Old 01-05-2010, 10:11 AM
Iceplug's Avatar
IceplugError message in Convert.ToString Iceplug is offline
MetaCenturion

Retired Moderator
* Guru *
 
Join Date: Aug 2001
Location: Iowa, USA
Posts: 16,583
Default

Which line throws the exception?
__________________

Iceplug, USN
Quadrill 1 Quadrill 2 (full) Quadrill 3 JumpCross .NET Website is ALIVE! - DL Platform Tour for VB.NET! Posting Guidelines Hint: Specify your location in your user cp profile if you want compassion!
Reply With Quote
  #6  
Old 01-05-2010, 05:29 PM
snarfblam's Avatar
snarfblamError message in Convert.ToString snarfblam is offline
Senior Contributor

Forum Leader
* Expert *
 
Join Date: Apr 2005
Location: USA
Posts: 896
Default

Don't forget to mention the values of the variables when the exception is thrown. Also, do you have Option Strict On?
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
Error message in Convert.ToString
Error message in Convert.ToString
Error message in Convert.ToString Error message in Convert.ToString
Error message in Convert.ToString
Error message in Convert.ToString
Error message in Convert.ToString Error message in Convert.ToString Error message in Convert.ToString Error message in Convert.ToString Error message in Convert.ToString Error message in Convert.ToString Error message in Convert.ToString
Error message in Convert.ToString
Error message in Convert.ToString
 
Error message in Convert.ToString
Error message in Convert.ToString
 
-->