Click here to Skip to main content
15,904,024 members
Home / Discussions / C#
   

C#

 
Questionerrorlist Pin
kalyanit26-Feb-07 22:58
kalyanit26-Feb-07 22:58 
AnswerRe: errorlist Pin
Colin Angus Mackay26-Feb-07 23:21
Colin Angus Mackay26-Feb-07 23:21 
QuestionHow to pass attributes to an exe?? Pin
Neha_Gupta26-Feb-07 22:17
Neha_Gupta26-Feb-07 22:17 
AnswerRe: How to pass attributes to an exe?? Pin
althamda26-Feb-07 22:38
althamda26-Feb-07 22:38 
AnswerRe: How to pass attributes to an exe?? Pin
Stefan Troschuetz26-Feb-07 22:48
Stefan Troschuetz26-Feb-07 22:48 
AnswerRe: How to pass attributes to an exe?? Pin
Martin#26-Feb-07 23:17
Martin#26-Feb-07 23:17 
QuestionRichTextBox - large string loading problem Pin
Darko_R26-Feb-07 21:58
Darko_R26-Feb-07 21:58 
AnswerRe: RichTextBox - large string loading problem Pin
sam#27-Feb-07 0:45
sam#27-Feb-07 0:45 
AnswerRe: RichTextBox - large string loading problem Pin
sam#27-Feb-07 0:45
sam#27-Feb-07 0:45 
GeneralRe: RichTextBox - large string loading problem Pin
mav.northwind27-Feb-07 1:17
mav.northwind27-Feb-07 1:17 
GeneralRe: RichTextBox - large string loading problem Pin
Luc Pattyn27-Feb-07 2:16
sitebuilderLuc Pattyn27-Feb-07 2:16 
QuestionRe: RichTextBox - large string loading problem Pin
Darko_R27-Feb-07 8:26
Darko_R27-Feb-07 8:26 
AnswerRe: RichTextBox - large string loading problem Pin
mav.northwind27-Feb-07 9:39
mav.northwind27-Feb-07 9:39 
GeneralRe: RichTextBox - large string loading problem Pin
sam#27-Feb-07 2:37
sam#27-Feb-07 2:37 
GeneralRe: RichTextBox - large string loading problem Pin
mav.northwind27-Feb-07 9:23
mav.northwind27-Feb-07 9:23 
GeneralRe: RichTextBox - large string loading problem Pin
sam#28-Feb-07 1:10
sam#28-Feb-07 1:10 
GeneralRe: RichTextBox - large string loading problem Pin
mav.northwind28-Feb-07 6:29
mav.northwind28-Feb-07 6:29 
GeneralRe: RichTextBox - large string loading problem Pin
sam#28-Feb-07 21:09
sam#28-Feb-07 21:09 
GeneralRe: RichTextBox - large string loading problem Pin
mav.northwind3-Mar-07 7:20
mav.northwind3-Mar-07 7:20 
Questioninheritance Issue Pin
tcss26-Feb-07 20:43
tcss26-Feb-07 20:43 
AnswerRe: inheritance Issue Pin
tcss26-Feb-07 21:33
tcss26-Feb-07 21:33 
GeneralRe: inheritance Issue Pin
Jakub Mller26-Feb-07 23:43
Jakub Mller26-Feb-07 23:43 
I think, the better way is add event "ShowDialog_XY", which will be raised on [enter] key press and process event in method handled to this event.

The event arguments should contain result of dialog.

For example:

// derived class from datagridview
public class MyGrid : DataGridView{

    // this method is called from "ProcessCmdKey" or "OnKeyPress", etc...
    protected virtual void ProcessEnterKeyPress() {
        MyGridProcessEventArgs me = new MyGridProcessEventArgs();
        this.OnProcessEnterKeyPress( me );
        if ( me.Handled == false ) {
            // ??? throw exception - enter key press is not handled ???
        }
        object result = me.Result;
        if ( result == null ) {
            // ??? throw exception - no result ???
        }

        this.ProcessResultOfEnterKeyPress( result );
    }
    protected virtual void ProcessResultOfEnterKeyPress( object result ) {
        // this method process result of enter key action
    }

    protected virtual void OnProcessEnterKeyPress( MyGridProcessEventArgs e ) {
        EventHandler handler = this.ProcessEnterKeyPress;
        if ( handler != null ) { handler( this, e ); }
    }
    public event EventHandler<MyGridProcessEventArgs> ProcessEnterKeyPress;
}

// contains arguments for mygrid's event
public class MyGridProcessEventArgs : EventArgs {
    private bool handled;
    private object result;

    public bool Handled {
        get { return this.handled; }
        set { this.handled = value; }
    }
    public bool Result { get { ... } set { ... } }
}

// form's class
public class Form1 : Form {
    ...
    public Form1() {
        this.InitializeComponents();

        this.myGrid1.ProcessEnterKeyPress += this.myGrid1_ProcessEnterKeyPress;
    }

    private void myGrid1_ProcessEnterKeyPress( MyGridProcessEventArgs e ) {
        // there you should show dialog or something else
    }
}


Geniality is in simplicity.

GeneralRe: inheritance Issue Pin
tcss2-Mar-07 8:27
tcss2-Mar-07 8:27 
QuestionHow to get the instance of a running process ? Pin
Mr Perfect26-Feb-07 17:22
Mr Perfect26-Feb-07 17:22 
AnswerRe: How to get the instance of a running process ? Pin
Sandeep Akhare26-Feb-07 19:24
Sandeep Akhare26-Feb-07 19:24 

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.