欢迎光临
我的个人博客网站

Winform dataGridView 用法

//方法一 后台调用 

this.dataGridView1.Columns[“ProductName”].DisplayIndex = 0;

 

//方法二 页面上拖拽

this.dataGridView1.AllowUserToOrderColumns = true;

Winform  dataGridView  用法

Winform  dataGridView  用法

 

//3.时间控件默认为空

Winform  dataGridView  用法

public WeighRecord() { InitializeComponent();  this.RecordTimepx.Format = DateTimePickerFormat.Custom; this.RecordTimepx.CustomFormat = " ";  }  private void RecordTimepx_ValueChanged(object sender, EventArgs e) { this.RecordTimepx.Format = DateTimePickerFormat.Long; this.RecordTimepx.CustomFormat = null; }

 

 

//4.弹出窗口

       private void ShowSetBtn_Click(object sender, EventArgs e)
       {

            //传入值             var childList = new List<TableHeader>();             var headsSet = new WeighRecordSet(childList);             //事件+回传值             headsSet.itemTextChanged += new EventHandler((sender1, e1) =>             {                 childList = headsSet.list; //回传值   ///其他逻辑 刷新页面啥的             });              //弹出窗体             headsSet.ShowDialog();            
}

  public partial class WeighRecordSet : Form     {         public List<TableHeader> list { get; set; }         public event EventHandler itemTextChanged;         public WeighRecordSet()         {             InitializeComponent();         }          public WeighRecordSet(List<TableHeader> list)         {             InitializeComponent();         }          //确定         private void SaveBtn_Click(object sender, EventArgs e)         {             //事件             if (itemTextChanged != null)             {                 itemTextChanged(this, e);             }             this.Close();         }     }

 

赞(0) 打赏
未经允许不得转载:张拓的天空 » Winform dataGridView 用法
分享到: 更多 (0)

评论 抢沙发

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址

专业的IT技术经验分享 更专业 更方便

联系我们本站主机

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

微信扫一扫打赏