Quantcast
Channel: Windows Forms Data Controls and Databinding forum
Viewing all articles
Browse latest Browse all 2535

User Control EventLog Property

$
0
0
I am creating a user control that will have an eventlog control on it and I want to put a property on my custom control that will show a list of event logs on my current pc. I am having trouble setting the type for the property that isn't giving me the result I am looking for. When I put my custom control onto a form, I want to see a drop down list of the event logs. I've tried setting the property as a String array, as a List and as EventLog[]. This is my current code:

        /// <summary>
        /// Gets or sets the name of the log to read from and write to
        /// </summary>
        [Description("Gets or sets the name of the log to read from and write to"), Category("EventLog"), Browsable(true)]
        public EventLog[] LogName {
            get;
            set;
        }
This is the control Load event
        private void ServiceLogEV_Load(object sender, EventArgs e) {
            if (this.MachineName.Length == 0)
                this.MachineName = ".";
            this.LogName = EventLog.GetEventLogs(MachineName);
        }
This is what it gives me


Any help is greatly appreciated.


Viewing all articles
Browse latest Browse all 2535

Trending Articles