|
There are better ways to do this other than calling GC.Collect() . Ideally, you should wrap the COM object you are using in a wrapper class that implmenets the IDisposable interface and the Dispose pattern. This wrapper class should have the responsibility of explicitly releasing (freeing) the the COM object when it is disposed.
|
|
|
|
|
I strongly agree with the IDisposable method of disposal then the GC.Collect() as it may just about bring down the performance a bit more.
Thanks for displaying both the methods.
Regards,
Vaibhav Sharma
|
|
|
|
|
I use class wrapper with Marshal.ReleaseComObject in destructor, but error strangely unpredictable occured in the finish of application.
|
|
|
|
|
Now I am working in .Net 2.0. I want to Build my application in .Net 3.0. I downloaded 3.0.
How can I build 3.0? pls give step by step process.
|
|
|
|
|
|
plz how can i read a string from a txt file then insert it in a database table using C# in visualstudio2005 ?
|
|
|
|
|
Ok as regards your first qt.
>> Use the My.Computer.FileSystem.ReadAllText() function to read the text from the text file that you want the data to be imported from.
Dump the string returned by this into a local called importedData
>> As for the Database code, you should have specified the provider, but here is it for Access.
Dim oledbCn As New System.Data.OledbConnection(connectionString)<br />
oledbCn.Open()<br />
Dim oledbCmd As New System.Data.OledbCommand(commandString,oledbCn)<br />
If oledbCmd.ExecuteNonQuery()>0 Then<br />
MessageBox.Show("Data imported to database correctly.")<br />
Else<br />
MessageBox.Show("Data import failed.")<br />
End If
As you may be knowing, connectionString for Access will be
"Microsoft.Jet.OLEDB.4.0; Data Source=MyDatabase.mdb"
commandString would be the T-SQL statement like
"INSERT INTO TableName(colName1,colName2,...) VALUES('" & importedData & "',...)"
I guess that is fairly a very Beginners job in .NET and you should be having no problems whatsoever using the above snippets.
In case of problems always refer back and we will be there for u.
Happy Coding
Regards,
Vaibhav Sharma
|
|
|
|
|
Hy there, I must make an app that silently installs .net framework(the client must never be asked nothing). I found a method to do this..and even one to find if .net is installed, but I don't 100% trust it because it checks only the registry.
So I won't to make sure by launching an .net app wich returns, for example 1.
But if .net is not installed, the client sees the error ".. press ok to terminate the app". My program written in C++ knows that it didn't return 1,
but I wan't the client not to see the exception
If you can help me, pleaase, it's important(to me:P) Thank you.
|
|
|
|
|
|
Well, I am using C++ to write my application, so I don't want to use a JavaScript, and I have no ideea what the client has on his computer. I need to start an app written in C# and to catch the exception that it throws if .NET is not installed.
My problem is that I know that .net framework is installed, but I don't know if it works..so I have to be sure.
I tried to catch that error, but it does not throw the exception to my application, it throws it directly to windows.
Hope someone helps me. Thanks!!
|
|
|
|
|
Actually I was suggesting you the trick/concept hidden over there. The Web Browser's UserAgent shows up whether .NET Framework is installed and also carries the .NET Framework versions that have been installed on the system.
That should show some light for you at the end of the tunnel.
|
|
|
|
|
Well, I must say that I don't know nothing about Java Script.. I made my app in C++. Can you help me with some code? how can I write to test that user agent? I don't need and .NET app, 'cause it wont't run on the client's computer if he doesn't have .net. I now your solution is good, but i don't know how to implement it in C++
|
|
|
|
|
Good day
Previously in framework 1.1 one dll was compiled and all code behind pages was included into this one dll. This was a maintenance nightmare as when any pages changed testing this change had to include all the different modules as all the code was compiled to one dll.
One of the major changes in framework 2.0 is the way the project is compiled.
A detailed article explains this:
http://www.west-wind.com/presentations/AspNetCompilation/AspNetCompilation.asp[^]
We are now in the process of choosing which way will best suite our environment.
Some basic requirements when choosing an option:
1. The systems will fall into a maintenance stage and this is when I will need the option to allow changes to modules and the test effort must only be on the change and not the whole system. Ie compile a dll per module/page will cater for this.
From the article above I think the best approach will be to use the InPlace Deployment which will compile a dll per page, and therefore the test effort will be much more streamlined to the change and not the whole system.
Some of the factors to consider is
1. Security
2. Performance
Please give me your feedback on this.
Regards
Chetan
|
|
|
|
|
Ok, im trying to get an image, for now a jpg, but I want to make it so it can get all the major ones. But for now, still trying just to get the jpg image. I get data back, I get a good header, but when I put it in the file, and open it, it is completely distorted and doesn't look, well doesn't look like anything. I don't know if there is something like I need to convert it after getting it or what. The file comes out bigger when I get it then when I just straight download it. I am getting it just by taking what I see after the header, and looking for the content length and grabbing char per char. Any help would be great. Thanks!
|
|
|
|
|
I'm writing an application in C# .NET.
I'd like to add a button to the controlbox that will make the application go full screen (i.e. disable the taskbar and bar at the top of the application). This is similar to the TV mode on WinTV.
I've worked out how to make the application maximise (see MaxWinForm article), but cannot work out how to add the button to the controlbox, which normally holds maximise, minimise and close.
Anyone any ideas?
Cheers,
James
|
|
|
|
|
There has been an article recently about adding a help button (while keeping
minimize and maximize). Search for it!
Luc Pattyn [Forum Guidelines] [My Articles]
this weeks tips:
- make Visual display line numbers: Tools/Options/TextEditor/...
- show exceptions with ToString() to see all information
- before you ask a question here, search CodeProject, then Google
|
|
|
|
|
Using Vista and VS2005...
I'm working on a windows service which requires the use of the JITdebugger. When I start the service, it's supposed to automagically fire up the debugger, but I get the following error in the Application event log:
An unhandled exception ('Launch for user') occurred in vPopcorn_Service.exe [3220]. Just-In-Time debugging this exception failed with the following error: Either a required impersonation level was not provided, or the provided impersonation level is invalid.<br />
<br />
Check the documentation index for 'Just-in-time debugging, errors' for more information.
I'm off to research it, but I figured I'd post a question here in the mean time.
If anyone has any ideas, I'd be happy to entertain them.
"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
|
|
|
|
|
Did you find an answer to the question?
I tried Debugger.Launch and it seems to work fine and yes I have UAC enabled.
How is the service running (what account is it using)? It seems to me that the service is running under an account that does not have SeImpersonation privilege (my guess).
|
|
|
|
|
Rama Krishna Vavilala wrote: Did you find an answer to the question?
Nope.
Rama Krishna Vavilala wrote: How is the service running (what account is it using)? It seems to me that the service is running under an account that does not have SeImpersonation privilege (my guess).
I've tried it under both "Local System Account", as well as my own.
"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
|
|
|
|
|
Is your account an Administrator (barring UAC)?
|
|
|
|
|
Ok
Here are my findings:
1. If you are an administrator (meaning member of administrators group but running under UAC) the Debugger.Launch always works. It does not matter what account the service is running on.
2. If you are not an administrator you need to run the service under your account and you need to have SeDebugname privilege. An administrator can grant that privilege to a user by launching "Loacl Security Policy". It appears as "debug Programs" under "Users Rights Assignment".
3. If the service is not running under the same account as the you than the debugger cannot attach as it fails to inspect the processes identity. I think it can be done by injecting a dll and modifying some ACLs, something similar to this article: http://www.codeproject.com/macro/clrdebugenable.asp[^]. I will have to research further.
So I will say go with 2.
|
|
|
|
|
I'm in the administrator group, but I don't have permission to modify the registry. The service is running under the "Local System" account.
I'll look into item #2.
"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 don't see the point in using #region . It doesn't appear to affect the compile in any way.
"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
|
|
|
|
|
John Simmons / outlaw programmer wrote: I don't see the point in using #region. It doesn't appear to affect the compile in any way.
It's just a way to organize your code. For example, you could have a class skeleton with the following regions:
public class MyClass : ISomeInterface
{
#region MyClass Members
#endregion
#region ISomeInterface Members
#endregion
}
I usually add nested regions for segregating properties, methods, contructors, and fields. Sometimes I use regions within methods to mark off guards, preconditions, postconditions, etc.
When I first started using C# with Visual Studio, I was skeptical about the benefit of regions, but I've found them helpful in navigating my classes.
|
|
|
|
|
Aye, they can make navigation very quick if used right
|
|
|
|