[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

microsoft.public.dotnet.framework.aspnet.buildingcontrols

ArgumentOutOfRangeException was unhandle by user code

bthumber

6/21/2010 11:04:00 PM

Specifed argument was out of range of valid values. Parameter name: i

Please my code:

Specified argement was out of range of valid values. Parameter name i:

That was my error please see the code below:

view plaincopy to clipboardprint?
if (FileUpload1.HasFile)
{
string filepath = FileUpload1.PostFile.FileName;
string pat = @"\\(?:.+) \\ (.+) \. (.+)";
Regex r = new Regex(pat);

// run

Match m = r.Match(filepath);
string file_ext = m.Group[2].Captures[0].ToString(); // error on this
line
string filename = m.Group[1].Captures[0].ToString();
string file = filename + "." + file_ext;
}

if (FileUpload1.HasFile)
{
string filepath = FileUpload1.PostFile.FileName;
string pat = @"\\(?:.+) \\ (.+) \. (.+)";
Regex r = new Regex(pat);

// run

Match m = r.Match(filepath);
string file_ext = m.Group[2].Captures[0].ToString(); // error on this line
string filename = m.Group[1].Captures[0].ToString();
string file = filename + "." + file_ext;
}
What is causing the error and how do I fix it?