WPF C# string formatting for textbox

Posted on 2009-12-29
Last Modified: 2013-11-12
Hi Experts,

I have a WPF application with a WPF window with a textbox called


Right now the user enters a string into the textbox and then that string is converted to an integer before it's stored into the sql server database.

I am changing this textbox to have a user enter a value that is stored as varchar(50) datatype in sql server.

Below is the snippet that parses the textbox and converts the string entered to an integer.

Does anyone know how to change this snippet so instead of converting the string that is entered to an integer it changes it to:   varchar(50)  

The key part of the snippet is:     Int32.Parse

I tried to change that to:               string  

But that doesnt work.

Can anyone please help?
private List<Case> GetCaseList()


            List<Case> empList = null;

            AccessCases emp = new AccessCases();

            //converts the string representation of a number in a specificied style to

            //its 32bit signed integer equivalent

            empList = emp.GetCases(Int32.Parse(textBox1.Text));

            return empList;


Open in new window

Question by:maqskywalker
    LVL 13

    Expert Comment


    empList = emp.GetCases(Int32.Parse(textBox1.Text)).ToList();

    LVL 7

    Accepted Solution

    Question: AccessCases is some standard class? Do you have sources for it? If so, can you send as AccesCases class with method: GetCases ?

    Open in new window


    Featured Post

    How your wiki can always stay up-to-date

    Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
    - Increase transparency
    - Onboard new hires faster
    - Access from mobile/offline

    Join & Write a Comment

    A theme is a collection of property settings that allow you to define the look of pages and controls, and then apply the look consistently across pages in an application. Themes can be made up of a set of elements: skins, style sheets, images, and o…
    Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
    This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA.…
    Hi everyone! This is Experts Exchange customer support.  This quick video will show you how to change your primary email address.  If you have any questions, then please Write a Comment below!

    745 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

    16 Experts available now in Live!

    Get 1:1 Help Now