|
Thats not really possible, or atleast pretty hard and inefficient to do.
Only one version of the framework can be loaded into a single process at a time. That means you'd have to use either something like an out of process COM server or maybe remoting or something like that.
Either way you'd probably be best off working within the limitations of .Net 1.1 if you want something to be used from 1.1
|
|
|
|
|
Hi thanks for the reply.. i can directly change the 2005 code to 2003 and use the dll for reference..but the think is that i have some additional properties which is in 2005 , i have used and are very important for me.so now when i changed to 2003 these properties are not there and hence it is creating very difficult problems.So i heard that there is way to play with it.we want to create a wrapper class and then call the wrapper class object
but i dont know how to create it..can any one help me on this
Regards
DilipRam
|
|
|
|
|
ramdil wrote: So i heard that there is way to play with it.
Any hints on what you were told might work? :P
As I said there are ways but they are inefficient and not a very good idea at all.
ramdil wrote: very difficult problems
It can be more akward to use 1.1 under 2003, but I wouldn't say it creates very difficult problems. Most of the time it just means a little more typing.
What is it that your doing in .Net 2.0 that is so vital and you can't do in 1.1?
|
|
|
|
|
When i searched the net, some where i saw that only way to work around with this type of issue is to create wrapper class but i dont how to work around it...
Regards
DilipRam
|
|
|
|
|
Ok I'll try this one last time in simple terms
What is it that you were told to do to work around the issue? Please supply any information you have about it so that we can advise you on it. If its an article then provide the link. If you read it in an atricle didn't the article tell you how to do it?
As far as I, and it seems anyone else around here, knows the only way to do this is not a good way to work. It's not worth it. You shouldn't do it unless you have a very good an important reason to do so.
It's most likely that the article was either suggesting that you use an out of process server somehow and that is not an efficient way to go unless you really have to. It'll kill your performance and introduce plenty of chances for errorsy ou normally wouldn't have. It will hugly increase the complexity of your systems and generally be a bad idea.
If you describe the features that you want to use in 2.0 but can't in 1.1 then maybe people can suggest what you can use instead.
I'm off home now but if you provide the required info and no one has replied by tomorrow I'll jump right on it.
|
|
|
|
|
Thanks for the reply .Any way i have decided to change the dll from 05 to 03 and use the 03 dll.Anyway thanks...
Regards
DilipRam
|
|
|
|
|
|
I have a single form application that runs in the systray. It is an audit trail logger that uses FileSystemWatcher to monitor file events in a directory. I can capture everything that I am looking to capture except when someone logs off the computer.
I tried using the Form1_Closing method, but it doesn't seem to activate when Windows is closing the application when a user logs off or shuts down the computer. Am I missing something?
Here is my code for the Form1_Closing method. I have no code pointing to this method, I just assume it finds the method when the application closes.
private void Form1_Closing(object sender, FormClosedEventArgs e)<br />
<br />
{<br />
MessageBox.Show("Closing Form");<br />
<br />
string _userName = Environment.UserName;<br />
string _date = DateTime.Now.ToString("yyyy-MM-dd-HH:mm:ss");<br />
string _eventType = "Logged Off";<br />
RegistryKey _regKey = Registry.LocalMachine;<br />
RegistryKey _subRegKey = _regKey.OpenSubKey("Software\\LAT_Systray");<br />
string _fileName = Convert.ToString(_subRegKey.GetValue("File_Name"));<br />
<br />
XmlDocument _xmlDoc = new XmlDocument();<br />
<br />
_xmlDoc.Load(_fileName);<br />
<br />
XmlElement _newEvent = _xmlDoc.CreateElement("Event");<br />
<br />
XmlElement _newDateNode = _xmlDoc.CreateElement("EventTime");<br />
_newDateNode.InnerText = _date;<br />
_newEvent.AppendChild(_newDateNode);<br />
<br />
XmlElement _newUserNode = _xmlDoc.CreateElement("UserName");<br />
_newUserNode.InnerText = Environment.UserName;<br />
_newEvent.AppendChild(_newUserNode);<br />
<br />
XmlElement _newTypeNode = _xmlDoc.CreateElement("EventType");<br />
_newTypeNode.InnerText = _eventType;<br />
_newEvent.AppendChild(_newTypeNode);<br />
<br />
_xmlDoc.DocumentElement.InsertAfter(_newEvent, _xmlDoc.DocumentElement.LastChild);<br />
<br />
FileStream _fsxml = new FileStream(_fileName, FileMode.Truncate, FileAccess.Write, FileShare.ReadWrite);<br />
_xmlDoc.Save(_fsxml);<br />
_fsxml.Close();<br />
<br />
}
Any help is greatly appreciated as you know.
Jeff
IT by necessity only
|
|
|
|
|
Did you look at SystemEvents class ?
|
|
|
|
|
What am I looking for in the SystemEvents Class? SessionEnding? And how would I use it?
Jeff
|
|
|
|
|
eb38335 wrote: SessionEnding
Yes.
In some discussions I read, it was stated that OnClosing does not always work
reliably. IIRC they claimed one should try using OnClosing, OnFormClosing and
SessionEnding; they probably each would call a single method that could handle
all kinds of exit scenarios.
It is my guess logoff will first generate a SessionEnding event, and
later on tries to close the forms, but may fail to do so, e.g. because
its time is limited, or for some reason it just decides to kill the processes.
Hope this helps.
|
|
|
|
|
I have downloaded the program Instant_Messenger_src .But i am little confused hoe to run that and how to add new client into that application and how to do IM with multiple clients?
Plz help me.
|
|
|
|
|
Please don't spam the entire site, just ask the right person, in the right place.
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
i m little bit confused as i m new in this site ...
sorry...
|
|
|
|
|
Well, like I said, if it's an article, no-one here knows what you're talking about. There's a forum under the text of the article, post your article specific question there.
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Here is an example of a use of the TransactionScope class:
using (TransactionScope ts = new TransactionScope())
{
SqlConnection myConnection = new SqlConnection("server=(local)\\SQLExpress;Integrated Security=SSPI;database=northwind");
SqlCommand myCommand = new SqlCommand();
myConnection.Open();
myCommand.Connection = myConnection;
myCommand.CommandText = "DELETE FROM Region WHERE (RegionID = 100) OR (RegionID = 101)";
myCommand.ExecuteNonQuery();
myCommand.CommandText = "Insert into Region (RegionID, RegionDescription) VALUES (100, 'MidWestern')";
myCommand.ExecuteNonQuery();
myCommand.CommandText = "Insert into Region (RegionID, RegionDescription) VALUES (101, 'MidEastern')";
myCommand.ExecuteNonQuery();
myConnection.Close();
ConsoleKeyInfo c;
while (true)
{
Console.Write("Complete the transaction scope? [Y|N] ");
c = Console.ReadKey();
Console.WriteLine();
if ((c.KeyChar == 'Y') || (c.KeyChar == 'y'))
{
ts.Complete();
break;
}
else if ((c.KeyChar == 'N') || (c.KeyChar == 'n'))
{
break;
}
}
}
The above piece of code is taken directly from MSDN. At one point, if the user answers 'Y', the ts.Complete() method is called, which makes the Dispose() method commit the transaction (or rollback it if the user answers 'N').
How is the SqlConnection instance associated with the TransactionScope ? Is this magic happening under the hood?
-----
If atheism is a religion, then not collecting stamps is a hobby. -- Unknown
|
|
|
|
|
Hi,
you can spend a lot of time and money, and have great fun not collecting stamps;
Of course it is a hobby.
|
|
|
|
|
Then I am not collecting a lot of things. I a man busy with millions of hobbies. I don't where I can find time to ask questions about TransactionScope
-----
If atheism is a religion, then not collecting stamps is a hobby. -- Unknown
|
|
|
|
|
Hello,
What I understand from the docu, it is really defined by the code-block, and it is recommended to use an using-block!
Le Centriste wrote: Is this magic happening under the hood?
I would say yes, MS magic!
All the best,
Martin
|
|
|
|
|
There's no magic, the using statement creates a code block which ends in calling Dispose, you can use this with any object that impliments IDisposable.
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
I don't think that this was the question, or at least I understood it different!
All the best,
Martin
|
|
|
|
|
Hi Christian
I was asking how does the TransactionScope instance is associated with the SqlConnection instance.
-----
If atheism is a religion, then not collecting stamps is a hobby. -- Unknown
|
|
|
|
|
There's nothing magic about it at all. You are seeing the behaviour because of a "hidden" connection string entry - Enlist. If Enlist is true then the SqlConnection will automatically enlist in the enclosing scope. Obviously, this only applies to Sql Server (2005) connections as the Sql Server (2005) data provider automatically checks (based on the Enlist) whether or not there is an open transaction to work under.
|
|
|
|
|
Ok, thanks, that is the answer I was looking for. I remember now from the documentation that the Enlist parameter defaults to true in the connection string, for the SQL Server 2005 provider.
Have a nice day.
-----
If atheism is a religion, then not collecting stamps is a hobby. -- Unknown
|
|
|
|
|
Hi Le Centriste,
I think the magic here is that System.Transactions uses COM+/Enterprise Library under the hood to enlist the SQL commands in a distributed transaction, and SQL knows this through the enlist parameter in the connection string. When Complete() is called, the transaction is committed, and if Dispose is called without a Complete() call, the transaction is rolled back.
*edit* oops, I see Pete already answered your question
|
|
|
|