C
Christopher Ireland
Hi --
I'm not looking for a definitive solution here, just some pointers in the
right direction.
I have a very simple UserControl in an HTML page enclosed within <object>
tags virtually identical to this one:
http://www.devhood.com/tutorials/tutorial_details.aspx?tutorial_id=187
The only difference is that I have added a public method:
public void FromURL(string url) {
using (System.Net.WebClient w=new System.Net.WebClient()) {
MemoryStream m = new MemoryStream(w.DownloadData(url));
richTextBox1.LoadFile(m,
System.Windows.Forms.RichTextBoxStreamType.RichText);
}
}
and I call this method from an HTML button. Everthing works fine, the RTF
file is imported and displayed.
I now have a much more complex Windows control that inherits from the
System.Windows.Forms.Control class. Again, I embed this in an HTML page and
from an HTML button I call the following public method:
public void FromURL(string url)
{
using (System.Net.WebClient w=new System.Net.WebClient())
{
Load(new MemoryStream(w.DownloadData(url)));
}
}
The file I am importing here is one that has been created by the
serialisation of a number of properties of the control and the Load method
you can see deserialises this file. The problem is that running this method
gives me the following error:
Error: Exception has been thrown by the target of an invocation
Any ideas on how to debug this problem? Any ideas as to why one FromURL()
method should work and the other shouldn't?
Many thanks for any suggestions.
Chris.
I'm not looking for a definitive solution here, just some pointers in the
right direction.
I have a very simple UserControl in an HTML page enclosed within <object>
tags virtually identical to this one:
http://www.devhood.com/tutorials/tutorial_details.aspx?tutorial_id=187
The only difference is that I have added a public method:
public void FromURL(string url) {
using (System.Net.WebClient w=new System.Net.WebClient()) {
MemoryStream m = new MemoryStream(w.DownloadData(url));
richTextBox1.LoadFile(m,
System.Windows.Forms.RichTextBoxStreamType.RichText);
}
}
and I call this method from an HTML button. Everthing works fine, the RTF
file is imported and displayed.
I now have a much more complex Windows control that inherits from the
System.Windows.Forms.Control class. Again, I embed this in an HTML page and
from an HTML button I call the following public method:
public void FromURL(string url)
{
using (System.Net.WebClient w=new System.Net.WebClient())
{
Load(new MemoryStream(w.DownloadData(url)));
}
}
The file I am importing here is one that has been created by the
serialisation of a number of properties of the control and the Load method
you can see deserialises this file. The problem is that running this method
gives me the following error:
Error: Exception has been thrown by the target of an invocation
Any ideas on how to debug this problem? Any ideas as to why one FromURL()
method should work and the other shouldn't?
Many thanks for any suggestions.
Chris.