Click here to Skip to main content
15,917,321 members
Home / Discussions / C#
   

C#

 
GeneralRe: Single web form project Pin
Christian Graus16-Jan-07 20:31
protectorChristian Graus16-Jan-07 20:31 
QuestionDate Time Picker and Queries Pin
L Viljoen15-Jan-07 19:20
professionalL Viljoen15-Jan-07 19:20 
AnswerRe: Date Time Picker and Queries Pin
Christian Graus15-Jan-07 21:44
protectorChristian Graus15-Jan-07 21:44 
QuestionRe: Date Time Picker and Queries Pin
L Viljoen15-Jan-07 22:30
professionalL Viljoen15-Jan-07 22:30 
QuestionString / Directory Location Question Pin
Planker15-Jan-07 19:17
Planker15-Jan-07 19:17 
AnswerRe: String / Directory Location Question Pin
Planker15-Jan-07 19:46
Planker15-Jan-07 19:46 
AnswerRe: String / Directory Location Question Pin
Christian Graus15-Jan-07 21:49
protectorChristian Graus15-Jan-07 21:49 
AnswerRe: String / Directory Location Question Pin
Seishin#16-Jan-07 4:05
Seishin#16-Jan-07 4:05 
Planker wrote:
I would like to use a XML setting file but not 100% sure how to do this yet


I define a typed dataset with one table in which i have two columns: 'key' and 'value'. (Add->NewItem->DataSet)

settings is the name of the dataset class

<br />
using System;<br />
using System.Collections.Generic;<br />
using System.Data;<br />
using System.IO;<br />
using System.Text;<br />
using System.Windows.Forms;<br />
<br />
namespace MyXmlSettings  {<br />
	public class Settings {<br />
		public static readonly Settings Instance = new Settings();<br />
		private settings dsSettings;<br />
<br />
		private Settings() {<br />
			dsSettings = new settings();<br />
		}<br />
<br />
		public void SaveSettings() {<br />
			dsSettings.WriteXml(Application.StartupPath + @"\settings.xml");<br />
		}<br />
<br />
		public void LoadSettings() {<br />
			string file = Application.StartupPath + @"\settings.xml";<br />
			<br />
			if(File.Exists(file))<br />
				dsSettings.ReadXml(file);<br />
			else<br />
				SaveSettings();<br />
		}<br />
<br />
		public string GetSetting(string key, params string[] defVal) {<br />
			DataRow row = dsSettings.setting.Rows.Find(key);<br />
			if(row != null)<br />
				return row[1].ToString();<br />
			else if(defVal != null && defVal.Length > 0) {<br />
				SetSetting(key, defVal[0]);<br />
				return defVal[0];<br />
			}<br />
			return string.Empty;<br />
		}<br />
<br />
		public void SetSetting(string key, string value) {<br />
			DataRow row = dsSettings.setting.Rows.Find(key);<br />
			if(row == null) {<br />
				row = dsSettings.setting.NewRow();<br />
				row[0] = key;<br />
				dsSettings.setting.Rows.Add(row);<br />
			}<br />
			row[1] = value;<br />
		}<br />
	}<br />
}<br />
<br />




dsSettings.WriteXml(path) generates a flat xml file.. but it works quite well for me Big Grin | :-D

life is study!!!

Questionquestion about bitmap mapping Pin
abstar15-Jan-07 17:31
abstar15-Jan-07 17:31 
AnswerRe: question about bitmap mapping Pin
Christian Graus15-Jan-07 17:51
protectorChristian Graus15-Jan-07 17:51 
Questionhow to add reference of Microsoft.Office.Tools.Word Pin
praveen pandey15-Jan-07 17:15
praveen pandey15-Jan-07 17:15 
AnswerRe: how to add reference of Microsoft.Office.Tools.Word Pin
Christian Graus15-Jan-07 17:27
protectorChristian Graus15-Jan-07 17:27 
GeneralRe: how to add reference of Microsoft.Office.Tools.Word Pin
praveen pandey15-Jan-07 18:01
praveen pandey15-Jan-07 18:01 
Questionputting image on other image in ms word Pin
praveen pandey15-Jan-07 16:48
praveen pandey15-Jan-07 16:48 
AnswerRe: putting image on other image in ms word Pin
Christian Graus15-Jan-07 16:59
protectorChristian Graus15-Jan-07 16:59 
GeneralRe: putting image on other image in ms word Pin
praveen pandey15-Jan-07 17:18
praveen pandey15-Jan-07 17:18 
GeneralRe: putting image on other image in ms word Pin
Christian Graus15-Jan-07 17:26
protectorChristian Graus15-Jan-07 17:26 
GeneralRe: putting image on other image in ms word Pin
praveen pandey15-Jan-07 17:38
praveen pandey15-Jan-07 17:38 
GeneralRe: putting image on other image in ms word Pin
Christian Graus15-Jan-07 17:50
protectorChristian Graus15-Jan-07 17:50 
AnswerRe: putting image on other image in ms word Pin
davidc2p16-Jan-07 6:18
davidc2p16-Jan-07 6:18 
QuestionWhat In The World Is Going On!!?? Pin
BlitzPackage15-Jan-07 15:23
BlitzPackage15-Jan-07 15:23 
AnswerRe: What In The World Is Going On!!?? Pin
Christian Graus15-Jan-07 15:33
protectorChristian Graus15-Jan-07 15:33 
GeneralRe: What In The World Is Going On!!?? Pin
BlitzPackage15-Jan-07 15:44
BlitzPackage15-Jan-07 15:44 
QuestionDesign-Time Collection Serialization Pin
Tyrus18215-Jan-07 15:04
Tyrus18215-Jan-07 15:04 
GeneralRe: Design-Time Collection Serialization Pin
Phillip M. Hoff15-Jan-07 16:33
Phillip M. Hoff15-Jan-07 16:33 

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.