Click here to Skip to main content
15,895,142 members
Home / Discussions / C#
   

C#

 
AnswerRe: Save TO xml FROM datagridview Pin
Dave Kreskowiak8-Nov-08 4:31
mveDave Kreskowiak8-Nov-08 4:31 
AnswerRe: Save TO xml FROM datagridview Pin
Mbah Dhaim8-Nov-08 4:59
Mbah Dhaim8-Nov-08 4:59 
QuestionCan anybody give link to good article on instumentation (Tracing) in application? I tried to search though. Pin
Member 23244837-Nov-08 13:28
Member 23244837-Nov-08 13:28 
QuestionEmbedded Xml: Ok it work, but ... why? Pin
nelsonpaixao7-Nov-08 13:20
nelsonpaixao7-Nov-08 13:20 
AnswerRe: Embedded Xml: Ok it work, but ... why? Pin
Guffa7-Nov-08 14:31
Guffa7-Nov-08 14:31 
AnswerRe: Embedded Xml: Ok it work, but ... why? Pin
Anthony Mushrow7-Nov-08 14:53
professionalAnthony Mushrow7-Nov-08 14:53 
AnswerRe: Embedded Xml: Ok it work, but ... why? Pin
nelsonpaixao7-Nov-08 15:06
nelsonpaixao7-Nov-08 15:06 
QuestionHelp with Properties.Settings.Default.Save() Pin
Project2477-Nov-08 13:12
Project2477-Nov-08 13:12 
Hey, i have this form that makes a grid of buttons, and when you click on the button it changes color.

The point of this is so i can do a check later and if the button is green i will turn on something.

Problem is it doesn't seem to save my settings, infact it doesn't seem to read the settings.default values after drawing

The settings look like:
Name | Type | Scope | Value
Mon0 Bool User True
Mon1 Bool User True
Mon2 Bool User False //and so forth for the next 165 options


        void CreateButton() 
	{ 
	 
	    List<list><button>> btns=new List<list><button>>(); 
	 
	        string[] day = new string[] { "Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun" }; 
	        int hour = 24;
                string name;
	 
	        for (int i = 0; i < day.Length; i++) 
	        { 
	            List<button> buttons = new List<button>(); 
	            for (int j = 0; j < hour; j++) 
	            { 	                
	                Button btn = new Button(); 
	                btn.Name = GenerateButtonName(day[i],j);
                    name = btn.Name.Substring(3);              
                foreach (SettingsProperty currentProperty in Properties.Settings.Default.Properties)
                    {
                        if (currentProperty.Name == name)
                        {
                            if (currentProperty.DefaultValue.Equals("True"))
                            {
                                btn.BackColor = System.Drawing.Color.Green;
                            }
                            else
                            { 
                                btn.BackColor = System.Drawing.Color.LightGray;
                            }
                        }
                    }                                               
                    btn.Location = new System.Drawing.Point(445, 130);
                    btn.Size = new System.Drawing.Size(14, 14);
                    btn.Click += new System.EventHandler(btn_Click);
	            buttons.Add(btn);
                    tableLayoutPanel1.Controls.Add(btn, j, i); 
	            } 
	            btns.Add(buttons);    
	        }  
	} 


        private void btn_Click(object sender, EventArgs e)
        {
            string senderName;
            senderName = ((System.Windows.Forms.Button)sender).Name.Substring(3); 
   
            if (((System.Windows.Forms.Button)sender).BackColor == System.Drawing.Color.Green)
            {
                ((System.Windows.Forms.Button)sender).BackColor = System.Drawing.Color.LightGray;    
                foreach (SettingsProperty currentProperty in Properties.Settings.Default.Properties)
                {
                    if (currentProperty.Name == senderName)
                    {                              
                            currentProperty.DefaultValue = "False";
                        //TODO: Add a exit call
                    }
                }        
            }
            else
            {
                ((System.Windows.Forms.Button)sender).BackColor = System.Drawing.Color.Green;
                foreach (SettingsProperty currentProperty in Properties.Settings.Default.Properties)
                {
                    if (currentProperty.Name == senderName)
                    {
                        currentProperty.DefaultValue = "True";                        
                    }
                } 
            }          
        }
</button></button></button></list></button></list>

I have a button on the form that calls the Properties.Settings.Default.Save().
It does draw the buttons, according to the settings, the first 3 are green, the rest are grey, but when i put in a statement that made a label equal the value of Mon0, even though the values are drawing as True and the tabel in the settings says true, its returning the value False.

Can anyone help! I'v been ripping my hair out over this for days! Let me know if you need more info or want a copy of the project.
QuestionMultiline string property at design time (like RTF) Pin
Chris Copeland7-Nov-08 11:13
mveChris Copeland7-Nov-08 11:13 
AnswerRe: Multiline string property at design time (like RTF) Pin
Thomas Stockwell7-Nov-08 14:33
professionalThomas Stockwell7-Nov-08 14:33 
GeneralRe: Multiline string property at design time (like RTF) Pin
Chris Copeland7-Nov-08 20:23
mveChris Copeland7-Nov-08 20:23 
Questioni want help in richtextbox problem Pin
BESHOY MARKO7-Nov-08 10:10
BESHOY MARKO7-Nov-08 10:10 
AnswerRe: i want help in richtextbox problem Pin
Giorgi Dalakishvili7-Nov-08 10:13
mentorGiorgi Dalakishvili7-Nov-08 10:13 
GeneralRe: i want help in richtextbox problem Pin
BESHOY MARKO7-Nov-08 10:34
BESHOY MARKO7-Nov-08 10:34 
AnswerRe: i want help in richtextbox problem Pin
sph3rex9-Nov-08 2:10
sph3rex9-Nov-08 2:10 
QuestionC# calling a webpage issues , whilst same URL works in FireFox Pin
Hyperionza7-Nov-08 9:59
Hyperionza7-Nov-08 9:59 
AnswerRe: C# calling a webpage issues , whilst same URL works in FireFox Pin
Guffa7-Nov-08 11:16
Guffa7-Nov-08 11:16 
GeneralRe: C# calling a webpage issues , whilst same URL works in FireFox Pin
Hyperionza7-Nov-08 21:58
Hyperionza7-Nov-08 21:58 
GeneralRe: C# calling a webpage issues , whilst same URL works in FireFox Pin
sph3rex8-Nov-08 6:20
sph3rex8-Nov-08 6:20 
GeneralRe: C# calling a webpage issues , whilst same URL works in FireFox Pin
Hyperionza8-Nov-08 23:38
Hyperionza8-Nov-08 23:38 
QuestionHow to change Group Header Font in Crystal Report Left Most Group Tree? Pin
majidbhutta7-Nov-08 7:32
majidbhutta7-Nov-08 7:32 
Questionmicrosoft loading problem Pin
netJP12L7-Nov-08 7:06
netJP12L7-Nov-08 7:06 
AnswerRe: microsoft loading problem Pin
sph3rex8-Nov-08 6:12
sph3rex8-Nov-08 6:12 
QuestionDetect which process is accessing a file Pin
Aram Azhari7-Nov-08 6:00
Aram Azhari7-Nov-08 6:00 
AnswerRe: Detect which process is accessing a file Pin
Giorgi Dalakishvili7-Nov-08 6:34
mentorGiorgi Dalakishvili7-Nov-08 6:34 

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.