Click here to Skip to main content
15,907,395 members
Home / Discussions / C#
   

C#

 
GeneralRe: pinvokes from windows service Pin
jacobjordan9-Mar-10 15:47
jacobjordan9-Mar-10 15:47 
GeneralRe: pinvokes from windows service Pin
DaveyM699-Mar-10 16:00
professionalDaveyM699-Mar-10 16:00 
GeneralRe: pinvokes from windows service Pin
Luc Pattyn9-Mar-10 16:02
sitebuilderLuc Pattyn9-Mar-10 16:02 
GeneralRe: pinvokes from windows service Pin
DaveyM699-Mar-10 15:26
professionalDaveyM699-Mar-10 15:26 
QuestionSender as form access class propertys Pin
Member 69748219-Mar-10 12:29
Member 69748219-Mar-10 12:29 
AnswerRe: Sender as form access class propertys [modified] Pin
Luc Pattyn9-Mar-10 12:36
sitebuilderLuc Pattyn9-Mar-10 12:36 
GeneralRe: Sender as form access class propertys Pin
Member 69748219-Mar-10 12:46
Member 69748219-Mar-10 12:46 
GeneralRe: Sender as form access class propertys [modified] Pin
Luc Pattyn9-Mar-10 12:54
sitebuilderLuc Pattyn9-Mar-10 12:54 
if all candidate senders share some user-defined functionality (would be necessary if you want to invoke a method on such sending form), then the solution would be to define an interface, and make all those forms "implement" the interface, which should mean you add ", IMyFunctionality" to the class declaration, as in:
C#
public class MyForm1 : Form, IMyCommonFormFunctionality { ... }


where you need to define the interface, something like (outside all classes!):
C#
public interface IMyCommonFormFunctionality {
    void login();
}


Then in your class, do:
C#
IMyCommonFormFunctionality CurrentForm;
...
CurrentForm=sender as IMyCommonFormFunctionality;


BTW: by convention public method names should be CamelCased, i.e. start with an upper-case letter.

[ADDED]
I doubt very much that adding login logic to a bunch of forms is the right way to go. Object orientation dictates to separate concerns, not mix them like that.
[/ADDED]

Smile | :)
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]

I only read code that is properly formatted, adding PRE tags is the easiest way to obtain that.

modified on Tuesday, March 9, 2010 7:11 PM

QuestionTelerik RadGred Question Pin
Kevin Marois9-Mar-10 11:16
professionalKevin Marois9-Mar-10 11:16 
QuestionC# and MySQL Pin
Evgeni579-Mar-10 10:21
Evgeni579-Mar-10 10:21 
AnswerRe: C# and MySQL Pin
Luc Pattyn9-Mar-10 10:40
sitebuilderLuc Pattyn9-Mar-10 10:40 
GeneralRe: C# and MySQL Pin
Evgeni579-Mar-10 21:01
Evgeni579-Mar-10 21:01 
QuestionRemap a COM port programmatically Pin
taralex9-Mar-10 9:01
taralex9-Mar-10 9:01 
AnswerRe: Remap a COM port programmatically Pin
Luc Pattyn9-Mar-10 10:45
sitebuilderLuc Pattyn9-Mar-10 10:45 
GeneralRe: Remap a COM port programmatically Pin
taralex9-Mar-10 11:07
taralex9-Mar-10 11:07 
QuestionEasy question about Custom Controls from a newbie. Pin
Kanetakeo9-Mar-10 8:16
Kanetakeo9-Mar-10 8:16 
AnswerRe: Easy question about Custom Controls from a newbie. Pin
DaveyM699-Mar-10 8:50
professionalDaveyM699-Mar-10 8:50 
GeneralRe: Easy question about Custom Controls from a newbie. Pin
Kanetakeo9-Mar-10 10:32
Kanetakeo9-Mar-10 10:32 
GeneralRe: Easy question about Custom Controls from a newbie. Pin
DaveyM699-Mar-10 13:20
professionalDaveyM699-Mar-10 13:20 
QuestionA new, open source, Outlook panel plugin in C# Pin
François-Denis Gonthier9-Mar-10 7:21
François-Denis Gonthier9-Mar-10 7:21 
AnswerRe: A new, open source, Outlook panel plugin in C# Pin
Wes Aday9-Mar-10 8:53
professionalWes Aday9-Mar-10 8:53 
GeneralRe: A new, open source, Outlook panel plugin in C# Pin
François-Denis Gonthier9-Mar-10 9:04
François-Denis Gonthier9-Mar-10 9:04 
GeneralRe: A new, open source, Outlook panel plugin in C# Pin
Garth J Lancaster9-Mar-10 10:40
professionalGarth J Lancaster9-Mar-10 10:40 
GeneralRe: A new, open source, Outlook panel plugin in C# Pin
François-Denis Gonthier15-Mar-10 5:43
François-Denis Gonthier15-Mar-10 5:43 
Questionwhat is the optimal method for handling time-triggered processing Pin
TimWallace9-Mar-10 6:29
TimWallace9-Mar-10 6:29 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.