2009年2月18日 星期三

c# : dataset

            // Navigate Dataset
            foreach (DataTable table in dataset.Tables)
            {
                temp += "TableName = " + table.TableName;
                temp += "---------";
                temp += "Columns ...\r\n";

                foreach (DataColumn column in table.Columns)
                {
                    //Console.Write("{0,-22}", column.ColumnName);
                    temp += column.ColumnName + "\t";
                }
                temp += "\n";
                temp += "\r\nNumber of rows = " + table.Rows.Count.ToString();
                temp += "Rows ...\r\n";

                foreach (DataRow row in table.Rows)
                {
                    foreach (Object value in row.ItemArray)
                    {
                        temp += value.ToString() + "\t";
                    }
                    temp += "\n";
                }
                temp += "\n";
            }

2009年2月3日 星期二

c# window application-- Change locale dynamically

CultureInfo objCI = new CultureInfo("en-US");
Thread.CurrentThread.CurrentCulture = objCI;
Thread.CurrentThread.CurrentUICulture = objCI;                

//localization code
this.Controls.Clear();
System.Threading.Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo("en-US");
InitializeComponent();

this.lbTime.Text = DateTime.Now.ToLongDateString().ToString();