Hey all,
Im stumped at this seemingly easy task. I need to ask a user for a file name. thats it. But im getting the above error.
here is the code: (Where UserInput is a basic form with 2 buttons and a text box)
UserInput ui = new UserInput();
ui.Parent = this;
if (ui.ShowDialog() == DialogResult.OK) <-- ERROR HERE
{
fileName = ui.FileName;
FileStream fs = new FileStream(filePath + "\\" + fileName, FileMode.Create);
XmlTextWriter xtw = new XmlTextWriter(fs, System.Text.Encoding.Unicode);
xtw.WriteProcessingInstruction("xml", "version=\"1.0\"");
xtw.WriteProcessingInstruction("xml-stylesheet", "type='text/xsl' href='conditionReport.xslt'");
_writeSet.WriteXml(xtw);
xtw.Close();
fs.Close();
//display success message
MessageBox.Show("File Successfully Extracted as " + fileName);
}
else
{
MessageBox.Show("Export Cancelled");
}
any ideas

getting error "value does not fall within the expected range" on pocket PC 2003 emu
fwyattblake
GlennGraham
I thought that I was telling the form the its parent was the calling form, not the other way around, hope this makes sense
Binnerup
No, no. That's not what I'm asking. The reason for the error itself is rather clear. < xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />
The question is: you though the problematic line was the next one as indicated in your first post:
----------------
ui.Parent = this;
if (ui.ShowDialog() == DialogResult.OK) <-- ERROR HERE
---------------
In fact, error was in the line above it. Why did you believe the problem was in a wrong line VS should pop up a big box stating the problem on the line what caused it. Was this error box pointing to the line your initially indicated and not to the problematic line above it
dundask
Thats my understanding
ZoranPecenovic
No, you can not step into ShowDialog(), but you can set up break points in events in your form. < xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />
By the way, what's the reason you believed problem happened in the next line, not in the line with actual issue Which version if VS are you using, 2003 or 2005
Muhammad Rizwan
Most likely it's something you do in this form. Consider stepping into with debugger.< xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />
YnottonY