Click here to Skip to main content
16,004,919 members
Home / Discussions / C#
   

C#

 
GeneralRe: which is better to choose? Pin
N a v a n e e t h31-Aug-08 18:09
N a v a n e e t h31-Aug-08 18:09 
AnswerRe: which is better to choose? Pin
nelsonpaixao31-Aug-08 13:13
nelsonpaixao31-Aug-08 13:13 
Questiongetting the public key of the recipient Pin
prasadbuddhika30-Aug-08 19:49
prasadbuddhika30-Aug-08 19:49 
Questionautoincrement alphabets Pin
abhijitjathar30-Aug-08 19:07
abhijitjathar30-Aug-08 19:07 
AnswerRe: autoincrement alphabets Pin
MarkB77730-Aug-08 19:43
MarkB77730-Aug-08 19:43 
AnswerRe: autoincrement alphabets Pin
#realJSOP31-Aug-08 1:46
professional#realJSOP31-Aug-08 1:46 
QuestionProperties Window File Dialog Pin
thrakazog30-Aug-08 13:30
thrakazog30-Aug-08 13:30 
AnswerRe: Properties Window File Dialog Pin
Mbah Dhaim30-Aug-08 14:32
Mbah Dhaim30-Aug-08 14:32 
you can try this sample code
using System;
using System.Collections.Generic;
using System.Text;
using System.Drawing.Design;
using System.Windows.Forms.Design;
using System.ComponentModel;

namespace testproperty
{
    public class TestClass
    {
        public TestClass()
        {
        }
        private int id;
        [System.ComponentModel.Category("Main")]
        [System.ComponentModel.DisplayName("ID of Class")]
        public int Id
        {
            get { return id; }
            set { id = value; }
        }

        private string fileName;
        [System.ComponentModel.Category("Others")]
        [System.ComponentModel.DisplayName("FileName to load")]
        [BrowsableAttribute(true)]
        [EditorAttribute(typeof(OpenFileDialogEditor), typeof(System.Drawing.Design.UITypeEditor))]
        public string FileName
        {
            get { return fileName; }
            set { fileName = value; }
        }
    }
    
    [System.Security.Permissions.PermissionSet(System.Security.Permissions.SecurityAction.Demand, Name = "FullTrust")] 
    public class OpenFileDialogEditor : System.Drawing.Design.UITypeEditor
    {
        public OpenFileDialogEditor() { }
        public override System.Drawing.Design.UITypeEditorEditStyle GetEditStyle(System.ComponentModel.ITypeDescriptorContext context)
        {
            return UITypeEditorEditStyle.Modal;
        }
        public override object EditValue(System.ComponentModel.ITypeDescriptorContext context, IServiceProvider provider, object value)
        {               
            using (System.Windows.Forms.OpenFileDialog ofd = new System.Windows.Forms.OpenFileDialog())
            {
                if (value != null && !string.IsNullOrEmpty(value.ToString()))
                {
                    try { ofd.FileName = value.ToString(); }
                    catch { }
                }
                if (ofd.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                {
                    return ofd.FileName;
                }
                return string.Empty;
            }
        }
    }
}


look the FileName property of TestClass
hope it helps

dhaim
programming is a hobby that make some money as side effect Smile | :)

AnswerRe: Properties Window File Dialog Pin
Thomas Stockwell30-Aug-08 14:33
professionalThomas Stockwell30-Aug-08 14:33 
AnswerRe: Properties Window File Dialog Pin
Dr. Emmett Brown30-Aug-08 14:45
Dr. Emmett Brown30-Aug-08 14:45 
QuestionHow can we disable BUMB sound ? Pin
Mohammad Dayyan30-Aug-08 10:20
Mohammad Dayyan30-Aug-08 10:20 
AnswerRe: How can we disable BUMB sound ? Pin
Christian Graus30-Aug-08 14:47
protectorChristian Graus30-Aug-08 14:47 
GeneralRe: How can we disable BUMB sound ? Pin
Mohammad Dayyan30-Aug-08 23:06
Mohammad Dayyan30-Aug-08 23:06 
GeneralRe: How can we disable BUMB sound ? Pin
Guffa31-Aug-08 4:03
Guffa31-Aug-08 4:03 
GeneralRe: How can we disable BUMB sound ? Pin
Mohammad Dayyan31-Aug-08 4:31
Mohammad Dayyan31-Aug-08 4:31 
GeneralRe: How can we disable BUMB sound ? Pin
Guffa31-Aug-08 10:32
Guffa31-Aug-08 10:32 
GeneralRe: How can we disable BUMB sound ? Pin
Mohammad Dayyan2-Sep-08 4:37
Mohammad Dayyan2-Sep-08 4:37 
QuestionCreating Blank if zero decimal format string Pin
AndrusM30-Aug-08 6:57
AndrusM30-Aug-08 6:57 
AnswerRe: Creating Blank if zero decimal format string Pin
Wendelius30-Aug-08 7:50
mentorWendelius30-Aug-08 7:50 
GeneralRe: Creating Blank if zero decimal format string Pin
AndrusM31-Aug-08 5:58
AndrusM31-Aug-08 5:58 
GeneralRe: Creating Blank if zero decimal format string Pin
Wendelius31-Aug-08 6:33
mentorWendelius31-Aug-08 6:33 
GeneralRe: Creating Blank if zero decimal format string Pin
AndrusM31-Aug-08 9:57
AndrusM31-Aug-08 9:57 
GeneralRe: Creating Blank if zero decimal format string Pin
Wendelius31-Aug-08 10:24
mentorWendelius31-Aug-08 10:24 
GeneralRe: Creating Blank if zero decimal format string Pin
AndrusM31-Aug-08 10:35
AndrusM31-Aug-08 10:35 
GeneralRe: Creating Blank if zero decimal format string Pin
Wendelius31-Aug-08 10:58
mentorWendelius31-Aug-08 10:58 

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.