|
This appears to be the THIRD time you have asked this question. This first time you received no replies. The second time you received a messsage to say that "your method for asking for help probably isn't the most effective."
I should point out that if you have a question regarding an article (http://www.codeproject.com/dotnet/CSharpWhiteboard.asp[^]) you should ask in the forum of the article. You have not done this.
Secondly, your question ("how to finish it???") requires and answer that will be very time consuming to answer fully. However, a brief look at the article would suggest that it IS finished as the original author only intended to write a 2 person whiteboard.
My: Blog | Photos | Next SQL Presentation
WDevs.com - Open Source Code Hosting, Blogs, FTP, Mail and More
|
|
|
|
|
|
Please post some sample code to which you are referring. Based on what's in the article, I don't understand the context of your question. The exception simply means that the URL is invalid (like "http:domain.com" is invalid) and file:// URLs are typically supported in most cases in the .NET Framework.
However, if you're trying to replace characters in an HTML file that is not XML (and most HTML files on the web are not well-formed and are not XML), then you'll need an SGML parser (SGML is the parent language for both HTML and XML). Use the SgmlReader[^] on GotDotNet, which is a very popular library for reading HTML files and even transcoding to XML (XHTML).
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Customer Product-lifecycle Experience
Microsoft
[My Articles] [My Blog]
|
|
|
|
|
i am trying to use following code given on MS site
http://support.microsoft.com/default.aspx?scid=kb;en-us;316063[^]
string filepath = "C:\\Customers.xml";
private void ReplaceSpecialChars(long linenumber)
{
System.IO.StreamReader strm;
string strline;
string strreplace = " ";
string tempfile = "C:\\Temp.xml";
try
{
System.IO.File.Copy(filepath,tempfile,true);
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
StreamWriter strmwriter = new StreamWriter(filepath);
instead of giving local file path,i am giving the URL
http://127.0.0.1/file.asp?s=adnan&f=xml[^]
when someone access this URL it gives XML output,i want to parse this output and replace special characters with acceptable characters by XML,forInstance i got a character < in XML and its giving parsing error,i found above mentioned solution by MS and tried ti implement it but it`s working fine for local files but not http URLs
Thanks for your reply
MyBlogs
http://weblogs.com.pk/kadnan
|
|
|
|
|
File.Copy does not accept URLs. To download a file via HTTP (or practically any protocol, so long as a pluggable protocol handler is installed for it) you must use the HttpWebRequest and HttpWebResponse classes, or simply use the WebClient class which encapsulates the former two classes. Read the documentation[^] for HttpWebRequest.GetResponse for an example of the former two classes, and the documentation[^] for WebClient.DownloadFile for example of the latter.
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Customer Product-lifecycle Experience
Microsoft
[My Articles] [My Blog]
|
|
|
|
|
I'm learning how to use C# collections. Can't seem to find the answer on this one, though...
<br />
namespace myNameSpace<br />
{<br />
class ClassA<br />
{<br />
private string key;<br />
private string name;<br />
<br />
}<br />
<br />
class ClassB<br />
{<br />
private HashTable myHashTable;<br />
<br />
myFunction(string key, string name)<br />
{<br />
myHashTable = new HashTable();<br />
ClassA TempClassA = new ClassA(key, name);<br />
myHashTable.Add(TempClassA.key, TempClassA);<br />
}<br />
<br />
<br />
myOtherFuntion(int searchkey)<br />
{<br />
ClassA myClassA = (ClassA)myHashTable[searchkey];<br />
string str = myClassA.name;
myClassA.name = "newname";
}<br />
}<br />
}<br />
The code compiles fine. At that point in runtime, however, I get an error referring to "string str = ca.name;" that says "Object reference not set to an instance of an object." The same error occurs for the line "myClassA.name = "newname";". I would imagine it's a fairly basic syntax error, but I just can't find a suitable example.
Any suggestions?
Thanks for your help.
|
|
|
|
|
tantiboh wrote:
ClassA myClassA = (ClassA)myHashTable[searchkey];
//I need to be able to complete both of the following operations:
string str = myClassA.name; //Causes an exception
myClassA.name = "newname"; //Causes an exception
The reason these two lines fail is that the first line I've quoted does not return a value, so myClassA is null . This is because either (1) the searchkey does not correspond to any key in the HashTable , or (2) the value null is stored for that searchkey .
The most likely explanation is that when you insert something into the HashTable you are using a string , when you try to retrieve something from the HashTable you are using an int . You must be consistent. Choose either a string or an int and stick to it.
My: Blog | Photos | Next SQL Presentation
WDevs.com - Open Source Code Hosting, Blogs, FTP, Mail and More
|
|
|
|
|
Using an int instead of a string was an error in the example I wrote for the thread; that problem doesn't exist in my actualy code.
However, your comment that ClassA is null prompted me to check for that, and it was. So, you've given me a new avenue to investigate.
Thanks for your help!
|
|
|
|
|
I'm using VS.NET 2003. When i use unicode in my control, I must Save As... with Save With Encoding ... How I can config my IDE to default my Encoding. Thank for advances.
Nothing
|
|
|
|
|
|
Can anyone help me get this thing started... I mean what input variables, what output variables do i need? how many files do i need in order to make this thing work? How do i make the output file save as .html? how do i create an option of a random background color for the user? How many arrays do i need in my program? Any help would be nice. Thank you for your time!
|
|
|
|
|
I would start by deciding what kind of web page I'm making.
ZMAN0728 wrote:
How do i make the output file save as .html?
The same thing that you make other files.
ZMAN0728 wrote:
How many arrays do i need in my program?
It depends, what kind of web page are you making?
<italic>Work hard, Work effectively and a bit of luck is the key to success.
|
|
|
|
|
hi all,
I hope any one can help me in this problem...
suppose i have a picture folder .. how i can to get the size of this folder in C# language.
thanks
|
|
|
|
|
System.IO.DirectoryInfo dir = new System.IO.DirectoryInfo(@"C:\");
System.IO.FileInfo[] files = dir.GetFiles();
long totalsize = 0;
for (int i = 0; i <= files.GetUpperBound(0); i++)
{
totalsize = files[i].Length;
}
MessageBox.Show(totalsize.ToString());
Best of Luck
Forever Developing
|
|
|
|
|
I am trying to have assembly A load assembly B into a seperate domain. It's odd because when I load the assembly into the second AppDomain, it is also loaded into the default domain. So, when I unload the second AppDomain, it doesn't actually unload the assembly. Am I doing something wrong here:
AppDomainSetup setup = new AppDomainSetup();
setup.ApplicationBase = AppDomain.Current.SetupInformation.ApplicationBase;
setup.ApplicationName = "Test";
AppDomain domain = AppDomain.CreateDomain("NewDomain", null, setup);
IInterface i = (IInterface)domain.CreateInstanceFromAndUnwrap("AssemblyB.dll", "AssemblyB.Interface");
If I run AppDomain.Current.GetAssemblies() to get the loaded assemblies before I run this code, it does not show AssemblyB loaded. If I run it after, it is loaded in the default domain. If I unload the second domain, it is still loaded in the default domain. No other project in the solution is dependent on AssemblyB, so it shouldn't be loading it into the default domain. Any ideas?
|
|
|
|
|
Are the two types in separate projects?
The most exciting phrase to hear in science, the one that heralds the most discoveries, is not 'Eureka!' ('I found it!') but 'That's funny...’
|
|
|
|
|
Yes, IInterface (whatever interface it may be) is in AssemblyC, which both AssemblyA and AssemblyB reference AssemblyC. But no assembly references AssemblyB.
|
|
|
|
|
Okay. After going in many small circles due to encroaching fatigue, I found this article[^].
Its focus is specifically on plug-ins, but in general it's about making assembly loading and unloading in remote AppDomains workable. I made up a little test code using the technique, and it works dandy.
The key is to set up the second (remote) AppDomain to use a shadow cache, so you have to use an AppDomainSetup, which has some really cruddy documentation (took me 20 minutes playing with it even after reading the article above to make sense of it).
Ultimately, though, I was able to load my interface type into the remote AppDomain without it appearing in my primary AppDomain, and of course I was able to unload it with no problems.
Hope this helps.
The most exciting phrase to hear in science, the one that heralds the most discoveries, is not 'Eureka!' ('I found it!') but 'That's funny...’
|
|
|
|
|
|
if anyone can help me out please do all the information is found at this address
http://groups-beta.google.com/group/microsoft.public.dotnet.csharp.general/browse_thread/thread/b6e5879b1a6b8de0/31753bb8be88ade7#31753bb8be88ade7
Alexandre Brisebois
Alexandre.Brisebois@gmail.com
|
|
|
|
|
"this line produces the error :
temp = o.GetType().InvokeMember("", BindingFlags.CreateInstance, null,
null, null); "
1. Seperate the code, iow 1 instruction per line.
2. You trying to get the constructor? Use Type.GetConstructor.
xacc-ide 0.0.15 now with C#, MSIL, C, XML, ASP.NET, Nemerle, MyXaml and HLSL coloring - Screenshots
|
|
|
|
|
hi experts
i have a string let say
string dummy="hello"
i want to remove 'h' and 'e' from this string and want to show a remaining string "llo" on the messagebox.
waiting for reply
|
|
|
|
|
string dummy = "Hello";
dummy = dummy.Replace("H", "");
dummy = dummy.Replace("e", "");
MessageBox.Show(dummy);
Forever Developing
|
|
|
|
|
Or, use the Substring() function. Depends on what exactly you want to do.
|
|
|
|
|
Using Com interop, I open an Excel worksheet. With Range's Find - method I search for a certain cell.
So far so good. Now the user should be able to edit this cell. But how can I make Excel scroll to that cell ?
|
|
|
|