|
Any idea why I get the above error with the following simple code snippet?
void parseStream()
{
string str = " " +
"<foo> "+
"<foo> ";
StringReader strReader = new StringReader(str);
XmlTextReader reader = new XmlTextReader(strReader);
while( reader.Read() )
{
switch( reader.NodeType )
{
case XmlNodeType.Element:
Console.WriteLine("{0} : {1}", reader.Name,reader.Value);
break;
}
}
Console.WriteLine("Done");
Console.Read();
}
|
|
|
|
|
Your XML is most like incorrect, with out the XML or the exceptions message (not just the exception) people cant answer you.
I rated this article 2 by mistake. It deserves more. I wanted to get to the second page... - vjedlicka 3:33 25 Nov '02
|
|
|
|
|
This is the error I'm currently getting in Visual C# when I try to drop in one of my home made components.
I've made several components before and even this one I am working on was performing exactly how I was expecting, but for some reason last night, that's the only thing I see now. I can't add any of my components to a form without seeing this message.
Strangely enough, I can still run the forms and they work great, but I can't modify the form due to this error.
Any thoughts on where I should look?
Thanks!
|
|
|
|
|
Finally got the error a bit narrowed down. I took a new project, added a blank control, and a blank form.
I can drag the control onto the form no problem without the error.
*If* I add a reference to 'Microsoft.DirectX' to the project, then I can no longer add the control onto the form without 80131019.
So if my project or my component is using DirectX, then I cannot use them. Thoughts? Ideas?
|
|
|
|
|
Tad more info...
My component can have a reference to Microsoft.DirectX, but my form that is the target for the component cannot. Once I removed the reference to it, my form works fine and my component can now be dropped onto my form. But, alas, I need to do some DirectX in my form as well.
|
|
|
|
|
I am trying to write a wrapper to some VB6 code in C#. The problem is the VB6 code wants to return a Variant. How do you handle this in C#?
Example:
[VB6]
Dim pixels As Variant<br />
pixels = pixelBlock.SafeArray(0)
[C#]
? = pixelBlock.SafeArray(0);
Mark Sanders
sanderssolutions.com
|
|
|
|
|
object pixels = pixelBlock.SafeArray(0);
is the direct traslation.
You could probably also use
System.Array pixels = ...
or if you know the type of the array, you might get away with
MyType[] pixels = (MyType[]) ...
Paul
We all will feed the worms and trees So don't be shy - Queens of the Stone Age, Mosquito Song
|
|
|
|
|
I'm sure this is totally documented and I am just looking / searching for the wrong things here - if some kind soul can point me to the right documentation, then I'm sure I can work it out for myself.
I want to add a new element to the Windows Explorer "Send To..." - call it "Send To->Webmail Recipient" - what it will do is parcel up the files that have been highlighted and present a (C#) form that will ask for a recipient and then send those files via my webmail system to the recipient.
Can someone point me in the right direction?
-Adrian
|
|
|
|
|
|
I thought so too - however, the article pointed to shows you how to add a "Send To" menu item to your own application, not how to add a menu item to the "Send To" menu.
-Adrian
|
|
|
|
|
I thought there were interesting stuff in the code itself, but anyway. A SendTo handler is a COM object which implements the IDropHandler interface.
Mike dunn has written an article[^] about how to do this using C++/ATL.
Now for C#, the basic start is to implement the IDropHandler interface using the appropriate attributes. A good start is COMInteropPart2\CSharpServer from the VS.NET sample cds. It goes like this :
using System;
using System.Runtime.InteropServices;
namespace CSharpServer
{
[Guid("DBE0E8C4-1C61-41f3-B6A4-4E2F353D3D05")]
public interface IManagedInterface
{
int PrintHi(string name);
}
[Guid("C6659361-1625-4746-931C-36014B146679")]
public class InterfaceImplementation : IManagedInterface
{
public int PrintHi(string name)
{
Console.WriteLine("Hello, {0}!", name);
return 33;
}
}
}
|
|
|
|
|
My C# program needs to search all the child and ancestor windows of a known window until it finds one with a particular window name. I guess the only way to do this is to use something like EnumChildWindows and somehow checking each handle to see if the window it points to has the window name I am looking for.
Is there an easier way of doing this in C# without Win32 calls? And if not, how do I setup the callbacks for the call to EnumChildWindows?
|
|
|
|
|
Mattingly wrote:
how do I setup the callbacks for the call to EnumChildWindows?
Just write it as a delegate and pass that into the function. It works in most cases.
I rated this article 2 by mistake. It deserves more. I wanted to get to the second page... - vjedlicka 3:33 25 Nov '02
|
|
|
|
|
Ok, and I guess there is no easier and more .Netish way of finding all the child windows and checking their window names?
|
|
|
|
|
I am trying to decrypt a file using my PGP keyring inside a C# windows console application. I have a program that will detect a new file on my server. I'm building another app that will first decrypt the file and then start the file processing.
The code I use to decrypt the file without inserting a passphrase works but instead uses the passphrase read from password.txt,
gpg.exe --output mydoc.txt --passphrase-fd 0 < password.txt --decrypt myencrypteddoc.dat.pgp
This works when I run it at command line. But inside the console it seems to hang when reading the file descriptor because the command window message "Reading file descriptor 0 ..." continually displays and the decryption never occurs.
Process process = new Process();
process.StartInfo.FileName="E:\\Program Files\\pgp\\gpg.exe";
process.StartInfo.Arguments="--output mydoc.txt --passphrase-fd 0 < password.txt --decrypt myencrypteddoc.dat.pgp";
process.Start();
process.WaitForExit();
Any help with this would be appreciated.
Thank You!
mazn
|
|
|
|
|
Check out the article GPG for .NET here on CP, it's done in dot net and has a wrapper class written in c#.
Besides I'm using a similar one in c++ by creating a pipe and associating it with the standard input handle of the gpg process, whereas eliminating the need to include the passphrase in the commandline.
|
|
|
|
|
Hey peeps,
I have a method like so:
private void RunFunction(string function)
{
.......code here.....
}
I basically want to be able to run a method in the same class from a string containing its name.
i.e.
string = "TheFunction"
this using code, will invoke the method TheFunction()
If there is a way tp pass parameters to the function, that would help too.
i.e. TheFunction(somestring,someint)
Cheers
nonny
"How long has the "Quote Selected Text" been around???" - Marc Clifton, Lounge 4 Mar '03 "But a fresh install - it's like having clean sheets" - Chris Maunder Lounge 3 Mar '03
|
|
|
|
|
Ah, never mind, i've found a way. For those who wanna know its...
public void LoadMethod(string method)
{
Type t = typeof(Class1);
t.InvokeMember(function,BindingFlags.Default |BindingFlags.InvokeMethod,null,this,null,null,null,null);
}
The link to the MSDN page is...
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfsystemtypeclassinvokemembertopic1.asp[^]
"How long has the "Quote Selected Text" been around???" - Marc Clifton, Lounge 4 Mar '03 "But a fresh install - it's like having clean sheets" - Chris Maunder Lounge 3 Mar '03
|
|
|
|
|
alternatively you could use callbacks also...
|
|
|
|
|
Can't seem to find a way to do this
|
|
|
|
|
Does Application.Exit() not work?
Paul
We all will feed the worms and trees So don't be shy - Queens of the Stone Age, Mosquito Song
|
|
|
|
|
|
Nishant S wrote:
Just return from your Main().
Or you could try that
Paul
We all will feed the worms and trees So don't be shy - Queens of the Stone Age, Mosquito Song
|
|
|
|
|
do you have thread running ?
|
|
|
|
|
I need to be able to generate short timezone names (like EST, CST etc.). The Timezone class gives me long names but not the short names. Is there any way to get the current short timezone name? I would have thought this would have been in the Timezone object.
Thanks
Kevin
|
|
|
|