Click here to Skip to main content
15,906,463 members
Home / Discussions / C#
   

C#

 
GeneralRe: Hello ? Pin
musefan6-Jan-11 0:39
musefan6-Jan-11 0:39 
QuestionSetFilePointerEx not moving pointer Pin
Chris Copeland31-Dec-10 6:11
mveChris Copeland31-Dec-10 6:11 
AnswerRe: SetFilePointerEx not moving pointer Pin
jchoover31-Dec-10 6:30
jchoover31-Dec-10 6:30 
GeneralRe: SetFilePointerEx not moving pointer Pin
Chris Copeland31-Dec-10 6:34
mveChris Copeland31-Dec-10 6:34 
GeneralRe: SetFilePointerEx not moving pointer Pin
jchoover31-Dec-10 7:11
jchoover31-Dec-10 7:11 
GeneralRe: SetFilePointerEx not moving pointer Pin
Chris Copeland31-Dec-10 7:20
mveChris Copeland31-Dec-10 7:20 
GeneralRe: SetFilePointerEx not moving pointer Pin
jchoover31-Dec-10 7:40
jchoover31-Dec-10 7:40 
GeneralRe: SetFilePointerEx not moving pointer Pin
Chris Copeland31-Dec-10 7:51
mveChris Copeland31-Dec-10 7:51 
GeneralRe: SetFilePointerEx not moving pointer Pin
Henry Minute31-Dec-10 12:07
Henry Minute31-Dec-10 12:07 
GeneralRe: SetFilePointerEx not moving pointer [modified] Pin
Chris Copeland1-Jan-11 1:12
mveChris Copeland1-Jan-11 1:12 
AnswerRe: SetFilePointerEx not moving pointer Pin
Henry Minute31-Dec-10 7:15
Henry Minute31-Dec-10 7:15 
GeneralRe: SetFilePointerEx not moving pointer Pin
Luc Pattyn1-Jan-11 16:07
sitebuilderLuc Pattyn1-Jan-11 16:07 
GeneralRe: SetFilePointerEx not moving pointer Pin
Henry Minute2-Jan-11 5:31
Henry Minute2-Jan-11 5:31 
AnswerRe: SetFilePointerEx not moving pointer Pin
Luc Pattyn1-Jan-11 16:09
sitebuilderLuc Pattyn1-Jan-11 16:09 
QuestionC# dynamic controls Pin
Software200731-Dec-10 5:18
Software200731-Dec-10 5:18 
AnswerRe: C# dynamic controls Pin
Interflo31-Dec-10 5:40
Interflo31-Dec-10 5:40 
GeneralRe: C# dynamic controls Pin
Software200731-Dec-10 5:50
Software200731-Dec-10 5:50 
GeneralRe: C# dynamic controls Pin
Henry Minute31-Dec-10 6:09
Henry Minute31-Dec-10 6:09 
GeneralRe: C# dynamic controls Pin
Espen Harlinn1-Jan-11 8:17
professionalEspen Harlinn1-Jan-11 8:17 
GeneralRe: C# dynamic controls Pin
Henry Minute1-Jan-11 8:24
Henry Minute1-Jan-11 8:24 
AnswerRe: C# dynamic controls Pin
Bernhard Hiller2-Jan-11 21:48
Bernhard Hiller2-Jan-11 21:48 
QuestionSubclassing a Checkbox within a ToolStrip Warning Question Pin
Rafone31-Dec-10 4:23
Rafone31-Dec-10 4:23 
I am trying to subclassing a checkbox inside a toolstrip. Works OK but the VS interface does not remember the checkboxs after running the app.
Ran the profiler and got this warning...
Warning 11 CA2000 : Microsoft.Reliability : In method 'ToolStripCheckBox.ToolStripCheckBox()', call System.IDisposable.Dispose on object 'new CheckBox()' before all references to it are out of scope.

So I'm not sure where to place the System.IDisposable.Dispose in my checkbox class. Can someone assist me in this.
Below is the code ...

using System;
using System.Windows.Forms;
using System.Windows.Forms.Design;

[System.ComponentModel.DesignerCategory("code")]
[ToolStripItemDesignerAvailability(ToolStripItemDesignerAvailability.ToolStrip | ToolStripItemDesignerAvailability.ToolStrip)]

public class ToolStripCheckBox : ToolStripControlHost
{
   
    public ToolStripCheckBox() : base(new CheckBox())
    {
        
    }

    public CheckBox CheckBoxControl
    {
        get { return Control as CheckBox; }
    }

    public bool Checked
    {
        get { return CheckBoxControl.Checked; }
        set { CheckBoxControl.Checked = value; }
    }

    public event EventHandler CheckedChanged;

    public void OnCheckedChanged(object sender, EventArgs e)
    {
        // not thread safe!
        if (CheckedChanged != null)
        {
            CheckedChanged(sender, e);
        }
    }

    protected override void OnSubscribeControlEvents(Control control)
    {
        base.OnSubscribeControlEvents(control);
        (control as CheckBox).CheckedChanged += OnCheckedChanged;
    }

    protected override void OnUnsubscribeControlEvents(Control control)
    {
        base.OnUnsubscribeControlEvents(control);
        (control as CheckBox).CheckedChanged -= OnCheckedChanged;
    }
}



tia
Rafone
Statistics are like bikini's...
What they reveal is astonishing ...
But what they hide is vital ...

AnswerRe: Subclassing a Checkbox within a ToolStrip Warning Question Pin
Not Active31-Dec-10 7:15
mentorNot Active31-Dec-10 7:15 
GeneralRe: Subclassing a Checkbox within a ToolStrip Warning Question Pin
Rafone31-Dec-10 10:04
Rafone31-Dec-10 10:04 
GeneralRe: Subclassing a Checkbox within a ToolStrip Warning Question Pin
Not Active31-Dec-10 10:19
mentorNot Active31-Dec-10 10:19 

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.