Click here to Skip to main content
15,846,571 members
Home / Discussions / C#
   

C#

 
AnswerRe: Not sure if RichTextBox can do this? Pin
Luc Pattyn12-Feb-08 0:09
sitebuilderLuc Pattyn12-Feb-08 0:09 
GeneralRe: Not sure if RichTextBox can do this? Pin
Dewald12-Feb-08 0:16
Dewald12-Feb-08 0:16 
GeneralRe: Not sure if RichTextBox can do this? Pin
DaveyM6912-Feb-08 0:35
professionalDaveyM6912-Feb-08 0:35 
GeneralRe: Not sure if RichTextBox can do this? Pin
Dewald12-Feb-08 1:50
Dewald12-Feb-08 1:50 
AnswerRe: Not sure if RichTextBox can do this? Pin
Pete O'Hanlon12-Feb-08 2:13
subeditorPete O'Hanlon12-Feb-08 2:13 
QuestionLine numbers next to Listview Pin
eyalbi00711-Feb-08 22:15
eyalbi00711-Feb-08 22:15 
GeneralRe: Line numbers next to Listview Pin
N a v a n e e t h11-Feb-08 22:30
N a v a n e e t h11-Feb-08 22:30 
QuestionAre custom attributes read-only? Pin
willydemis11-Feb-08 19:34
willydemis11-Feb-08 19:34 
Quick question- can I programtically set the value of a custom attribute?


--Here is an example of what I am currently doing and it works--

<br />
    [IcVPNPlugin]<br />
    public class myVPN : IVPN<br />
    {<br />
<br />
        //Attributes<br />
<br />
        private VPNState _state;<br />
        private List<string> _profiles;<br />
        private string[] _stringArr;<br />
        private string _username;<br />
        private string _password;<br />
        private string _profile;<br />
        private string _profileTest;<br />
<br />
<br />
        //Constructors<br />
        <br />
        public myVPN()<br />
        {<br />
            _profiles = new List<string>();<br />
            GetProfiles();<br />
<br />
            <br />
            _stringArr = new string[this.Profiles.Count];<br />
            for (int i=0; i<=this.Profiles.Count; i++)<br />
            {<br />
                _stringArr[i] = this.Profiles[i];<br />
            }<br />
        }<br />
        <br />
        <br />
        //Properties<br />
<br />
        [BrowsableAttribute(true), TypeConverter(typeof(DropdownConverter)), RequiredParameter(false, ParameterType = typeof(String)), DropdownValues(new string[] { "profile list 2-0", "profile list 2-1", "profile list 2-2" }, Name = "ProfileTest")]<br />
        public string ProfileTest<br />
        {<br />
            get { return _profileTest; }<br />
            set { _profileTest = value; }<br />
        }<br />



...But I would like to programatically set the values of the DropdownValues attribute as such:
<br />
    [IcVPNPlugin]<br />
    public class myVPN : IVPN<br />
    {<br />
<br />
        //Attributes<br />
<br />
        private VPNState _state;<br />
        private List<string> _profiles;<br />
        private string[] _stringArr;<br />
        private string _username;<br />
        private string _password;<br />
        private string _profile;<br />
        private string _profileTest;<br />
<br />
<br />
        //Constructors<br />
        <br />
        public myVPN()<br />
        {<br />
            _profiles = new List<string>();<br />
            GetProfiles();<br />
<br />
            <br />
            _stringArr = new string[this.Profiles.Count];<br />
            for (int i=0; i<=this.Profiles.Count; i++)<br />
            {<br />
                _stringArr[i] = this.Profiles[i];<br />
            }<br />
        }<br />
        <br />
        <br />
        //Properties<br />
<br />
        [BrowsableAttribute(true), TypeConverter(typeof(DropdownConverter)), RequiredParameter(false, ParameterType = typeof(String)), DropdownValues(_stringArr, Name = "ProfileTest")]<br />
        public string ProfileTest<br />
        {<br />
            get { return _profileTest; }<br />
            set { _profileTest = value; }<br />
        }<br />



Of course this doesn't work- which is why I am posing the question here. Is there any way at all to be able to accomplish this? I am pretty sure that properties are instantiated by the CLR before the contructor. So if that is true, then any work I did in the contructor that would be passed to the attribute would just be too late- which, I think, is why this isn't working. But perhaps a static property could work? Now I am just guessing... Thanks much!
AnswerRe: Are custom attributes read-only? Pin
Roger Alsing12-Feb-08 0:47
Roger Alsing12-Feb-08 0:47 
AnswerRe: Are custom attributes read-only? Pin
Daniel Grunwald12-Feb-08 1:28
Daniel Grunwald12-Feb-08 1:28 
GeneralI need help with a program Pin
Alex50111-Feb-08 17:05
Alex50111-Feb-08 17:05 
GeneralRe: I need help with a program Pin
MarkB77711-Feb-08 17:22
MarkB77711-Feb-08 17:22 
GeneralRe: I need help with a program Pin
Christian Graus11-Feb-08 19:11
protectorChristian Graus11-Feb-08 19:11 
GeneralVolatile?? :confused: Pin
geekfromindia11-Feb-08 14:38
geekfromindia11-Feb-08 14:38 
GeneralRe: Volatile?? :confused: Pin
Colin Angus Mackay11-Feb-08 14:52
Colin Angus Mackay11-Feb-08 14:52 
GeneralRe: Volatile?? :confused: Pin
geekfromindia11-Feb-08 15:33
geekfromindia11-Feb-08 15:33 
GeneralRe: Volatile?? :confused: Pin
MidwestLimey11-Feb-08 15:35
professionalMidwestLimey11-Feb-08 15:35 
GeneralRe: Volatile?? :confused: Pin
geekfromindia11-Feb-08 15:39
geekfromindia11-Feb-08 15:39 
GeneralRe: Volatile?? :confused: Pin
MidwestLimey12-Feb-08 5:26
professionalMidwestLimey12-Feb-08 5:26 
GeneralRe: Volatile?? :confused: Pin
MarkB77711-Feb-08 17:30
MarkB77711-Feb-08 17:30 
GeneralRe: Volatile?? :confused: Pin
geekfromindia11-Feb-08 18:09
geekfromindia11-Feb-08 18:09 
GeneralRe: Volatile?? :confused: Pin
Guffa11-Feb-08 23:59
Guffa11-Feb-08 23:59 
GeneralRe: Volatile?? :confused: Pin
Daniel Grunwald12-Feb-08 1:25
Daniel Grunwald12-Feb-08 1:25 
Generalvoice chatting over lan or simpy between two pcs Pin
rao raja11-Feb-08 12:49
rao raja11-Feb-08 12:49 
GeneralRe: voice chatting over lan or simpy between two pcs Pin
led mike11-Feb-08 12:59
led mike11-Feb-08 12:59 

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.