社区
Delphi
帖子详情
如何使dbgrideh1.columns[0]的输入长度不能大于4?如同edit的maxlength一样
maginn
2003-10-15 06:40:57
希望达到如同edit的maxlength一样的效果,
即没有办法输入第五个字符??
...全文
136
9
打赏
收藏
如何使dbgrideh1.columns[0]的输入长度不能大于4?如同edit的maxlength一样
希望达到如同edit的maxlength一样的效果, 即没有办法输入第五个字符??
复制链接
扫一扫
分享
转发到动态
举报
写回复
配置赞助广告
用AI写文章
9 条
回复
切换为时间正序
请发表友善的回复…
发表回复
打赏红包
monkey968
2003-10-19
打赏
举报
回复
同意上面老兄的说法 最后还是做一个录入界面 这样什么问题都解决了
bjhjh
2003-10-19
打赏
举报
回复
up
beforepost好象不让改?
就是说,我写完事件代码,指定时没有此事件名称?
请指教!!!
zswangII
2003-10-15
打赏
举报
回复
//控制数据的存储最好还是控制DataSet而不是控制其所对应的数据控件~~
procedure TForm1.Table1AfterOpen(DataSet: TDataSet);
begin
//如果你的字段是整数类型可以这样~~
TIntegerField(Table1.FieldByName('整数字段')).MaxValue := 1000;
//如果你的字段是字符类型可以这样~~
TStringField(Table1.FieldByName('字符字段')).Size := 4;
end;
maginn
2003-10-15
打赏
举报
回复
其它的放开不算,
是不是想在dbgrid中实现像edit的maxlength一样的控制不能实现阿?
用户需求如下(起因)
用dbgrid完成 输入信息 ;其中一个字段是时间字段(分:妙)
我只能限制输入的为“数值”信息(dbgrid的keypress)
然后在beforepost中判断是否为正确的时间信息,如正确插入,错误 提示错误信息
问题是
正确的格式为 4位数,前两位位“十分”,后两位位“妙”
这样的话用户可以无限的输入多个数字,而只有当离开该cell时候,才发出错误提示信息
我像限制一下用户的输入,
或者当输入两个字符的时候能自动的出来一个“:”间隔一下
我也尝试用dbgrid。的一个colums 的buttonstyle设成cbsEliispe用一个maskedit来完成
然后在dbgride的ditbuttonclick完成
可出现的问题是
1:点击了dbgrid的需要设定的colums出现maskedit了,但是如何当在maskedit中
输入的信息转存到dbgrid中那(每次都出现问题)?在maskedit的exit中如何完成那?
2:如何控制maskedit每次显示的位置?在当前“cell”上?且仅用一个maskedit来完成
我不定个数的“行”的添加??
如能解决上面的问题也可
谢谢
47522341
2003-10-15
打赏
举报
回复
在dbgrid中的操作是对数据集的操作;除非你设定了该字段的长度为4;
然后在beforepost中给点提示还可以;
WGYKING
2003-10-15
打赏
举报
回复
最好建一个录入界面!
maginn
2003-10-15
打赏
举报
回复
不可以在dataset中设定
说,不能这样操作在一个开的数据集中
hthunter
2003-10-15
打赏
举报
回复
数据绑定的数据长度好像不能在数据集打开的状态下设置,否则会报错。
假如你要限制的长度跟数据库设计时的长度不一样,那只能在ADODataset等的Fields Editor里面修改相应字段的Size(并且只能小于或等于数据库字段的设计长度)。如果要限制的长度跟数据库设计的长度是一致的,那不需要做什么设置,DBGrid会自动根据字段的长度来做限制。
maginn
2003-10-15
打赏
举报
回复
这么写为什么不去
TEdit(dbgrid1.Columns[0]).Maxlength:=4;
Ehlib控件,包含
db
grid
eh...for delphi各版本一键安装
Ehlib控件,包含
db
grid
eh...for delphi各版本一键安装,内含实例源码.详细说明.
DELPHI 表格控件
DB
Grid
Eh史上最全使用资料(101页)
一、
DB
Grid
Eh(增强型表格组件)功能详解.....................................................................4 二、应用实例..........................................................................................................................5 1. 定制标题行......................................................................................................................5 1) 制作复杂标题行.......................................................................................................5 2) 按钮式标题..............................................................................................................5 3) 标题行显示图片.......................................................................................................5 4) 如根据不同状态在数据单元格中显示相应图片...................................................5 5) 自动显示标题行的升降排序标志符(▽降序△升序)并做相应排序...............6 6) 点
db
grid
eh 标题排序..............................................................................................7 7) 在
DB
Grid
EH 中怎样实现多重排序(标题出现0123等排列序号)? ................ 11 8) 让
db
grid
显示序号................................................................................................ 11 2. 外观布局........................................................................................................................12 1) 根据不同字段值显示相应的小图片.....................................................................12 2) 显示检查框(checkbox)外观.............................................................................12 3) 显示单、多列下拉列表.........................................................................................12 4) 显示日历下拉列表.................................................................................................13 5) 3D或平面外观效果...............................................................................................13 6) 行头和列头的启用关闭.........................................................................................13 7)
DB
Grid
如何实现透明效果?.................................................................................13 8) 滚动条的各种应用.................................................................................................16 9) 数据行高................................................................................................................19 10)
DB
Grid
设置Rowheight后如何将单元格内容纵向和垂直都居中?..............19 11) 设置
DB
Grid
EH 自适应列宽的最好方法.........................................................20 12) Ehlib 的
DB
Grid
Eh首列加序号........................................................................21 13) 分行分列、单元格的颜色设置.........................................................................23 14) 点击不同单元格列,执行不同的动作.............................................................27 15) 下拉式计算器.....................................................................................................28 16) 鼠标移到某个单元格,指针形状改变.............................................................28 17) 自动填充网格列宽到网格客户区.....................................................................29 18) 从注册表或ini文件中保存或恢复网格和列的层次。...................................29 3. 编辑功能........................................................................................................................29 1) 多选........................................................................................................................29 2) 文本多行显示.........................................................................................................30 3) 显示备注字段.........................................................................................................30 4) 如何让
db
grid
eh1
显示数据时只显示两位小数...................................................30 5) 获得当前
DB
Grid
Eh表中单元格的序号.............................................................30 6) 怎样在
db
grid
Eh和
Edit
中显示金额的千分号...................................................30 7) end;请问怎么才能使
DB
Grid
Eh不滚动就能提交数据?...................................32 8) 我怎么把
db
grid
里的数据一次插入到数据库呢................................................32 9) 在
DB
Grid
中可选中行而又可进入编辑状态......................................................32 10) 修正
DB
Grid
eh 丢失焦点时自动关闭
输入
法的问题......................................35 11)
DB
GRID
EH选定多行删除怎么实现...............................................................36 12)
DB
Grid
滚动表格的代码...................................................................................37 4. 统计功能........................................................................................................................37 白波九道整理自用版 第 3 页 1) 页脚合计................................................................................................................37 2) 定制表格底部(footer)区域的汇总统计行.......................................................38 3) T
DB
SumList说明..................................................................................................38 4) 如何工作以及为什么有时SumList的集合值计算不正确?.............................39 5)
db
grid
eh列求和.....................................................................................................39 5. 数据功能........................................................................................................................40 1) 查找字段点击某列值的下拉按纽弹出一个从数据库取值下拉列表...............40 2) 使用
DB
Grid
Eh自动过滤实现方法.....................................................................40 3) 使用
DB
Grid
Eh自动过滤实现方法2 ..................................................................41 4)
DB
Grid
Eh 控件中使用过滤功能 (适用ehlib 5.2 ehlib 5.3)................................42 5) 支持模糊查询.........................................................................................................43 6) ehlib4.4.50中支持模糊匹配的修改方法..............................................................44 7) EhLib 5.0 Build 5.0.13的过滤字串都是模糊过滤修改.......................................45 8) 滚动条滚动时选择不变,还有自动过滤功能的实现.........................................45 9) 增量搜索................................................................................................................46 10) ehlib总是按两次ctrl+f才出来查找框,怎么办?.........................................46 11) 如何改良
db
grid
eh的文字过滤........................................................................46 12) 改进
DB
Grid
eh 表头点击自动排序,实现双击状态轮流.................................47 13) 改良Ehlib 的排序功能,加快排序速度.............................................................49 14) 在
Db
Grid
Eh中显示TreeView效果................................................................50 15)
DB
Grid
Eh-KeyList、PickList............................................................................51 16) 主从表设置........................................................................................................53 17) 在
Db
Grid
Eh中显示表中表..............................................................................55 6.
输入
/输出.......................................................................................................................56 1) 导入导出数据.........................................................................................................56 2) 从多种格式导入/导出数据到T
DB
Grid
Eh...........................................................57 3)
DB
GRID
生成EXCEL报表.................................................................................57 4) 使用TPrint
DB
Grid
Eh 组件.................................................................................61 5) 打印时确定Ehlib定义的报表表头颜色? ............................................................61 6) Ehlib 中的Print
DB
Grid
Eh如何印页码,即第几页共几页...................................62 7) 怎么让Print
DB
Grid
Eh只打印
Db
Grid
Eh 中指定的列.......................................62 8) 怎样进行横向打印/ 打印预览?........................................................................62 7. 将存在的
DB
Grid
组件转换为
DB
Grid
Eh组件...........................................................62 三、EhLib安装问题.............................................................................................................64 1. EhLib 安装步骤.............................................................................................................64 2. EhLib 安装问题(
db
sumlst.dcu出错) ..........................................................................64 3. 安装提示找不到.BPL文件...........................................................................................65 四、Delphi 下的优秀表格(
Grid
)显示控件........................................................................65 1. Next
Grid
.........................................................................................................................65 2. Top
Grid
3.01...................................................................................................................65 3. XL
Grid
............................................................................................................................66 4. DevExpress ExpressQuantum
Grid
.................................................................................66 5. TMS
Grid
Pack...............................................................................................................68 6. EhLib ..............................................................................................................................71 白波九道整理自用版 第 4 页 7. Prof
Grid
..........................................................................................................................71 8. Easy
Grid
.........................................................................................................................71 五、delphi 中配置文件的使用(*.ini).........................................................................71 六、窗口动画效果Animatewindow应用...........................................................................72 七、Delphi Excel to Sql Server..............................................................................................73 八、Delphi控制Excel的经验如下:..................................................................................76
Db
Grid
Eh学习.docx
EHLib使用 内存表 TMemTableEh 与 TKbMemTable 和 FDMemTable使用相同点和区别的比较。
DB
Grid
eh.pas,可分组合并修改版
DB
Grid
eh.pas,可分组合并修改版
Ehlib_6.1.129
The history of the EhLib library -------------------------------- Version 6.1 + A new component T
DB
Vert
Grid
Eh - DataSet
Grid
with the Vertical Orientation. The component is used to display and
edit
a single record of DataSet in a vertical orientation. Basic properties of the T
DB
Vert
Grid
Eh: Rows: T
DB
Ver
Grid
Rows - A collection of items of TFieldRowEh type to display fields of a record. This is analogous to the
Column
s collection in T
DB
Grid
Eh. Options: T
DB
VH
Grid
Options - Configure basic properties of the vertical
grid
. RowsDefValues: TFieldRowDefValuesEh - default values for line
Grid
row - TFieldRowEh. This is analogous of
Column
DefValues in T
DB
Grid
Eh.
Grid
LineParams: T
DB
Vert
Grid
LineParamsEh - Color settings of the dividing lines in vertical
grid
. DataColParams: T
DB
Vert
Grid
DataColParamsEh - The setting of the
column
with data. LabelColParams: T
DB
Vert
Grid
LabelColParamEh - The setting of the
column
with row label. See an example of using T
DB
Vert
Grid
Eh in a project:
\ Demos \
DB
Vert
Grid
Eh.SimpleDemo \ Project1.dpr compiled project:
\ Demos \ Bin \
DB
Vert
Grid
Eh.SimpleDemo.Exe * There are changes in the
grid
s inheritance tree: New inheritance tree is: TCustomControl | - TCustom
Grid
Eh | - TCustom
DB
Axis
Grid
Eh | - TCustom
DB
Grid
Eh | | | - T
DB
Grid
Eh | - TCustom
DB
Vert
Grid
Eh | - T
DB
Vert
Grid
Eh * Some constants and procedures are moved from the module
DB
Grid
Eh to the
DB
Axis
Grid
sEh. + Added a new global function to display a ObjectInspector-like Form. Use the next procedure to display the ObjectInspector-like Form: procedure ShowObjectInspectorForm ( Component: TObject; // A component to Inspect FormBounds: TRect; // Form Borders NewForm: Boolean = False // Show as a new Form ); This is a simple ObjectInspector that can be used to debug property setting at run-time. See an example that shows how to use ShowObjectInspectorForm here:
\ Demos \ ObjectInspectorForm.SimpleDemo \ Project1.dpr compiled project:
\ Demos \ Bin \ ObjectInspectorForm.SimpleDemo.Exe In
DB
Grid
Eh + Added an ability to change the size of RowDetailPanel by mouse at RunTime. New properties in RowDetailPanel: property VertSizing: Boolean - Show an RowDetailPanel Splitter at the buttom of the RowDetailPanel. property MinHeight: Integer - Minimum height of the RowDetailPanel. property
Max
Height: Integer -
Max
imum height of the RowDetailPanel. property SizingBarBeveled: Boolean - Splitter area has a 3D border. property SizingBarHeight: Integer - The height of the Splitter. + Added an ability to darken gray the
grid
while the data is loading. See StartLoadingStatus and FinishLoadingStatus methods in the T
DB
Grid
Eh. See the example that shows this opportunity in a project:
\ Demos \
DB
Grid
Eh.LoadingStatus \ Project1.dpr compiled project:
\ Demos \ Bin \
DB
Grid
Eh.LoadingStatus.Exe
Delphi
5,386
社区成员
262,729
社区内容
发帖
与我相关
我的任务
Delphi
Delphi 开发及应用
复制链接
扫一扫
分享
社区描述
Delphi 开发及应用
社区管理员
加入社区
获取链接或二维码
近7日
近30日
至今
加载中
查看更多榜单
社区公告
暂无公告
试试用AI创作助手写篇文章吧
+ 用AI写文章