Click here to Skip to main content
15,900,816 members
Home / Discussions / C#
   

C#

 
AnswerRe: Using open office in .net Pin
Rajesh R Subramanian7-May-09 0:34
professionalRajesh R Subramanian7-May-09 0:34 
QuestionSolving vehicle routing problem in .NET (C#) Pin
Andisheh_K6-May-09 19:49
Andisheh_K6-May-09 19:49 
QuestionRe: Solving vehicle routing problem in .NET (C#) Pin
Andisheh_K9-May-09 1:39
Andisheh_K9-May-09 1:39 
Questionconvert.ToInt32 Pin
yueru6-May-09 18:57
yueru6-May-09 18:57 
AnswerRe: convert.ToInt32 Pin
dotnetmember6-May-09 19:54
dotnetmember6-May-09 19:54 
GeneralRe: convert.ToInt32 Pin
battulga_dddddd6-May-09 20:42
battulga_dddddd6-May-09 20:42 
AnswerRe: convert.ToInt32 Pin
Spunky Coder6-May-09 19:55
Spunky Coder6-May-09 19:55 
AnswerRe: convert.ToInt32 Pin
tolw6-May-09 19:58
tolw6-May-09 19:58 
The quick answer:
int s = Convert.ToInt32(Duration.Substring(1, 1));

Why?
Try changing your code to this:
String line = "==XXXT08746=05/01/09 15:13 112        4                      IT  0:01'22     0 #2   ";
string Duration = line.Substring(64, 9).Replace("#", "[#]");
string a = Duration.Substring(1, 2);
string b = Duration.Substring(3, 2);
string c = Duration.Substring(6, 2);
int s = Convert.ToInt32(a);
int y = Convert.ToInt32(b);
int l = Convert.ToInt32(c);
int NDura = s + y + l;

You will discover that duration equals " 0:01'22 " and so the string you are trying to parse is "0:" - thats why you keep getting the error.

Also this line:
string Duration = line.Substring(64, 9).Replace("#", "[#]");

Is kind of wierd as the Replace has no effect - as I mentioned Duration == " 0:01'22 ". No "#" there...
GeneralRe: convert.ToInt32 Pin
yueru6-May-09 21:20
yueru6-May-09 21:20 
GeneralRe: convert.ToInt32 Pin
Guffa6-May-09 21:47
Guffa6-May-09 21:47 
GeneralRe: convert.ToInt32 Pin
yueru6-May-09 22:05
yueru6-May-09 22:05 
GeneralRe: convert.ToInt32 Pin
Guffa7-May-09 0:49
Guffa7-May-09 0:49 
Questioncatch an object returned by java webservice in c# application. Pin
prasadbuddhika6-May-09 17:39
prasadbuddhika6-May-09 17:39 
AnswerRe: catch an object returned by java webservice in c# application. Pin
Spunky Coder6-May-09 20:00
Spunky Coder6-May-09 20:00 
QuestionBackup Program Pin
nsimbu6-May-09 14:08
nsimbu6-May-09 14:08 
QuestionListView Pin
al3xutzu006-May-09 12:26
al3xutzu006-May-09 12:26 
AnswerRe: ListView Pin
Henry Minute6-May-09 13:37
Henry Minute6-May-09 13:37 
AnswerRe: ListView Pin
Roberto Ho6-May-09 13:50
Roberto Ho6-May-09 13:50 
AnswerRe: ListView Pin
nsimbu6-May-09 13:51
nsimbu6-May-09 13:51 
QuestionConvert .Net datatype to Mysql datatype Pin
student19886-May-09 12:14
student19886-May-09 12:14 
AnswerRe: Convert .Net datatype to Mysql datatype Pin
Colin Angus Mackay6-May-09 12:21
Colin Angus Mackay6-May-09 12:21 
GeneralRe: Convert .Net datatype to Mysql datatype Pin
student19886-May-09 12:37
student19886-May-09 12:37 
GeneralRe: Convert .Net datatype to Mysql datatype Pin
Colin Angus Mackay6-May-09 12:47
Colin Angus Mackay6-May-09 12:47 
GeneralRe: Convert .Net datatype to Mysql datatype Pin
student19886-May-09 13:01
student19886-May-09 13:01 
GeneralRe: Convert .Net datatype to Mysql datatype Pin
Luc Pattyn6-May-09 13:09
sitebuilderLuc Pattyn6-May-09 13:09 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.