WPF C# string formatting for textbox

Hi Experts,

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

textBox1

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

LVL 1
maqskywalkerAsked:
Who is Participating?
 
DanSo1Connect With a Mentor Commented:
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

0
 
AshokCommented:
Try

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

HTH
Ashok
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.