zoukankan      html  css  js  c++  java
  • datagridview 数据动态添加

    for (Int32 i = 0; i <= tasklist.Rows.Count - 1; i++) {
    	DataG1.Rows.Add();
    	for (Int32 j = 0; j <= tasklist.Columns.Count - 1; j++) {
    		object tempdata = tasklist.Rows(i)(j);
    		if (object.ReferenceEquals(tempdata, System.DBNull.Value)) {
    			DataG1.Rows(i).Cells(j).Value = null;
    		} else {
    			if (Information.IsDate(tempdata)) {
    				//'备注内容为日期型时转换为string
    				if (DataG1.Columns(j).HeaderText == "备注") {
    					DataG1.Rows(i).Cells(j).Value = Convert.ToDateTime(tempdata).ToString();
    				} else {
    					DataG1.Rows(i).Cells(j).Value = Convert.ToDateTime(tempdata);
    				}
    			} else {
    				DataG1.Rows(i).Cells(j).Value = tempdata;
    			}
    		}
    	}
    }
    
  • 相关阅读:
    数据库 连接(join)
    Linux top
    Game2048
    黑豆白豆问题
    1000个苹果10箱
    Jconsole
    八数码 Java实现
    两数之和
    磁盘调度算法
    常见应用网络层次
  • 原文地址:https://www.cnblogs.com/swarb/p/9924420.html
Copyright © 2011-2022 走看看