using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace Examples
{
public partial class screensaver : Form
{
public screensaver()
{
InitializeComponent();
}
private void timer1_Tick(object sender, EventArgs e)
{
Random rnd = new Random();
this.BackColor = Color.FromArgb(rnd.Next(255), rnd.Next(255), rnd.Next(255));
}
private void screensaver_KeyPress(object sender, KeyPressEventArgs e)
{
Close();
}
}
}
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Xml;
namespace Examples
{
public partial class XMLWrite : Form
{
public XMLWrite()
{
InitializeComponent();
}
XmlTextWriter w;
private void XMLWrite_Load(object sender, EventArgs e)
{
w = new XmlTextWriter(@"E:\tutorials\asp.net+c#\demo\Examples\Examples\Student1.xml",null);
w.WriteStartElement("Teacher");
w.WriteStartElement("Name");
w.WriteString("Student1");
w.WriteEndElement();
w.WriteEndElement();
w.Close();
MessageBox.Show(@"E:\tutorials\asp.net+c#\demo\Examples\Examples\Student1.xml written successfully");
System.Diagnostics.Process.Start("iexplore", @"E:\tutorials\asp.net+c#\demo\Examples\Examples\Student1.xml");
}
}
}
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Data.SqlClient;
namespace Examples
{
public partial class SysObjects : Form
{
public SysObjects()
{
InitializeComponent();
}
SqlConnection con = new SqlConnection("Data Source=.;Initial Catalog=jQuery;UID=sa;password=tiger123");
SqlCommand cmd;
private void button1_Click(object sender, EventArgs e)
{
try
{
con.Open();
cmd = new SqlCommand(richTextBox1.Text,con);
SqlDataReader dr = cmd.ExecuteReader();
if (dr.Read())
{
DataTable dt = new DataTable();
dt.Load(dr);
dataGrid1.DataSource = dt;
}
}
catch (Exception ex)
{
}
}
}
}
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Data.SqlClient;
namespace Examples
{
public partial class Databases : Form
{
public Databases()
{
InitializeComponent();
}
SqlConnection con = new SqlConnection("Data Source=.;Initial Catalog=jQuery;UID=sa;password=tiger123");
SqlCommand cmd;
private void Databases_Load(object sender, EventArgs e)
{
fillTreeView();
}
private void fillTreeView()
{
try
{
con.Open();
cmd = new SqlCommand("sp_helpdb", con);
SqlDataReader dr = cmd.ExecuteReader();
while (dr.Read())
{
treeView1.Nodes.Add(dr["name"].ToString());
}
}
catch (Exception ex)
{
}
}
}
}
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Security.Permissions;
using System.Security;
using System.IO;
namespace Examples
{
public partial class security : Form
{
public security()
{
InitializeComponent();
}
private void security_Load(object sender, EventArgs e)
{
}
StreamWriter sw;
private void button1_Click(object sender, EventArgs e)
{
sw = File.CreateText(@"E:\\demo.txt");
sw.WriteLine("Hello");
sw.Close();
}
}
}

