473,322 Members | 1,379 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

Conversion from string "" to type 'Integer' is not valid.

I know this question has been addressed, however none of the suggested fixes are resolving the issue.

This one causes the error (initial value of txtPoint.Text is 35):
Expand|Select|Wrap|Line Numbers
  1.  
  2. Private Sub nudPoints_ValueChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles nudPoints.ValueChanged
  3.        Dim points As Integer = CInt(txtPoint.Text) + nudPoints.Value + nudMiscPoints.Value
  4.       txtPointsTotal.Text = points
  5.   End Sub
  6.  
  7.  
  8. This one works fine (initial value of txtAppraise.Text is 0):
  9.  
  10. Private Sub nudMiscAppraise_ValueChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles nudMiscAppraise.ValueChanged
  11.     Dim total As Integer = CInt(txtAppraise.Text) + nudAppraise.Value + nudMiscAppraise.Value
  12.     txtAppraiseTotal.Text = total
  13.   End Sub
  14.  
Neither have any trailing spaces, special characters, or letters. I have tried scrapping the problematic Sub and rebuilding it using different variables and it still generates the error. My limited training has got me at a loss. Any help would be greatly appreciated.
Dec 10 '09 #1
4 4799
Plater
7,872 Expert 4TB
Use Integer.Parse() instead of the old VB methods
Dec 15 '09 #2
Frinavale
9,735 Expert Mod 8TB
Better yet, try using the Integer.TryParse() method.

-Frinny
Dec 15 '09 #3
Expand|Select|Wrap|Line Numbers
  1. Private Sub nudPoints_ValueChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles nudPoints.ValueChanged
  2. Dim points As Integer = Int32.Parse(txtPoint.Text) + nudPoints.Value + nudMiscPoints.Value
  3. txtPointsTotal.Text = points
  4. End Sub
Jun 6 '10 #4
Frinavale
9,735 Expert Mod 8TB
CsharpChico, what is your code supposed to be showing us?

Right now, if you try to run the code you will get a warning (maybe an error if your Visual Studio's settings are high enough) because you are trying to assign an integer to a Text property (which expects a string).

-Frinny
Jun 7 '10 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: David P. Donahue | last post by:
I'm using C# to create an ASP .NET website backed by a MySQL database. One of the things I do often on the site is populate a DataList by binding it to a DataSet pulled from the database. However,...
9
by: Visual Systems AB \(Martin Arvidsson\) | last post by:
Hi! Is it possible to alter the string type? Basicly what i want to do is to create my own string type. lets call it sqlString, when i use this it will always use replace on the string...
2
by: zhengfish | last post by:
HI,all I have a class named CCC which have some members of std::string type. I declare a class pointer like this: CCC* ccc = new CCC( xml_input ); then I send the ccc to another module with...
3
by: Alex K. | last post by:
Hi all I need a string type with only three possible values: let's say "A", "B", "C". In other words, I need something like enum but of string type: enum MyStrings { sA = "A", sB = "B", sC...
4
by: thomas.pohl | last post by:
Hi, let's assume you want to nicely print the content of a list except for one (or some) individual item. You could do it like this: t = print("text: %s\nvalues: %i %i %i" % (t, t, t, t)) ...
1
by: Mike | last post by:
Hi, I'm passing a JSON-encoded string to json_decode() and am expecting its output to be an object type, but am getting a string type instead. How can I return an object? In the docs, the...
1
by: mathewgk80 | last post by:
Hi all, I would like to convert dataset type to string type... i am using asp.net,c#.net and sql server.. Please help me. Regards, Mathew
1
by: kenneth6 | last post by:
ctype.h: toupper(c), tolower(c): change case of char isalphanum(c), isalpha(c), isdigit(c), ispunct(c), isspace(c), iscntrl(c), islower(c), isupper(c): boolean checks on type of char i know...
1
by: kenneth6 | last post by:
I am writing sth about data in string type in console mode. now, I transform it to Windows Form Application, i know managed type should be used here instead of the unmanaged type. should I change...
6
by: SchoolOfLife | last post by:
Does an object in C++ of std::string type terminates with null character? The charater string literals in C++ (to maintain backward compatibility with C) end with a null character. Is this same with...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.