Click here to Skip to main content
16,007,779 members
Home / Discussions / C#
   

C#

 
GeneralRe: checked file download from gridview Pin
grkrishna31-Mar-09 21:09
grkrishna31-Mar-09 21:09 
GeneralRe: checked file download from gridview Pin
musefan31-Mar-09 21:35
musefan31-Mar-09 21:35 
QuestionValidations of Username and Password feild Pin
swapna5631-Mar-09 1:13
swapna5631-Mar-09 1:13 
AnswerRe: Validations of Username and Password feild Pin
Vinziee31-Mar-09 1:25
Vinziee31-Mar-09 1:25 
GeneralRe: Validations of Username and Password feild Pin
Henry Minute31-Mar-09 1:30
Henry Minute31-Mar-09 1:30 
AnswerRe: Validations of Username and Password feild Pin
King Julien31-Mar-09 1:38
King Julien31-Mar-09 1:38 
AnswerRe: Validations of Username and Password feild Pin
vinodkrebc31-Mar-09 2:35
vinodkrebc31-Mar-09 2:35 
QuestionFont Disposal Pin
DaveyM6931-Mar-09 1:13
professionalDaveyM6931-Mar-09 1:13 
I have the following class structure - as you can see the nested class has an additional Font that needs disposing.

I'm not too hot on Disposal techniques (the laziness of the managed world!), is the method I've used sufficient and 'safe'?
public class MyClass : IDisposable
{
    private MyNestedForm myNestedForm;

    public MyClass()
    {
        myNestedForm = new MyNestedForm();
    }

    public Font XYZFont
    {
        set { myNestedForm.XYZFont = value; }
    }

    public void Dispose()
    {
        myNestedForm.Dispose();
    }

    internal class MyNestedForm : Form
    {
        private Font xyzFont;

        public Font XYZFont
        {
            get
            {
                if(xyzFont==null)
                    return Control.DefaultFont;
                else
                    return xyzFont;
            }
            set { xyzFont = value; }
        }

        protected override void Dispose(bool disposing)
        {
            if (xyzFont != null)
                xyzFont.Dispose();
            base.Dispose(disposing);
        }
    }
}


Dave
BTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)
Visual Basic is not used by normal people so we're not covering it here. (Uncyclopedia)

AnswerRe: Font Disposal Pin
N a v a n e e t h31-Mar-09 2:34
N a v a n e e t h31-Mar-09 2:34 
GeneralRe: Font Disposal Pin
DaveyM6931-Mar-09 2:46
professionalDaveyM6931-Mar-09 2:46 
AnswerRe: Font Disposal Pin
Le centriste31-Mar-09 3:15
Le centriste31-Mar-09 3:15 
GeneralRe: Font Disposal Pin
DaveyM6931-Mar-09 3:31
professionalDaveyM6931-Mar-09 3:31 
QuestionReturning Random Unicode Characters Pin
Mustafa Ismail Mustafa31-Mar-09 1:00
Mustafa Ismail Mustafa31-Mar-09 1:00 
AnswerRe: Returning Random Unicode Characters Pin
Dominik Reichl31-Mar-09 1:22
Dominik Reichl31-Mar-09 1:22 
GeneralRe: Returning Random Unicode Characters Pin
Mustafa Ismail Mustafa31-Mar-09 1:37
Mustafa Ismail Mustafa31-Mar-09 1:37 
GeneralRe: Returning Random Unicode Characters Pin
Alan Balkany31-Mar-09 3:47
Alan Balkany31-Mar-09 3:47 
GeneralRe: Returning Random Unicode Characters Pin
Mustafa Ismail Mustafa31-Mar-09 5:16
Mustafa Ismail Mustafa31-Mar-09 5:16 
GeneralRe: Returning Random Unicode Characters Pin
Alan Balkany31-Mar-09 7:25
Alan Balkany31-Mar-09 7:25 
GeneralRe: Returning Random Unicode Characters Pin
Mustafa Ismail Mustafa31-Mar-09 7:57
Mustafa Ismail Mustafa31-Mar-09 7:57 
GeneralRe: Returning Random Unicode Characters Pin
Alan Balkany31-Mar-09 8:37
Alan Balkany31-Mar-09 8:37 
QuestionHow to check all the checkboxes in atree at a time Pin
Nekkantidivya31-Mar-09 0:57
Nekkantidivya31-Mar-09 0:57 
AnswerRe: How to check all the checkboxes in atree at a time Pin
Mustafa Ismail Mustafa31-Mar-09 1:02
Mustafa Ismail Mustafa31-Mar-09 1:02 
QuestionTo Create or to Clear Pin
musefan31-Mar-09 0:37
musefan31-Mar-09 0:37 
AnswerRe: To Create or to Clear Pin
SeMartens31-Mar-09 0:46
SeMartens31-Mar-09 0:46 
GeneralRe: To Create or to Clear Pin
musefan31-Mar-09 0:50
musefan31-Mar-09 0:50 

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.