摘要: View Code 1 1、ArrarList 转换为 string[] : 2 3 ArrayList list = new ArrayList(); 4 5 list.Add("aaa"); 6 7 list.Add("bbb"); 8 9 //转换成数组10 11 string[] arrString = (string[])list.ToArray(typeof( string)) ;12 13 2、string[] 转换为 ArrarList :14 15 ArrayList list = new ArrayList(new string[] 阅读全文
posted @ 2012-02-23 11:27 smiling face 阅读(172) 评论(0) 推荐(0) 编辑
摘要: 这里谈到是三层编程在CLASS里调用的问题:开始使用VS 2005,习惯性的使用ConfigurationSettings类来读取应用程序配置文件的信息时,却被编译器提示说:警告 1 “System.Configuration.ConfigurationSettings.AppSettings”已过时:“This method is obsolete, it has been replaced by System.Configuration!System.Configuration.ConfigurationManager.AppSettings”于是转而想找到那个ConfigurationM 阅读全文
posted @ 2011-09-26 15:57 smiling face 阅读(597) 评论(0) 推荐(0) 编辑
摘要: View Code 1 //string localFilePath, fileNameExt, newFileName, FilePath; 2 SaveFileDialog saveFileDialog1 = new SaveFileDialog(); 3 4 //设置文件类型 5 saveFileDialog1.Filter = " txt files(*.txt)|*.txt|All files(*.*)|*.*"; 6 7 //设置默认文件类型显示顺序 8 saveFileDialog1.FilterIndex = 2; 9 10 //保存对话框是否记忆上次打开的 阅读全文
posted @ 2011-07-04 14:57 smiling face 阅读(353) 评论(0) 推荐(0) 编辑
摘要: 问题:如果生成Txt文件?解决: string P_str_path = "C:\\1.txt"; StreamWriter sw = new StreamWriter(P_str_path,false); sw.WriteLine("0001879"); sw.Close(); 阅读全文
posted @ 2011-07-04 14:36 smiling face 阅读(444) 评论(0) 推荐(0) 编辑
摘要: 问题:DataGridView某单元格数据与combobox对应项显示?解决:this.combobox1.SelectedIndex = this.combobox1Items.IndexOf(this.DGVPerson[2, this.DGVPerson.CurrentCell.RowIndex].Value.ToString()); 阅读全文
posted @ 2011-07-03 15:24 smiling face 阅读(360) 评论(0) 推荐(0) 编辑
摘要: 问题:DataGridView表格显示删除行?解决:foreach (DataGridViewRow dgvr in DGVHypo.SelectedRows){ this.DGVHypo.Rows.Remove(dgvr);}这只是在DataGridView上删除行,不没有真正在数据库中删除。 阅读全文
posted @ 2011-07-03 14:28 smiling face 阅读(1166) 评论(0) 推荐(0) 编辑
摘要: 问题:当DataGirdView某列是隐藏的,如何获得这个隐藏列单元格的值?解决: this.DGVClient.CurrentRow.Cells["id"].Value.ToString() 阅读全文
posted @ 2011-07-03 13:52 smiling face 阅读(1707) 评论(0) 推荐(0) 编辑
摘要: Delphi 1 procedure TForm1.FormCreate(Sender: TObject); 2 begin 3 EnableMenuItem(GetSystemMenu(Handle, FALSE), SC_CLOSE,MF_BYCOMMAND or MF_GRAYED); 4 end;C#1 public Frm()2 {3 InitializeComponent();4 this.ControlBox = false;5 6 } 阅读全文
posted @ 2011-06-20 17:13 smiling face 阅读(559) 评论(0) 推荐(0) 编辑
摘要: AutoSizeColumnsMode指定如何设置列宽setGridView.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.AllCells;AutoSizeRowsMode指定如何设置行高setGridView.AutoSizeRowsMode = DataGridViewAutoSizeRowsMode.AllCells; 设定列标题的宽度可以自由调整setGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize 阅读全文
posted @ 2011-06-14 14:13 smiling face 阅读(1291) 评论(0) 推荐(0) 编辑
摘要: 问题:当从sql数据库中select数据集后,如何判断某字段的类型?解决: foreach (System.Data.DataColumn dc in dsFirst.Tables[0].Columns) { if (s == dc.ColumnName && dc.DataType == typeof(DateTime)) {strTemp = strTemp + " cstr(" + s + ")+"; break; } else if (s == dc.ColumnName) { strTemp = strTemp + " 阅读全文
posted @ 2011-06-09 15:49 smiling face 阅读(802) 评论(0) 推荐(0) 编辑