|
There should be someother way of doing it(something seems to be wrong here, but I couldn't figure out), but did you try passing ref Object
Cheers,
Kannan
|
|
|
|
|
Why why why? object is by ref all ready!
MyDUMeter: a .NET DUMeter clone "Thats like saying "hahahaha he doesnt know the difference between a cyberneticradioactivenuclothermolopticdimswitch and a biocontainingspherogramotron", but with words you have really never heard of."
|
|
|
|
|
First, you only need to pass an object by reference if you are changing the object reference. If you're only changing properties or calling methods on the object, you should pass it by value.
When you pass a variable by reference (ref Parameter or out Parameter ), the variable type has to match precisely. For example, the following code would attempt to assign a Textbox to a Button variable:
void Test(ref Control c)
{
c = new Textbox();
}
...
Button b = myButton;
Test(ref b); The simplest way to pass an object by reference to a function which expects a base class is to use a temporary variable of the correct type. Downcast the actual object, call the function, and then try to upcast the variable back to the object:
Control temp = (Control)myButton;
Test(ref temp);
myButton = (Button)temp; In this case, if anything other than a Button (or a class derived from Button ) has been assigned to the reference variable, you will get a runtime error.
"These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer
|
|
|
|
|
Hey folks,
I am working on a multi-threaded windows app and I have run into a bit of a design snag. I’d like to follow a MVC type of design as much as possible; so I want to separate all of the business and event handling logic from the form.
To do this without passing references to controls and forms all over the place, it looks like a Mediator is the sure fire way to go. But, the downside of the classical Mediator is that all the controls must extend (or implement) a “Colleague” base class in order to be aware of the Mediator. I really don’t want to have to subclass every possible control that I might use.
Does anybody have some insight to share on this one? Is there another approach that I am missing?
[edit]
An idea I have is to implement the Mediator using an Observer to force the UI to update in response to events.
[/edit]
TIA
Chris
But I, being poor, have only my dreams.
I have spread my dreams under your feet;
Tread softly, because you tread on my dreams.
- Yeats
|
|
|
|
|
try using an interface.... IColleague
"When the only tool you have is a hammer, a sore thumb you will have."
|
|
|
|
|
try using an interface.... IColleague
Thanks for the input Philip.
I was actualy trying to avoid implementing an interface as I was hoping to be able to just use "any old" control. But, it looks like using an interface or reflecting the controls may be the two most reasonable approachs. I'll probably whip up a little test app today and see how I like the two approaches.
Thanks again.
But I, being poor, have only my dreams.
I have spread my dreams under your feet;
Tread softly, because you tread on my dreams.
- Yeats
|
|
|
|
|
Chris Austin wrote:
To do this without passing references to controls and forms all over the place
IMHO interfaces, reflection, virtual methods and event subscriptions are helpful in this area. And quite honestly there is nothing new compared to what we already have with C/C++.
|
|
|
|
|
IMHO interfaces, reflection, virtual methods and event subscriptions are helpful in this area.
After a night of not thinking about it I arrived at almost the same conclusion. If i want this the be in any way flexable I will probably need to use reflection.
And quite honestly there is nothing new compared to what we already have with C/C++.
Can't disagree with you there. Just trying to learn a new tool.
Thanks for your input.
But I, being poor, have only my dreams.
I have spread my dreams under your feet;
Tread softly, because you tread on my dreams.
- Yeats
|
|
|
|
|
I am looking for a .NET grid product that has the following features...
1) It works with the IDE and you modify the grid using properties.
2) It supports ADO.NET
3) It is basically a small set of files and doesn't require you to download the entire SDK
4) They have some C# samples.
5) They have a free download so I can try it out.
Surprisingly, I've downloaded 5 demos so far and none have come close to doing half of these features.
Thanks!!
|
|
|
|
|
psdavis wrote:
1) It works with the IDE and you modify the grid using properties.
have you tried the xceed grid? http://www.xceedsoft.com[^] its design time support kicks ass.
psdavis wrote:
3) It is basically a small set of files and doesn't require you to download the entire SDK
umm....i think ur gonna need the sdk if you wanna program in .NET.
1001111111011101111100111100101011110011110100101110010011010010 Sonork | 100.21142 | TheEclypse
|
|
|
|
|
|
Our company uses Infragistics (http://www.infragistics.com[^]) WinForms controls, and so far, we are quite happy with their quality. Infragistics also has several WebForms controls, including a grid control, but we did not explore them yet.
Alexandre Kojevnikov
MCP (SQL2K)
Leuven, Belgium
|
|
|
|
|
Hi Pal,
This is absolutely Right! I have been working on Infragistics Control library for a long time now! The libraries are available for both Windows as well as Web Applications with several controls which were not available easily before! It provides the UltraGrid control which is the Best Grid I have ever seen in my Life! It has tremendous support for customization. Trial version of it is available from the Sitespecified above.
i.e. Infragistics.com
One of the most important things is that Microsoft itself has given them a lot off support during the build! (At least that's what I learnt).
Yeah, one more thing, On purchase, they provide an excellent Service!
I think you must go for this!
regards
Atul Kale
MCSD, MCT
Sr. Software Engineer
XcelVision Technologies Ltd.
|
|
|
|
|
Hokay Dokay....
I have an MDIParent with a controller window on the side. The controller window creates the instances of the MDIChild forms and defines the MDIParent as the parent of the children. So far so good. All works just dandy -- including managing multiple instances, etc.
Now -- the next enhancement to the app. I need to do processing on the children AFTER they have been created. What I want to do is this:
Delegate an event in my parent form to do the after-creation process.
Have my children raise the event once the form has been loaded.
The question is this: Is there a GOOD existing event I can use to accomplish this that guarantees me that only the children raising the event will trigger the event, or should I define my own event to handle it? I want to make sure that normal window process does not fire this event since what I have to do is rather intense processing!
I was thinking of reusing the CollectionChanged event since my parent is not databound there should be only the intentional firings from my children. Any suggestions ???
_____________________________________________
The world is a dangerous place. Not because of those that do evil, but because of those who look on and do nothing.
|
|
|
|
|
Hi there,
There u got one more Problem in the Forms library . Microsoft has provided enough of Collections almost everywhere possible, but they forgot to make the MDIChildren as a Collection. Unfortunately it is an Array!
So, CollectionChanged etc. is not helpful at all! You have to go for creating your own events for managing the Pre and Post creation processing of ur Child forms.
However, i would like to mention one thing that, default event processing would be synchronous. You may look at using Application.DoEvents method or use a new Thread for performing the processing to make it asyynchronous.
hope this helps!
Atul Kale
Sr. Software Engineer
XcelVision Technologies Ltd.
|
|
|
|
|
I've modified code to display IDE like menu items in FoldersTree(by Carlos H. Perez) context menu.
Each item is newly created menu item with a same system ID and a picture if any was. All it happens when Popup is about to be displayed. Cat't attach picture to this message... I had to do this because of standart menu items under Windows 2000.
if anybody interested, email me to aprokudin@bgs.ru.
Alexei Prokudin.
BGS SmartCard Systems A.G.
Moscow, Russia.
|
|
|
|
|
I found some solutions for adding icons to MenuItem and get them in contextMenu.
i have overriden MenuItem class OnDrawItem and OnMeasureItem and the constructor.
if i try to display it as MainMenu ContextMenu or ListView ContextMenu it works fine, but if iam going to display this in NotifyIcon it just leave the ContextMenu Blank.
i looked the whole day for some solution to this problem but it just dont work with DLLIMPORT "user32.dll" and some other tricks
if someone knows how to do this please help me i need to set up this project till friday so come on guys code ....
thanks a lot
|
|
|
|
|
try the magic library....they have a really cool menu that has alot of features built into it... http://www.dotnetmagic.com/
they have a PopUp window that works by the mouse X and Y you can with a little bit of code get this window to Pop apon clickin on the notify icon...
Good Luck
Jesse M
The Code Project Is Your Friend...
|
|
|
|
|
thanks a lot i got it with popup & menucommand ! then i imported user32 and got the mousex and mousey position so its able to get icons into the systemtray context menu .
great idea thanks again
|
|
|
|
|
Hi!
Postulates:
- You use VS.NET
- You add a Windows Media Player control to a C# Windows
Form.
- You need to tweak the thingy so the player toolbar(play
stop, rewindetc..) does not appear -you want only the
screen.
Solutions: HelP!!!
Thanks,
|
|
|
|
|
Set the uiMode property of Media Player to none
Cheers,
Kannan
|
|
|
|
|
We have a service here, a telephone number (00973900717) which you can call and send songs and voice jokes to friends (as a phone call not an SMS). I need to develop the same but on a web ite or a windows application, something like:
1. Create audio files (compatible format).
2. start the application.
3. Choose the song or joke or..
4. Eter a friend number.
5. Submit the audio file.
6. Friend will receive it as a phone call
Can I do the same using C#?
Jassim Rahma
|
|
|
|
|
I want to build a snap-in with C#.
How can I do this?
Mahdi Sadegh
|
|
|
|
|
|
Can you do shell type commands (ex. executing programs) in a web form?
Me, wrong!?! Nah, you just need to change your thinking to make me right.
|
|
|
|