Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Visual Basic > VB 2005 > Visual Basic 2005 Basics
Password Reminder
Register
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
Visual Basic 2005 Basics If you are new to Visual Basic programming with version 2005, this is the place to start your questions. For questions about the book: Beginning Visual Basic 2005 by Thearon Willis and Bryan Newsome, ISBN: 0-7645-7401-9 please, use this forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Visual Basic 2005 Basics section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old December 1st, 2006, 11:54 AM
Registered User
 
Join Date: May 2005
Location: , , .
Posts: 9
Thanks: 1
Thanked 0 Times in 0 Posts
Default TryParse issues

I'm trying to use a TryParse to convert a text value to an integer value. When I attempt to run a calculation, the variable that my calculation function recieves is always -1 regardless of the actual number being passed. I've run message boxes both before the calculation and during and receive two different numbers. The numbers before the calculation are correct.

This is an example of the calculation function:

Code:
Private Function SetTotal(ByVal pRanks As Integer, ByVal pMisc As Integer, ByVal pGroup As Integer)

    Dim total As Integer

    total = pRanks + pMisc + pGroup

    Return total

End Function
The sub that is using the calculation looks like this:

Code:
Private Sub txtAppraiseRanks_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtAppraiseRanks.TextChanged

        Integer.TryParse(txtAppraiseRanks.Text, zeroRank)
        Integer.TryParse(txtAppraiseMisc.Text, zeroMisc)

        txtAppraiseTotal.Text = SetSkillTotal(zeroRank, zeroMisc, groupMod).ToString

End Sub
I've tried placing the TryParse within the function call as well with the same results. The only variable that passes correctly is groupMod. That one is set in another section of the program.

Any suggestion or reasoning as to why this is happening?

Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
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
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
connection string issues, web.config file issues kaliaparijat ASP.NET 2.0 Professional 1 June 12th, 2008 08:07 AM
IE Issues iPagan BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 3 April 1st, 2007 04:11 AM
Still Having Issues slas7713 BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 9 October 27th, 2006 02:59 PM
Issues with xp_cmdshell ninel SQL Server 2000 1 August 26th, 2006 09:39 AM
For-each issues hiskeyd XSLT 1 February 27th, 2006 08:01 PM



All times are GMT -4. The time now is 05:29 PM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.