|
|
|
i have a control that needs to call a method in the parent form, any ideas how to do this?
i tried setting the form as the parents control using the Parents proprty, and the using this.Parent.Method() but it tries to call Method() from the Control class.
Email: theeclypse@hotmail.com URL: http://www.onyeyiri.co.uk "All programmers are playwrights and all computers are lousy actors."
|
|
|
|
|
I gave the parent form an interface
class MyForm : Form, ITest
then called that interfaces method, and it worked.
((ITest)thi.Parent).Method();
Email: theeclypse@hotmail.com URL: http://www.onyeyiri.co.uk "All programmers are playwrights and all computers are lousy actors."
|
|
|
|
|
|
Hi all - i'm currently using DotNetBar v1.0.0.15 and have found that if you add a shortcut to a main menu item (ie Ctrl+O when opening files)
the character 'O' gets added to the currently focused control after the shortcut code is run. This results in my currently focused richtextbox getting an additional character each time i try to open a new document.
I've tried trapping the key events but my shortcut code (an open dialog box)gets processed first before the key event handlers, by which point the Ctrl keys are long since deselected and event handler doesn't fire as expected.
Does anyone know of a reason or fix for this strange behaviour between DotNetBar and currently focused text.
boxes?
Cheers
|
|
|
|
|
my problem:
I have to port a Project from C++ to C#
there is a DLL, i can load
[DllImport("blabla.dll")] <br />
public extern static void CancelSearch();<br />
.<br />
.<br />
.<br />
and use it...
and then end the programm BUT there is a deadlock,
cause the FreeLibrary(); is never called
by C#
(if I remove the FreeLibrary(); in C++ then the C++ App hangs too)
any idea how to unload the DLL?
|
|
|
|
|
At the command line prompt change to the directory the .dll is registered in and then type the following:
regsvr32 -u blabla.dll
You should get a prompt saying it has been unregistered.
HTH
Nick Parker
|
|
|
|
|
no, the DLL is not registered.. its just a normal DLL ...
it waits till I call the FreeLibrary(); function
.... but I have no idea how to do this in C#
|
|
|
|
|
So are you only trying to call the FreeLibrary(); function from this .dll? If so and it is non .NET then you will need to use COM Interop.
HTH
Nick Parker
|
|
|
|
|
Normal DLL's dont use COM, and thus COM-interop will not be useful here.
|
|
|
|
|
Christopher Lord wrote:
Normal DLL's dont use COM, and thus COM-interop will not be useful here.
Isn't it . I must have been spacing off when I was typing my response, please forgive.
Nick Parker
|
|
|
|
|
trying use app domains - put the dll calling code in a sep domain - then when you unload the domain the dll should get unload as well...
"When the only tool you have is a hammer, a sore thumb you will have."
|
|
|
|
|
thanks! I think this may work.... but I can't find any sample code with AppDomains
do you know a link?
|
|
|
|
|
see msdn article^
"When the only tool you have is a hammer, a sore thumb you will have."
|
|
|
|
|
As far as i know the dll never gets loaded, u can only call static methods and the dll gets used to perform the function by Interop Services. Any dll (assembly) that gets loaded will be written to the debug console when they are loaded.
MYrc : A .NET IRC client with C# Plugin Capabilities. See
http://sourceforge.net/projects/myrc for more info.
|
|
|
|
|
|
What part of the RichEditView do you wish to use? There is a RichEdit Control on the tools panel. You can anchor that so that it cover the entire window and streches as the window is resized.
Rocky Moore
|
|
|
|
|
is there any way to retrieve data from DataTable using regular SQL
statement, especially aggregate funcs like AVG(column) or SUM(column)
looks like DataTable.Select("AVG(column)") doesnt work, because it only uses
the agrument as a filter expr, not SQL
(i dont want to access the source database again using OleDBCommand, because the SQL command involves a few inner joins and it just takes too long)
manson
|
|
|
|
|
Look at the "DataColumn.Expression Property" in the help. It shows ways to use Aggregates and "DataView" has more information on filtering and sorting.
Rocky Moore
|
|
|
|
|
|
Hi,
Basically I'm trying to create a "selection rectagle" much like the one on the window's desk top when you click the desktop and move the mouse to select multiple icons.
I've thought of two ways to do this:
1) I'm tried to draw a rectagle as I drag the mouse around on a Form. I can draw a rectagle directly on Form but the problem is that any controls that are on the Form appear OVER the rectangle. -- Is there anyway I can get the rectagle to be on top of ALL the contols on the Form? Or can I create a Graphics region that overlays the Form (and all the controls on the Form) in such a way that this Graphics reagion is the "top most" region/window?
2) For my second attempt I created a UserControl and tried to make its background transparent. But this simply did not work. Is there any way to do this. If so then I could simply resize this control as the mouse moved and that would simulate a "selection area/rect".
OR maybe you have a third approach that I should try ( ? )
Thanks in advance!
|
|
|
|
|
albean wrote:
Or can I create a Graphics region that overlays the Form (and all the controls on the Form) in such a way that this Graphics reagion is the "top most" region/window?
Get a handle to the desktop and draw on that. Don't forget to clip the rectangle to your form window.
It sounds like your drawing on your form, doing an update which shows the rectangle and then the controls are being drawn on top of that. If that's the case, then you need to draw a rectangle using XOR and prevent the form and the controls from updating.
Todd Smith
|
|
|
|
|
Todd Smith wrote:
It sounds like your drawing on your form, doing an update which shows the rectangle and then the controls are being drawn on top of that. If that's the case, . . .
Todd,
Thanks for your time. Yes, your diagnosis is perfectly correct. I'm using the Graphics object of the Form and then using the DrawRectangle method.
Todd Smith wrote:
then you need to draw a rectangle using XOR
Do you mean that I should draw the rectangle in a new Region variable and then take this Region and XOR it w/ the graphics object of the Form?
------
Another problem that I’m having (using my previous incorrect method from my first post i.e. DrawRectangle) is that I need to erase the old rectangle as the user drags the mouse. So would it then be possible to take the Region that I just described above and XOR it again to erase the "superposition" of the rectagle on the form, and then repeat the process above with a "new" rectangle?
Thanks again.
|
|
|
|
|
Todd,
Thanks again for your time. I found this link that contains the solution to the problem I faced. Thanks again for your help!
http://support.microsoft.com/default.aspx?ID=KB;EN-US;Q314945&
|
|
|
|