I have a string array, have splitted the values and now I want to convert the array to an int array so I can use.

The code I have tried is listed below; the filename = file_01_3001

bascially I want to get values 01 into a int variable and the 3001 int another int variable.

            string[] sArray = fileName.Split('_');
            MessageBox.Show(sArray[1] + " " + sArray[2]);

           // int ledgerNumber ;
           //int.TryParse(sArray[1], out ledgerNumber) ;

           // int daybookNumber ;
           // int.TryParse(sArray[2], out daybookNumber);

            //int ledgerNumber;
            //ledgerNumber = Convert.ToInt32(sArray[1]);

            //int daybookNumber;
            //daybookNumber = Convert.ToInt32(sArray[2]);


                //MessageBox.Show(sArray[1] + " " + sArray[2]);
                MessageBox.Show(ledgerNumber + " " + daybookNumber);

            Dts.Variables["DaybookNumber"].Value = daybookNumber;
            Dts.Variables["LedgerNumber"].Value = ledgerNumber;


            MessageBox.Show(daybookNumber.ToString() + ":" + ledgerNumber.ToString());

Thanks

share|improve this question

33% accept rate
feedback

Know someone who can answer? Share a link to this question via email, Google+, Twitter, or Facebook.

Your Answer

 
or
required, but never shown
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.