|
if my application has been teminated form Windows task Manager or from debug. Can i do any clean up work for my application before really shut it down?
|
|
|
|
|
|
Hi I want to make a toolbar for internet explorer using C# but there doesnt seem to be any information on how its done....
I don't know what I'm talking about
|
|
|
|
|
|
Hi,
I need to limit the number of instances running of my C# .NET Windows Application to one. Unfortunatly I don't know of any proper ways of doing so at the moment. Have any of you had any experiences or ideas about instance control of Windows Applications in C#?!
Thank you very much for your help!
|
|
|
|
|
A search of CodeProject and/or Google will yield a good selection of results. For what its worth, I'm currently using a modified version of Michael Potter's Single Process Instance Object[^] article.
Hope that helps.
--Jesse
|
|
|
|
|
Hi,
I need to represent a table (rows and columns) of a "Cell" class. I would like to be able to do the following on an instance of my CustomTable class:
table.Rows[2][6] - and get a specific Cell
table.Cols[6][2] - and get that same Cell out
So - I need a two dimensional collection of Cell-objects. And a way of adding properties to the table class to look in that two dimensional collection. If we look at the Rows property, it could be made like this:
public RowCollection Rows<br />
{<br />
get { return m_rows;}<br />
}
- where the RowCollection e.g. inherits from System.Collections.CollectionBase and implements the index-operator [] in order to get Row class instances out. These, in turn, must either be a collection of cell objects or have a .Items property which is a cellcollection (this would change the notation from table.Rows[2][6] to table.Rows[2].Items[6]).
However - making this work with the table.Cols[6][2] indexing as well requires that the table class has a m_rows collection of rows and a m_cols collection of columns - that both look into the same datasource - some sort of a two dimensional collection to represent the cells. I can't really think of a "sleek" way to implement this - I keep ending up with loads of collections and I have this thought nagging in the back of my head... This must have been done around a thousand times before
The main argument for having this as collections is that I need dynamic resizing at some point in time. And I feel a need for having a Row and Column class to hold some specific information for rows and columns - but if the Row class is just a Cell collection, it isn't really obvious to add properties to that class that are specific for the Row (the column, respectively).
Does anybody have any ideas or thoughts on this ? Of course, I'm probably just missing something really obvious here...
Anyone ?
Do you know why it's important to make fast decisions? Because you give yourself more time to correct your mistakes, when you find out that you made the wrong one. Chris Meech on deciding whether to go to his daughters graduation or a Neil Young concert
|
|
|
|
|
Thinking off the top of my head here..
C# supports proper multi-dimensional arrays
Cell[,] mydata = new Cell[width,height]
or am I mis understanding your problem?
--
Help me! I'm turning into a grapefruit!
Phoenix Paint - back from DPaint's ashes!
|
|
|
|
|
No, you're completely right
The problem with arrays is that they cannot be dynamically re-sized - and I need that. Anyway, I've been working on a solution where the table holds data in a System.Data.DataTable, and .Rows and .Columns properties access this datastorage.
Actually - I think that I need a simpler version of a DataTable which is less database-oriented and strongly typed to my Cell class. Any great ideas ?
Do you know why it's important to make fast decisions? Because you give yourself more time to correct your mistakes, when you find out that you made the wrong one. Chris Meech on deciding whether to go to his daughters graduation or a Neil Young concert
|
|
|
|
|
Hmm.. still bouncing ideas at random, you could probably make an ArrayList of ArrayLists, to give you a two dimensional dynamically re-sizable array. (ArrayList can store anything as an Object, which should basically be any C# class)
--
Help me! I'm turning into a grapefruit!
Phoenix Paint - back from DPaint's ashes!
|
|
|
|
|
I have a form with three constructors each with a different signiture.
i.e.
public Form_1() ...
public Form_1(string Name) ...
public Form_1(string Name, int Number) ...
How can i call the first constructor from the second and call the second from the third?
At the minute I have to copy the common code into functions and call the functions but would prefer to call the constructors as i used to do in VB.Net.
Thanks
|
|
|
|
|
Use the 'this' keyword like this
<br />
public Form_1() : this(null)<br />
{<br />
}<br />
public Form_1(string Name) : this(Name, 0)<br />
{<br />
}<br />
public Form_1(string Name, int Number)<br />
{<br />
}<br />
|
|
|
|
|
You've generated an extra call for no good reason. A better example would be:
public Form1() : this(null, 0)
{
}
public Form1(string name) : this(name, 0)
{
}
public Form1(string name, int number)
{
} Why generate an extra call on the stack just to "redirect" to another method?
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Sustained Engineering
Microsoft
[My Articles] [My Blog]
|
|
|
|
|
Heath Stewart wrote:
Why generate an extra call on the stack just to "redirect" to another method?
To avoid duplicating defaults and/or code (which could lead to inconsistent behavior).
Actually, if you Google for it you'll notice that this is one of those religious things. Personally, I agree with you, with the added annoyance that single-stepping through code like this is really boring.
Yes, even I am blogging now!
|
|
|
|
|
Anynoe know how to keep the backColor of listview items (View=Details) when HideSelection is set to false?
The problem is when selectedItems.Count == 0, it seems to redraw the last selected item with a clear background after the selectedIndex changed event.
Any ideas how I can get around this?
Thanks
|
|
|
|
|
try to override paint function ...
Mhmoud Rawas
------------
Software Eng.
|
|
|
|
|
This is a question for Heath [^], I guess
I want to write a managed C# DLL and call functions/classes from a unmanaged C++ application.
I could write a COM component in C#, register it and then #import it in the unmanaged C++ application to generate wrappers.
But: I want to avoid having the need to register the C# COM component, since the C# DLL and the unmanaged C++ application both are located inside the same folder and there is no need for other applications to access the COM component.
What I already tried (results in error C1083 [^]) was to <a href="http://msdn.microsoft.com/library/en-us/vclang/html/_predir_The_.23.import_Directive.asp">#import</a> [<a href="http://msdn.microsoft.com/library/en-us/vclang/html/_predir_The_.23.import_Directive.asp" target="_blank" title="New Window">^</a>] the C# COM DLL by referencing the complete DLL via
#import "C:\Test\MyCSharpClassLib.dll" , but witthout success.
Also, I looked at the way this example does it: www.perfectxml.com/articles/msxml/TipsAugust02.asp [^], but that didn't help me either.
Question: Is it possible for me to call a C# COM-component from unmanaged C++, without registering it?
Thanks
Uwe
--
Affordable Windows-based CMS: www.zeta-producer.de/enu
|
|
|
|
|
Dear Sir,
as i have try it before i think that you don't have to register that com dll cuz it is self registration dll which can be generated from C# compiler using COM option, i have put them in the same foler with no-need to register it just you can call that dll from unmaneged c++ directlly with wout registration and you will have an error message just if you have used any crystal report objects in that C# dll
Mhmoud Rawas
------------
Software Eng.
|
|
|
|
|
Two options I can think of: first, to use side-by-side assemblies[^] to produce an isolated application. Second, to use the CLR Hosting[^] APIs to host the .NET Framework in your C++ application.
The second option looks like a lot of work, so I'd look into the first technique first. However, if you need it to work on Windows 2000 or earlier, I think it'll have to be the second.
Stability. What an interesting concept. -- Chris Maunder
|
|
|
|
|
Just tried your "CLR Hosting" suggestion: I looked at the "CLR Hosting Sample [^]" at the bottom of the link you suggested, slightly modified it and, it now works fantastic, without any additional registering.
Thank you!
--
Affordable Windows-based CMS: www.zeta-producer.com
|
|
|
|
|
Uwe, here's a thought, create an CCW a la my article[^], but you could control the registration from your application with the command line tool Regasm.exe[^], this way you could unregister it if you wanted (this idea seems brittle though). Also, CLR Hosting would be an interesting mechanism to consider as well. I've been wanting to write an article cover this topic, maybe I can sit down over the holiday weekend and put some notes together for it.
[EDIT]
You may also want to look into using the Tlbexp.exe[^] as it will generate the type library for you, however it won't register the assembly as regasm.exe will above.
[/EDIT]
- Nick Parker My Blog | My Articles
|
|
|
|
|
That would be great! Thanks for your feedback Nick, I will try out and post my results.
--
Affordable Windows-based CMS: www.zeta-producer.com
|
|
|
|
|
Both Mike's and Nick's answers are correct, but I wanted to explain what #import - the way you're using it - is. It serves two purposes - including assembly references in Managed C++ and importing typelibs, which generates a header and allows you to specify options for how that header file is generated.
Even if you have a typelib a la regasm.exe /tlb MyAssembly.dll and import that (as I did in my Java/.NET interop article), the classes still need to be registered. A typelib - as I'm sure you know - only describes types, nothing more.
If you go with Mike's approach about using manifests and don't want to register the components to be used by other COM clients (although, since that is the easiest, ask yourself "why not?". there's lots of "private" COM components registered on your system), understand that it'll only work on XP and newer and make sure that down-level platforms get a user-friendly error for when that type won't be found (off-hand, I'd bet you'd get either a TypeLoadException or TargetInvocationException ).
Hosting the CLR is another good idea and isn't too much work for the basic functionality.
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Sustained Engineering
Microsoft
[My Articles] [My Blog]
|
|
|
|
|
|
Uwe Keim wrote:
The guy metions a function getDllClassObject, which must be written by the autor of the book he mentions. Since I don't have the book, maybe I should buy it? Or do you know how the function probably works?
No it's probably just a VB wrapper around the native call, he is refering to DllGetClassObject[^] which you can implement yourself. It's returning a class factory based on the CLSID of the coclass and the interface being requested.
- Nick Parker My Blog | My Articles
|
|
|
|