Wrox Programmer Forums
|
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 software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old December 1st, 2006, 11:54 AM
Registered User
 
Join Date: May 2005
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?






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





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.