Click here to Skip to main content
15,508,644 members
Home / Discussions / C#
   

C#

 
GeneralRe: RichTextBox - large string loading problem Pin
mav.northwind27-Feb-07 10:23
mav.northwind27-Feb-07 10:23 
GeneralRe: RichTextBox - large string loading problem Pin
sam#28-Feb-07 2:10
sam#28-Feb-07 2:10 
GeneralRe: RichTextBox - large string loading problem Pin
mav.northwind28-Feb-07 7:29
mav.northwind28-Feb-07 7:29 
GeneralRe: RichTextBox - large string loading problem Pin
sam#28-Feb-07 22:09
sam#28-Feb-07 22:09 
GeneralRe: RichTextBox - large string loading problem Pin
mav.northwind3-Mar-07 8:20
mav.northwind3-Mar-07 8:20 
Questioninheritance Issue Pin
tcss26-Feb-07 21:43
tcss26-Feb-07 21:43 
AnswerRe: inheritance Issue Pin
tcss26-Feb-07 22:33
tcss26-Feb-07 22:33 
GeneralRe: inheritance Issue Pin
Jakub Mller27-Feb-07 0:43
Jakub Mller27-Feb-07 0: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 9:27
tcss2-Mar-07 9:27 
QuestionHow to get the instance of a running process ? Pin
Mr Perfect26-Feb-07 18:22
Mr Perfect26-Feb-07 18:22 
AnswerRe: How to get the instance of a running process ? Pin
Sandeep Akhare26-Feb-07 20:24
Sandeep Akhare26-Feb-07 20:24 
AnswerRe: How to get the instance of a running process ? Pin
Sven Cipido26-Feb-07 21:57
Sven Cipido26-Feb-07 21:57 
AnswerRe: How to get the instance of a running process ? Pin
wasife27-Feb-07 0:26
wasife27-Feb-07 0:26 
AnswerRe: How to get the instance of a running process ? Pin
Martin#27-Feb-07 0:38
Martin#27-Feb-07 0:38 
QuestionCreate FTP Site from website Pin
LoneWolfAGQ226-Feb-07 14:04
LoneWolfAGQ226-Feb-07 14:04 
AnswerRe: Create FTP Site from website Pin
mike montagne26-Feb-07 14:27
mike montagne26-Feb-07 14:27 
QuestionRe: Create FTP Site from website Pin
LoneWolfAGQ227-Feb-07 9:11
LoneWolfAGQ227-Feb-07 9:11 
GeneralNeed help. Hit learning barrier. [modified] Pin
JMOdom26-Feb-07 11:58
JMOdom26-Feb-07 11:58 
GeneralRe: Need help. Hit learning barrier. Pin
Christian Graus26-Feb-07 12:09
mveChristian Graus26-Feb-07 12:09 
GeneralRe: Need help. Hit learning barrier. Pin
DavidNohejl26-Feb-07 12:13
DavidNohejl26-Feb-07 12:13 
GeneralRe: Need help. Hit learning barrier. Pin
JMOdom26-Feb-07 18:24
JMOdom26-Feb-07 18:24 
QuestionDeriving genric class from another custom generic... two signatures, which is correct ... lets see some sharpness [modified] Pin
clooge26-Feb-07 11:31
clooge26-Feb-07 11:31 
AnswerRe: Deriving genric class from another custom generic... two signatures, which is correct ... lets see some sharpness Pin
Ed.Poore26-Feb-07 13:21
Ed.Poore26-Feb-07 13:21 
GeneralRe: Deriving genric class from another custom generic... two signatures, which is correct ... lets see some sharpness Pin
clooge27-Feb-07 5:32
clooge27-Feb-07 5:32 
GeneralRe: Deriving genric class from another custom generic... two signatures, which is correct ... lets see some sharpness Pin
Martin#27-Feb-07 6:03
Martin#27-Feb-07 6:03 

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.