Showing posts with label C#. Show all posts
Showing posts with label C#. Show all posts

Saturday, April 24, 2010

lấy giá vàng bóc tách nội dung C#

sử dụng C# để bóc tách nội dung của 1 trang xml string urdl = "http://www.vietcombank.com.vn/ExchangeRates/ExrateXML.aspx";int i = 0;XmlTextReader MyReader = new XmlTextReader(urdl);while (MyReader.Read()){ if (MyReader.Name == "Exrate") { Response.Write(MyReader.GetAttribute(0).ToString()); Response.Write(""); } }

Thursday, July 16, 2009

send mail window C#

MailMessage MailMesaji = new MailMessage();MailMesaji.Subject = "subject";MailMesaji.Body = "mail body";MailMesaji.BodyEncoding = Encoding.GetEncoding("Windows-1254"); //EncodingMailMesaji.From = new MailAddress("shimi.gov@gmail.com");MailMesaji.To.Add(new MailAddress("shimi.gov@gmail.com"));System.Net.Mail.SmtpClient Smtp = new SmtpClient();Smtp.Host = "smtp.gmail.com"; // for example gmail smtp

Wednesday, July 15, 2009

using proxy with com webbrower C#

public void strproxy(string serverName,string port) { string key = "Software\\Microsoft\\Windows\\CurrentVersion\\Internet Settings"; string proxy = serverName + ":" + port; RegistryKey RegKey = Registry.CurrentUser.OpenSubKey(key, true); RegKey.SetValue("ProxyServer", proxy); RegKey.SetValue("ProxyEnable", 1); }button click

Monday, July 13, 2009

random in asp.net/c#

using sql querry : string sqlqueryselect = "select top 3 * from Products order by newid() "; with php using random - rand() string sqlqueryselect = "select * from Products ORDER BY RAND() LIMIT 3 ";

Thursday, July 9, 2009

say helo with asp.net

creat web project with Visual studio 2005default.cs the first code :response.write("hello");CRTL + F5 or F5 to run

Monday, July 6, 2009

function split remove string

string strchuoi = "helo ai do a o do vay" ; ex:int n =Convert.ToInt32(strchuoi.Length.ToString());string[] mang= strchuoi.Split(' '); int sodoan=0; count foreach(string y in mang) { sodoan=sodoan+1; } Response.Write(mang[sodoan-1]); using trim cut space in string