Fermer ma fenêtre
CodeKeep C# Feed Novembre 17th, 2008
Description: Fermer ma fenêtre
Link: http://www.codekeep.net/snippets/bf68e3cf-6243-452b-bedd-c3a1b7a36e52.aspx
this.Close(); Application.Exit();
CodeKeep C# Feed Novembre 17th, 2008
Description: Fermer ma fenêtre
Link: http://www.codekeep.net/snippets/bf68e3cf-6243-452b-bedd-c3a1b7a36e52.aspx
this.Close(); Application.Exit();
WebReference News Novembre 17th, 2008
->
Available in static JavaScript and dynamic (with a Perl back-end) flavors, the WebReference xref script is a traffic-building tool that enables you to automatically insert links into your Web pages whenever a key term is encountered on the page. By Dan Ragle. 1113
CodeKeep C# Feed Novembre 17th, 2008
Description: Modificare app.config
Link: http://www.codekeep.net/snippets/a05eb0b7-af31-4351-82b5-35e286ac64d4.aspx
string configFileName = Application.StartupPath + @"\app.config";
XmlDocument configFile = new XmlDocument();
configFile.Load(configFileName);
XmlNode configurations = configFile.SelectSingleNode("descendant::configuration");
XmlNode appConfig = configFile.SelectSingleNode("descendant::appSettings");
if (appConfig == null)
{
appConfig = configFile.CreateElement("appSettings");
configurations.AppendChild(appConfig);
}
// il nodo deve avere la forma: <add key= "Nome del DB"
// value="Stringa di connessione" />
XmlNode node = configFile.CreateElement("add");
XmlAttribute key = configFile.CreateAttribute("key");
key.Value = "DBUTENTI";
// aggiungo l'attributo al nodo
node.Attributes.SetNamedItem(key);
XmlAttribute val = configFile.CreateAttribute("value");
val.Value = "Data Source=SRVSQLCAAF;Initial Catalog=ANAUTENTI;Integrated Security=True";
node.Attributes.SetNamedItem(val);
// aggiungo il nodo all'elemento superiore
appConfig.AppendChild(node);
node = configFile.CreateElement("add");
key = configFile.CreateAttribute("key");
key.Value = "DBCOMUNI";
node.Attributes.SetNamedItem(key);
val = configFile.CreateAttribute("value");
val.Value = "Data Source=SRVSQLCAAF;Initial Catalog=COMUNI;Integrated Security=True";
node.Attributes.SetNamedItem(val);
appConfig.AppendChild(node);
configFile.Save(configFileName);