[Resolved] What is wrong? Worked under VS 2003 but not in VS 2005
Hi, I get on the line
int count = int.Parse(listHeader[1]);
the following error. "Input string was not in a correct format."
Under Visual Studio 2003 I had no problem with it. Now I am using Visual Studio 2005 and Error. Why?
thanks in advance
VB Code:
/// <summary>
/// Get all mails form the pop3 server.
/// </summary>
/// <param name="body">
/// If set it returns mailheader and message.
/// </param>
/// <returns></returns>
public MailHeader[] GetMails(bool body)
{
string list = GetList();
if(list==null || list.Length==0 || !list.StartsWith("+OK"))
return null;
string[] param = list.Split('\n');
string[] listHeader = param[0].Split(' ');
int count = int.Parse(listHeader[1]);
MailHeader[] myHeader = new MailHeader[count];
for (int n=0;n<count;n++)
{
string[] msg = param[n+1].Split(' ');
myHeader[n] = GetMail(int.Parse(msg[0]),body);
}
return myHeader;
}
Added green "resolved" checkmark - Hack
Re: [Resolved] What is wrong? Worked under VS 2003 but not in VS 2005
I do not know why but it is one of the strange things in life you have to accept.
I changed
int count = int.Parse(listHeader[1]);
to
string scount = listHeader[1];
int count = int.Parse(scount);
and belive it or not it works -
WHY - who knows - I dont no.
Have a great 2006
Bongo