Hi,
Mostly many person not know how to install silverlight so,follow this steps:
1 Microsoft visual studio 2008 (SP1)
2 Silverlight tool.exe
3 Microsoft Expression Blend 2.0
4 Microsoft Expression Blend 2.0 (SP1)
5 Silverlight tool kit 2 March
Regard
Prateek
Wednesday, February 3, 2010
Wednesday, December 30, 2009
Delete Type URL from AddressBar
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Security.Permissions;
using Microsoft.Win32;
using System.Windows.Forms;
using System.IO;
[assembly: RegistryPermission(SecurityAction.RequestMinimum, ViewAndModify = "HKEY_CURRENT_USER\\SOFTWARE\\MICROSOFT\\INTERNET EXPLORER\\TYPEDURLS")]
[assembly: RegistryPermission(SecurityAction.RequestMinimum, ViewAndModify = "HKEY_CURRENT_USER\\SOFTWARE\\MICROSOFT\\INTERNET EXPLORER")]
then declare below static constant string varible:
public static SortedList historylinks = new SortedList();
public const string REG_URL = "SOFTWARE\\MICROSOFT\\INTERNET EXPLORER\\TYPEDURLS";
public const string REG_URL_SHORT = "SOFTWARE\\MICROSOFT\\INTERNET EXPLORER";
then here is the code for:
GetHistory();
int deletedhist = 0;
using (RegistryKey tempKey = Registry.CurrentUser.OpenSubKey(REG_URL, true))
{
if (tempKey == null)
{
System.Windows.Forms.MessageBox.Show("The registry entry for " + REG_URL + " does not exist!",
"Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
} // if
else
{
foreach (histlink hl in historylinks.Values)
{
tempKey.DeleteValue(hl.URL);
deletedhist++;
}
}
}
GetHistory();
lbl_message.Text = "Typed URL's cleared";
and here is the code for gethistory function:
public void GetHistory()
{
historylinks.Clear();
using (RegistryKey tempKey = Registry.CurrentUser.OpenSubKey(REG_URL))
{
if (tempKey == null)
{
using (RegistryKey tempKeyShort = Registry.CurrentUser.OpenSubKey(REG_URL_SHORT, true))
{
if (tempKeyShort == null)
{
MessageBox.Show("The registry entry for " + REG_URL_SHORT + " does not exist!",
"Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
return;
}
else
{
tempKeyShort.CreateSubKey("TypedURLs", RegistryKeyPermissionCheck.ReadWriteSubTree);
}
}
}
}
using (RegistryKey tempKey = Registry.CurrentUser.OpenSubKey(REG_URL))
{
if (tempKey == null)
{
System.Windows.Forms.MessageBox.Show("The registry entry for " + REG_URL + " does not exist!",
"Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
return;
}
string[] vals = tempKey.GetValueNames();
int itemcounter = 0;
foreach (string url in vals)
{
object keyValue = tempKey.GetValue(url);
if (keyValue != null)
{
histlink hl = new histlink();
string entry = keyValue.ToString();
if (entry.Length != 0)
{
itemcounter++;
hl.Entry = entry;
hl.URL = url;
historylinks.Add(itemcounter, hl);
}
}
}
}
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Security.Permissions;
using Microsoft.Win32;
using System.Windows.Forms;
using System.IO;
[assembly: RegistryPermission(SecurityAction.RequestMinimum, ViewAndModify = "HKEY_CURRENT_USER\\SOFTWARE\\MICROSOFT\\INTERNET EXPLORER\\TYPEDURLS")]
[assembly: RegistryPermission(SecurityAction.RequestMinimum, ViewAndModify = "HKEY_CURRENT_USER\\SOFTWARE\\MICROSOFT\\INTERNET EXPLORER")]
then declare below static constant string varible:
public static SortedList
public const string REG_URL = "SOFTWARE\\MICROSOFT\\INTERNET EXPLORER\\TYPEDURLS";
public const string REG_URL_SHORT = "SOFTWARE\\MICROSOFT\\INTERNET EXPLORER";
then here is the code for:
GetHistory();
int deletedhist = 0;
using (RegistryKey tempKey = Registry.CurrentUser.OpenSubKey(REG_URL, true))
{
if (tempKey == null)
{
System.Windows.Forms.MessageBox.Show("The registry entry for " + REG_URL + " does not exist!",
"Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
} // if
else
{
foreach (histlink hl in historylinks.Values)
{
tempKey.DeleteValue(hl.URL);
deletedhist++;
}
}
}
GetHistory();
lbl_message.Text = "Typed URL's cleared";
and here is the code for gethistory function:
public void GetHistory()
{
historylinks.Clear();
using (RegistryKey tempKey = Registry.CurrentUser.OpenSubKey(REG_URL))
{
if (tempKey == null)
{
using (RegistryKey tempKeyShort = Registry.CurrentUser.OpenSubKey(REG_URL_SHORT, true))
{
if (tempKeyShort == null)
{
MessageBox.Show("The registry entry for " + REG_URL_SHORT + " does not exist!",
"Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
return;
}
else
{
tempKeyShort.CreateSubKey("TypedURLs", RegistryKeyPermissionCheck.ReadWriteSubTree);
}
}
}
}
using (RegistryKey tempKey = Registry.CurrentUser.OpenSubKey(REG_URL))
{
if (tempKey == null)
{
System.Windows.Forms.MessageBox.Show("The registry entry for " + REG_URL + " does not exist!",
"Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
return;
}
string[] vals = tempKey.GetValueNames();
int itemcounter = 0;
foreach (string url in vals)
{
object keyValue = tempKey.GetValue(url);
if (keyValue != null)
{
histlink hl = new histlink();
string entry = keyValue.ToString();
if (entry.Length != 0)
{
itemcounter++;
hl.Entry = entry;
hl.URL = url;
historylinks.Add(itemcounter, hl);
}
}
}
}
Deleting historyfile
In this code the header files and assembly files are same as Delete Cache which i post early
and the code is:
//textBox is used for deleting particular history file
string enteredtext = txt_url.Text.Trim();
string lowertext = txt_url.Text.ToLower();
string uppertext = txt_url.Text.ToUpper();
string[] historyfile = Directory.GetFiles(Environment.GetFolderPath(Environment.SpecialFolder.History), "*", SearchOption.AllDirectories);
for (int i = 0; i < historyfile.Count(); i++)
{
try
{
File.Delete(historyfile.ElementAt(i));
lbl_message.Text = historyfile.ElementAt(i)+ " cleared";
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
//this is the function which I used :
public void GetHistory()
{
historylinks.Clear();
using (RegistryKey tempKey = Registry.CurrentUser.OpenSubKey(REG_URL))
{
if (tempKey == null)
{
using (RegistryKey tempKeyShort = Registry.CurrentUser.OpenSubKey(REG_URL_SHORT, true))
{
if (tempKeyShort == null)
{
MessageBox.Show("The registry entry for " + REG_URL_SHORT + " does not exist!",
"Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
return;
}
else
{
tempKeyShort.CreateSubKey("TypedURLs", RegistryKeyPermissionCheck.ReadWriteSubTree);
}
}
}
}
using (RegistryKey tempKey = Registry.CurrentUser.OpenSubKey(REG_URL))
{
if (tempKey == null)
{
System.Windows.Forms.MessageBox.Show("The registry entry for " + REG_URL + " does not exist!",
"Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
return;
}
string[] vals = tempKey.GetValueNames();
int itemcounter = 0;
foreach (string url in vals)
{
object keyValue = tempKey.GetValue(url);
if (keyValue != null)
{
histlink hl = new histlink();
string entry = keyValue.ToString();
if (entry.Length != 0)
{
itemcounter++;
hl.Entry = entry;
hl.URL = url;
historylinks.Add(itemcounter, hl);
}
}
}
}
and the code is:
//textBox is used for deleting particular history file
string enteredtext = txt_url.Text.Trim();
string lowertext = txt_url.Text.ToLower();
string uppertext = txt_url.Text.ToUpper();
string[] historyfile = Directory.GetFiles(Environment.GetFolderPath(Environment.SpecialFolder.History), "*", SearchOption.AllDirectories);
for (int i = 0; i < historyfile.Count(); i++)
{
try
{
File.Delete(historyfile.ElementAt(i));
lbl_message.Text = historyfile.ElementAt(i)+ " cleared";
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
//this is the function which I used :
public void GetHistory()
{
historylinks.Clear();
using (RegistryKey tempKey = Registry.CurrentUser.OpenSubKey(REG_URL))
{
if (tempKey == null)
{
using (RegistryKey tempKeyShort = Registry.CurrentUser.OpenSubKey(REG_URL_SHORT, true))
{
if (tempKeyShort == null)
{
MessageBox.Show("The registry entry for " + REG_URL_SHORT + " does not exist!",
"Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
return;
}
else
{
tempKeyShort.CreateSubKey("TypedURLs", RegistryKeyPermissionCheck.ReadWriteSubTree);
}
}
}
}
using (RegistryKey tempKey = Registry.CurrentUser.OpenSubKey(REG_URL))
{
if (tempKey == null)
{
System.Windows.Forms.MessageBox.Show("The registry entry for " + REG_URL + " does not exist!",
"Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
return;
}
string[] vals = tempKey.GetValueNames();
int itemcounter = 0;
foreach (string url in vals)
{
object keyValue = tempKey.GetValue(url);
if (keyValue != null)
{
histlink hl = new histlink();
string entry = keyValue.ToString();
if (entry.Length != 0)
{
itemcounter++;
hl.Entry = entry;
hl.URL = url;
historylinks.Add(itemcounter, hl);
}
}
}
}
Delete Temp File from Browser
In this code the header files and assembly files are same as Delete Cache which i post early
and the code is:
//textBox is used for deleting particular Temp Files
string enteredtext = txt_url.Text.Trim();
string lowertext = txt_url.Text.ToLower();
string uppertext = txt_url.Text.ToUpper();
string[] tempfiles = Directory.GetFiles(Environment.GetEnvironmentVariable("TEMP"), "*", SearchOption.AllDirectories);
for (int i = 0; i < tempfiles.Count(); i++)
{
try
{
if (tempfiles.ElementAt(i).Contains(enteredtext) || tempfiles.ElementAt(i).Contains(lowertext) || tempfiles.ElementAt(i).Contains(uppertext))
{
File.Delete(tempfiles.ElementAt(i));
lbl_message.Text = "TEMP file cleared";
}
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
and the code is:
//textBox is used for deleting particular Temp Files
string enteredtext = txt_url.Text.Trim();
string lowertext = txt_url.Text.ToLower();
string uppertext = txt_url.Text.ToUpper();
string[] tempfiles = Directory.GetFiles(Environment.GetEnvironmentVariable("TEMP"), "*", SearchOption.AllDirectories);
for (int i = 0; i < tempfiles.Count(); i++)
{
try
{
if (tempfiles.ElementAt(i).Contains(enteredtext) || tempfiles.ElementAt(i).Contains(lowertext) || tempfiles.ElementAt(i).Contains(uppertext))
{
File.Delete(tempfiles.ElementAt(i));
lbl_message.Text = "TEMP file cleared";
}
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
Delete Cookies
In this code the header files and assembly files are same as Delete Cache which i post early
and the code is:
//textBox is used for deleting particular Cookies
string enteredtext = txt_url.Text.Trim();
string lowertext = txt_url.Text.ToLower();
string uppertext = txt_url.Text.ToUpper();
string[] cookiefile = Directory.GetFiles(Environment.GetFolderPath(Environment.SpecialFolder.Cookies), "*", SearchOption.AllDirectories);
for (int i = 0; i < cookiefile.Count(); i++)
{
try
{
if (cookiefile.ElementAt(i).Contains(enteredtext) || cookiefile.ElementAt(i).Contains(lowertext) || cookiefile.ElementAt(i).Contains(uppertext))
{
File.Delete(cookiefile.ElementAt(i));
lbl_message.Text = "Cookie cleared";
}
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
and the code is:
//textBox is used for deleting particular Cookies
string enteredtext = txt_url.Text.Trim();
string lowertext = txt_url.Text.ToLower();
string uppertext = txt_url.Text.ToUpper();
string[] cookiefile = Directory.GetFiles(Environment.GetFolderPath(Environment.SpecialFolder.Cookies), "*", SearchOption.AllDirectories);
for (int i = 0; i < cookiefile.Count(); i++)
{
try
{
if (cookiefile.ElementAt(i).Contains(enteredtext) || cookiefile.ElementAt(i).Contains(lowertext) || cookiefile.ElementAt(i).Contains(uppertext))
{
File.Delete(cookiefile.ElementAt(i));
lbl_message.Text = "Cookie cleared";
}
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
Delete Internet Cache
First Include Heder files and assembly files to your Web page:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Security.Permissions;
using Microsoft.Win32;
using System.Windows.Forms;
using System.IO;
[assembly: RegistryPermission(SecurityAction.RequestMinimum, ViewAndModify = "HKEY_CURRENT_USER\\SOFTWARE\\MICROSOFT\\INTERNET EXPLORER\\TYPEDURLS")]
[assembly: RegistryPermission(SecurityAction.RequestMinimum, ViewAndModify = "HKEY_CURRENT_USER\\SOFTWARE\\MICROSOFT\\INTERNET EXPLORER")]
Then use this code:
//below is the textBox for deleting particular Cache from your Browser
string enteredtext = txt_url.Text.Trim();
string lowertext = txt_url.Text.ToLower();
string uppertext = txt_url.Text.ToUpper();
string[] internetcachefile = Directory.GetFiles(Environment.GetFolderPath(Environment.SpecialFolder.InternetCache), "*", SearchOption.AllDirectories);
for (int i = 0; i < internetcachefile.Count(); i++)
{
try
{
if (internetcachefile.ElementAt(i).Contains(enteredtext) || internetcachefile.ElementAt(i).Contains(lowertext) || internetcachefile.ElementAt(i).Contains(uppertext))
{
File.Delete(internetcachefile.ElementAt(i));
lbl_message.Text = "Cache cleared";
}
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Security.Permissions;
using Microsoft.Win32;
using System.Windows.Forms;
using System.IO;
[assembly: RegistryPermission(SecurityAction.RequestMinimum, ViewAndModify = "HKEY_CURRENT_USER\\SOFTWARE\\MICROSOFT\\INTERNET EXPLORER\\TYPEDURLS")]
[assembly: RegistryPermission(SecurityAction.RequestMinimum, ViewAndModify = "HKEY_CURRENT_USER\\SOFTWARE\\MICROSOFT\\INTERNET EXPLORER")]
Then use this code:
//below is the textBox for deleting particular Cache from your Browser
string enteredtext = txt_url.Text.Trim();
string lowertext = txt_url.Text.ToLower();
string uppertext = txt_url.Text.ToUpper();
string[] internetcachefile = Directory.GetFiles(Environment.GetFolderPath(Environment.SpecialFolder.InternetCache), "*", SearchOption.AllDirectories);
for (int i = 0; i < internetcachefile.Count(); i++)
{
try
{
if (internetcachefile.ElementAt(i).Contains(enteredtext) || internetcachefile.ElementAt(i).Contains(lowertext) || internetcachefile.ElementAt(i).Contains(uppertext))
{
File.Delete(internetcachefile.ElementAt(i));
lbl_message.Text = "Cache cleared";
}
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
Get Sensex Stock data From Yahoo Finace
StockData stockData = new StockData();
List StockDatalist = new List();
string serverUrl = @"http://in.finance.yahoo.com/d/quotes.csv?s=" + stockCode +"&f=sl1d1t1c1ohgvj1pp2owern&e=.csv";
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(serverUrl);
HttpWebResponse response = (HttpWebResponse)request.GetResponse();
StreamReader reader = new StreamReader(response.GetResponseStream(),
Encoding.ASCII);
stockDataString = reader.ReadLine();
string[] stockDataContents = stockDataString.Split(',');
stockData.Code = stockCode;
stockData.Last = stockDataContents[1];
stockData.Date = stockDataContents[2];
stockData.Time = stockDataContents[3];
stockData.Change = stockDataContents[4];
stockData.Open = stockDataContents[5];
stockData.High = stockDataContents[6];
stockData.Low = stockDataContents[7];
stockData.Volume = stockDataContents[8];
stockData.MarketCapital = stockDataContents[9];
stockData.PreviousClose = stockDataContents[10];
stockData.PctChange = stockDataContents[11];
stockData.AnnRange = stockDataContents[12];
stockData.Earnings = stockDataContents[13];
stockData.PERatio = stockDataContents[14];
StockDatalist.Add(stockData);
response.Close();
return stockDataString;
List
string serverUrl = @"http://in.finance.yahoo.com/d/quotes.csv?s=" + stockCode +"&f=sl1d1t1c1ohgvj1pp2owern&e=.csv";
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(serverUrl);
HttpWebResponse response = (HttpWebResponse)request.GetResponse();
StreamReader reader = new StreamReader(response.GetResponseStream(),
Encoding.ASCII);
stockDataString = reader.ReadLine();
string[] stockDataContents = stockDataString.Split(',');
stockData.Code = stockCode;
stockData.Last = stockDataContents[1];
stockData.Date = stockDataContents[2];
stockData.Time = stockDataContents[3];
stockData.Change = stockDataContents[4];
stockData.Open = stockDataContents[5];
stockData.High = stockDataContents[6];
stockData.Low = stockDataContents[7];
stockData.Volume = stockDataContents[8];
stockData.MarketCapital = stockDataContents[9];
stockData.PreviousClose = stockDataContents[10];
stockData.PctChange = stockDataContents[11];
stockData.AnnRange = stockDataContents[12];
stockData.Earnings = stockDataContents[13];
stockData.PERatio = stockDataContents[14];
StockDatalist.Add(stockData);
response.Close();
return stockDataString;
Subscribe to:
Posts (Atom)