HighTechTalks DotNet Forums  

ArgumentOutOfRangeException was unhandle by user code

ASP.net Building Controls microsoft.public.dotnet.framework.aspnet.buildingcontrols


Discuss ArgumentOutOfRangeException was unhandle by user code in the ASP.net Building Controls forum.



Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old   
bthumber
 
Posts: n/a

Default ArgumentOutOfRangeException was unhandle by user code - 06-21-2010 , 06:04 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?

Reply With Quote
Reply




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.