|
Actually, I'm embarrassed, but the issue was that I was staticly AND dynamically linking the dll. I would have thought that would have caused a problem right away, but it didn't show up until I created the serializer. All fixed now!
Thank you very much for your help.
|
|
|
|
|
Hi,
I need to connect to DB2 database using C#. Is there any namespace in .net2.0 which I may use to connect to DB2 database. kindly help.
Thanks in advance
Sankalp
|
|
|
|
|
The generic ADO.NET classes connect to any ODBC data source.
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Right, ODBC if you have a driver. Or a .net connector for it...
Check this out[^]
It seems IBM has one too, but I didn't want to log into their site.
|
|
|
|
|
Is it at all possible to programatically modify the app.config file? I've jumped through all the hoops to add/remove proerties, but when I call the Configuration.Save function, I get this exception:
The configuration file has been changed by another program.
(C:\\Test Apps\\bin\\Debug\\ConsoleApp.EXE.config)
How do I get around that?
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
|
|
|
|
|
Have you looked at this article on reading/writing to App.config[^]? Apparently you can modify it programmatically.
Then again, this MSDN forum post[^] suggests you might have to manually merge some stuff if you've changed the schema.
Life, family, faith: Give me a visit.
From my latest post: "How differently the psalmist saw it! How blessed -- how truly happy with real joy! -- is the man who delights in the Law of the Lord."
Judah Himango
|
|
|
|
|
I forgot I had a library called Nini (it's on sourceforge) that lets me do this with little/no pain.
This whole thing is retarded. One of the most difficult things you could want to do is to go outside of Microsoft's comfortable little world and try something different. .Net sucks.
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
|
|
|
|
|
I think what it comes down to is having something that's tool-generated be modified outside of the tool. Anyways, glad you found a solution.
Life, family, faith: Give me a visit.
From my latest post: "What kind of American doesn't want to vote for sunshine and rainbows? One of those ugly conservatives, that's who."
Judah Himango
|
|
|
|
|
John Simmons / outlaw programmer wrote: How do I get around that?
Not sure, I have done that before modifying the web.config. You sure you dont have that file open in a viewer?
|
|
|
|
|
Yeah, it's .Net being retarded. I found a solution involving the Nini library.
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
|
|
|
|
|
Hi,
I have a compiled class library/dll (written in C#) and I need to get a property of an object inside it from another project. Unfortunately, the DLL structure (namespaces and type names) is virtually guarenteed to change AFTER my app has been deployed. So I've been trying to use reflection to get to the object required (having read some settings data like namespaces and type names from a db). At the moment I'm tripping up on the use of System.Reflection.Assembly - it works fine when I reflect on the current project, but when I try to read the DLL I have problems - any help would be appreciated! (Pseudo)Code follows:
public void Main()
{
Console.WriteLine(Foo("MyClassLibrary.DLL", "Person", "Name"));
}
public string Foo(string NameOfAssembly, string TypeName, string PropertyName)
{
Assembly assembly = Assembly.Load(NameOfAssembly);
foreach (Type t in a.GetTypes())
{
if (string.Equals(TypeName, t.Name))
{
type = Type.GetType(TypeName, true);
}
}
object currentObject = GetObject();
PropertyInfo propinfo = currentObject.GetType().GetProperty(PropertyName);
return propinfo.GetValue(currentObject, null).ToString();
}
[Note: We are using our own in-house tools for data access, so the above code has some database stuff removed, and for simplicity try-catch blocks are also removed]
Does anybody have any help they can offer on reflecting on a DLL?
Thanks,
Chris
[Update: Corrected a typo]
|
|
|
|
|
Never mind - seems that Assembly.LoadFrom(NameOfAssembly) will do the trick here
Note to self: Check intellisense more carefully!
|
|
|
|
|
c2423 wrote: the DLL structure (namespaces and type names) is virtually guarenteed to change AFTER my app has been deployed
That's a very bad idea, but DLL versioning should help.
|
|
|
|
|
Agreed, but its not my DLL that I'm using. Try as I might the guy writing it won't agree to keep the interface consistant, or even tell me when he makes breaking changes, or comment the code, or ........
|
|
|
|
|
Does anyone know if it's possible to get the Win32 handle to the serial port
used under the hood in System.IO.SerialPort?
The reason I want it is so I'd be able to make changes the DCB struct. I
want to set the fRtsControl to RTS_CONTROL_TOGGLE so the RTS signal will be
reset automatically when the TX buffer is empty.
The other option would be to wait for a "tx buffer empty" event to be
signalled after a call to Write. Something like this:
port.RtsEnable = true;
port.Write(buffer, 0, byteCount);
WaitForTxBufferToBeEmpty(port);
this.port.RtsEnable = false;
...but how do I implement WaitForTxBufferToBeEmpty?
|
|
|
|
|
Can anybody help me out, i want to develop code for chatting in lan. means i will supplies ip adrees to whoem i want to send the msg.
if any body have any idea pls reply
Yogesh Pekhale
pekhaleyogesh@gmail.com
|
|
|
|
|
Hi Yogesh,
Refer to the following links:
http://www.codeproject.com/KB/cs/LanChat.aspx
http://www.codeproject.com/KB/IP/ChatMasala.aspx
I hope this would be helpful.
Vinay
ComponentOne LLC.
www.componentone.com
|
|
|
|
|
|
Hi,
I'd like to create a method that can make an instance of a class just by knowing its type. Something like:
void createInstance(Type formType)
{
ConstructorInfo info = formType.GetConstructor(new System.Type[] {this.GetType()});
FormBase res = info.Invoke( new object[] { this });
return res;
}
I think I missundertood the use of Invoke for ConstructorInfo.
Thanks,
Dirso.
|
|
|
|
|
Activator.CreateInstance()
|
|
|
|
|
|
I'm having trouble serializing my class and someone suggested I dump the xml schema from the Type/Graph to take a look.
I hunted around and couldn't figure out how to do that.
Could someone help me out?
Thanks!
|
|
|
|
|
Hehe, I will answer that!
Open the .NET/VS Command Prompt, and run the following:
xsd /t:MyNamespace.MyType yourdllorexe
|
|
|
|
|
Can you point me out in some directions of how to support drag and drop between my application and windows explorer?
The only article that I found on this was the this one written by Michael Dunn, but it's implemented in C++ and it's not even working with Windows Vista.
This article it's doing exactly what I need, but unfortunately it's not working under windows vista even though I'm running it with administrator rights
modified on Wednesday, June 11, 2008 9:33 AM
|
|
|
|
|