The best overloaded method match for 'int.TryParse(string, out int)' has some invalid arguments

Posted on 2009-02-08
Last Modified: 2013-12-17
I am trying to convert an interger to a string but keep getting this error message.  Can someone point out what I am missing.
string myStr;

                        string mySSN;

                        mySSN = patient.u.ssn;


                        if (Int32.TryParse(mySSN, out myStr))



                            patient.u.ssn = myStr;




                            // Failed! MyStr is not defined.


Open in new window

Question by:kwh3856
    LVL 41

    Accepted Solution

    First thing:
    The method is : Int32.TryParse Method (String, Int32)
    but your parameter are mySSN  and myStr are both String.

    Secondly when you say "I am trying to convert an interger to a string" not sure what you are trying to do...but you can convert an integer to String using ToString() method:

    e.g. String mySSN = patient.u.ssn.ToString();

    Author Closing Comment

    guru sami,
    Thank you for your response.  What I realized is that I really needed to change the type of the field in the database to varchar which makes it a string also.  Therefore I do not need to covert the SSN anymore.  Again, thank you for your response.

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    What Should I Do With This Threat Intelligence?

    Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

    Creating an analog clock UserControl seems fairly straight forward.  It is, after all, essentially just a circle with several lines in it!  Two common approaches for rendering an analog clock typically involve either manually calculating points with…
    Today I had a very interesting conundrum that had to get solved quickly. Needless to say, it wasn't resolved quickly because when we needed it we were very rushed, but as soon as the conference call was over and I took a step back I saw the correct …
    This video discusses moving either the default database or any database to a new volume.
    Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

    761 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    9 Experts available now in Live!

    Get 1:1 Help Now