社区
C#
帖子详情
this.dataGridView1.Columns[ ShipDate ].DefaultCellStyle.Format = N2 无效
kalongpa
2012-06-01 03:40:30
this.dataGridView1.Columns[ ShipDate ].DefaultCellStyle.Format = N2 无效
...全文
177
8
打赏
收藏
this.dataGridView1.Columns[ ShipDate ].DefaultCellStyle.Format = N2 无效
this.dataGridView1.Columns[ ShipDate ].DefaultCellStyle.Format = N2 无效
复制链接
扫一扫
分享
转发到动态
举报
写回复
配置赞助广告
用AI写文章
8 条
回复
切换为时间正序
请发表友善的回复…
发表回复
打赏红包
EnForGrass
2012-06-01
打赏
举报
回复
[Quote=引用 2 楼 的回复:]
this.dataGridView1.Columns[ ShipDate ].DefaultCellStyle.Format = "N2" 无效
[/Quote]
ShipDate命名来看应该是时间类型,试试这样
this.dataGridView1.Columns["ShipDate"].DefaultCellStyle.Format = "d";
yanjia151
2012-06-01
打赏
举报
回复
你吧N2赋值吗
yanjia151
2012-06-01
打赏
举报
回复
这是什么情况
kalongpa
2012-06-01
打赏
举报
回复
jTreeGridView1.Columns["budget_price"].DefaultCellStyle.Alignment=System.Windows.Forms.DataGridViewContentAlignment.MiddleRight;
jTreeGridView1.Columns["budget_price"].DefaultCellStyle.Format = "N2"; 上一句有效 下面格式化就无效 不知道 不存在什么编译错误
熙风
2012-06-01
打赏
举报
回复
在设计里面设置一下试试
cnfixit
2012-06-01
打赏
举报
回复
ShipDate 这是个什么东西?
是没有效果?还是编译错误?
kalongpa
2012-06-01
打赏
举报
回复
this.dataGridView1.Columns[ ShipDate ].DefaultCellStyle.Format = "N2" 无效
cnfixit
2012-06-01
打赏
举报
回复
"N2"
C#
DataGridView
中的常用技巧
dbfC#
DataGridView
中的常用技巧 只列出技巧部分,后面会有补充 0(最基本的技巧). 获取某列中的某行(某单元格)中的内容 this.currentposition = this.
dataGridView
1.BindingContext [this.
dataGridView
1.DataSource, this.
dataGridView
1.DataMember].Position; bookContent = this.database.dataSet.Tables[0].Rows [this.currentposition][21].ToString().Trim(); MessageBox.Show(bookContent); 1、自定义列 //定义列宽 this.
dataGridView
1.
Column
s[0].Width = 80; this.
dataGridView
1.
Column
s[1].Width = 80; this.
dataGridView
1.
Column
s[2].Width = 180; this.
dataGridView
1.
Column
s[3].Width = 120; this.
dataGridView
1.
Column
s[4].Width = 120; Customize
Cell
s and
Column
s in the Windows Forms
DataGridView
Control by Extending Their Behavior and Appearance Host Controls in Windows Forms
DataGridView
Cell
s 继承
DataGridView
TextBox
Cell
类生成新的
Cell
类,然后再继承
DataGridView
Column
生成新的
Column
类,并指定
Cell
Template为新的
Cell
类。新生成的
Column
便可以增加到
DataGridView
中去。 2、自动适应列宽 Programmatically Resize
Cell
s to Fit Content in the Windows Forms
DataGridView
Control Samples:
DataGridView
.AutoSize
Column
s(
DataGridView
AutoSize
Column
Criteria.HeaderAndDisplayedRows);
DataGridView
.AutoSize
Column
(
DataGridView
AutoSize
Column
Criteria.HeaderOnly, 2, false);
DataGridView
.AutoSizeRow(
DataGridView
AutoSizeRowCriteria.
Column
s, 2, false);
DataGridView
.AutoSizeRows(
DataGridView
AutoSizeRowCriteria.HeaderAnd
Column
s, 0,
dataGridView
1.Rows.Count, false); 3、可以绑定并显示对象 Bind Objects to Windows Forms
DataGridView
Controls 4、可以改变表格线条风格 Change the Border and Gridline
Style
s in the Windows Forms
DataGridView
Control Samples: this.
dataGridView
1.GridColor = Color.BlueViolet; this.
dataGridView
1.Border
Style
= Border
Style
.Fixed3D; this.
dataGridView
1.
Cell
Border
Style
=
DataGridView
Cell
Border
Style
.None; this.
dataGridView
1.RowHeadersBorder
Style
= DataGridVie
C#
DatagridView
常用操作简介
0、最基本的技巧:获取某行某列(某单元格)中的内容 this.currentposition = this.
dataGridView
1.BindingContext [this.
dataGridView
1.DataSource, this.
dataGridView
1.DataMember].Position; bookContent = this.database.da
C#中对
DatagridView
的部分常用操作
C#
DataGridView
中的常用技巧 只列出技巧部分,后面会有补充 (最基本的技巧). 获取某列中的某行(某单元格)中的内容 this.currentposition = this.
dataGridView
1.BindingContext [this.
dataGridView
1.DataSource, this.
dataGridView
1.Da
.Net基础:C#中对
DatagridView
部分常用操作
(最基本的技巧)、获取某列中的某行(某单元格)中的内容 this.currentposition = this.
dataGridView
1.BindingContext [this.
dataGridView
1.DataSource, this.
dataGridView
1.DataMember].Position; bookContent = this.database.dataSet.
C#
DataGridView
控件动态添加行与列
DataGridView
控件在实际应用中非常实用,特别需要表格显示数据时。可以静态绑定数据源,这样就自动为
DataGridView
控件添加相应的行。假如需要动态为
DataGridView
控件添加新行,方法有很多种,下面简单介绍如何为
DataGridView
控件动态添加新行的两种方法: 方法一: int index=this.
dataGridView
1.Rows.Add(); this.
dataGridView
1.Rows[index].
Cell
s[0].Value = "1"; this.dataGr
C#
111,126
社区成员
642,541
社区内容
发帖
与我相关
我的任务
C#
.NET技术 C#
复制链接
扫一扫
分享
社区描述
.NET技术 C#
社区管理员
加入社区
获取链接或二维码
近7日
近30日
至今
加载中
查看更多榜单
社区公告
让您成为最强悍的C#开发者
试试用AI创作助手写篇文章吧
+ 用AI写文章