请问DataGrid问题

zhupeibin 2003-10-27 11:38:34
1。如何在DateGrid中录入一行数据后,按回车转如下一行
2。如何在转入下一行前判断输入的数据是否合法,如录入的数据是否 >0 and <100
...全文
23 11 打赏 收藏 转发到动态 举报
写回复
用AI写文章
11 条回复
切换为时间正序
请发表友善的回复…
发表回复
zhupeibin 2003-10-28
  • 打赏
  • 举报
回复
谢谢各位,如下写可以解决我的问题。但是仍有两个BUG
1。输入错误信息时,如果用鼠标选择时,判断不起作用。如果用事件BeforeColUpdate可以对任何的变换单元格进行判断,但是用回车时,第一次焦点停留在原地,再按一次报DataGrid1.Row = DataGrid1.Row + 1出错 实时错误‘7011’
2。用KeyDown事件需按两次回车,不知是什么原因

Private Sub datagrid1_KeyPress(Keycode As Integer)
If Keycode = 13 Then
If CInt(DataGrid1.Text) < 0 Or CInt(DataGrid1.Text) > 100 Then
MsgBox "数据输入出错¡"
Exit Sub
End If
DataGrid1.Row = DataGrid1.Row + 1

End If
End Sub
jpinglee 2003-10-28
  • 打赏
  • 举报
回复
要鼠标起作用,须在mouse_down,mouse_move,mouse_up中添代码
yoki 2003-10-27
  • 打赏
  • 举报
回复
if Cint(datagrid.text)>0 and Cint(datagrid.text)<100 then row=row+1
jpinglee 2003-10-27
  • 打赏
  • 举报
回复
Private Sub DataGrid1_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 13 Then
If DataGrid1.Text < 0 Or DataGrid1.Text > 100 Then
MsgBox "数据输入有误!"
Exit Sub
End If
DataGrid1.Row = DataGrid1.Row + 1
DataGrid1.Col = 0
End If
End Sub
cdwq88 2003-10-27
  • 打赏
  • 举报
回复

Private Sub DataGrid1_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 13 Then
If DataGrid1.Text < 0 Or DataGrid1.Text > 100 Then
MsgBox "数据输入有误!"
Exit Sub
End If
DataGrid1.Row = DataGrid1.Row + 1
End If
End Sub

zhangying7725 2003-10-27
  • 打赏
  • 举报
回复

Private Sub DataGrid1_KeyDown(KeyCode As Integer, Shift As Integer)
If Cint(datagrid1.text)>0 and Cint(datagrid2.text)<100 and keycode=vbKeyReturn Then
DataGrid1.Row = DataGrid1.Row + 1
DataGrid1.Col = DataGrid1.Col
End If
End Sub
Lucky527 2003-10-27
  • 打赏
  • 举报
回复
dim gtext as string
gtext=..........'这行中的某数据
if Cint(gtext)>0 and Cint(gtext)<100 then
datagrid.row=datagrid.row+1
else
msgbox"您刚才输入的数据有误,请重新输入!",,"提示"
end if
射天狼 2003-10-27
  • 打赏
  • 举报
回复
Private Sub DataGrid1_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 13 Then DataGrid1.Row = DataGrid1.Row + 1
End Sub
射天狼 2003-10-27
  • 打赏
  • 举报
回复
Dim strOld As String

Private Sub DataGrid1_BeforeColUpdate(ByVal ColIndex As Integer, OldValue As Variant, Cancel As Integer)
strOld = OldValue
End Sub

Private Sub DataGrid1_BeforeUpdate(Cancel As Integer)
If DataGrid1.Text < 0 Or DataGrid1.Text > 10 Then
MsgBox "数据非法~"
DataGrid1.Text = strOld
'Cancel = True
End If
End Sub
银狐被占用 2003-10-27
  • 打赏
  • 举报
回复
学习!
livingliving 2003-10-27
  • 打赏
  • 举报
回复
可以读出每一格的数据进行判断,
jQuery EasyUI是一组基于jQuery的UI插件集合,而jQuery EasyUI的目标就是帮助web开发者更轻松的打造出功能丰富并且美观的UI界面。开发者不需要编写复杂的javascript,也不需要对css样式有深入的了解,开发者需要了解的只有一些简单的html标签 1.3.6更新 Bug treegrid: getChecked方法不能返回正确的行. fixed. tree: 异步树,在onlyLeafCheck:true时复选框不显示正确. fixed. Improvement treegrid:继承datagrid组件所有的selecting和checking方法。 linkbutton:图标对齐方式,支持值:'top','bottom','left','right'。 linkbutton:添加"size"属性,支持值:'small','large'。 linkbutton:添加的onClick事件。 menubutton:添加"menuAlign"属性,允许用户设置顶级菜单对齐。 combo:添加"panelAlign"属性,支持值:'left','right'。 calendar:"formatter"、"styler"和"validator"选项可用于自定义日历日期。 calendar:添加的onChange事件。 panel:添加"method","queryParams"和"loader"属性。 panel:添加"onLoadError"事件。 datagrid:添加"onBeginEdit"事件。 datagrid:添加"onEndEdit"事件。 datagrid:添加"sort"方法和"onBeforeSortColumn"事件。 datagrid:"combogrid"编辑器集成到datagriddatagrid:添加"ctrlSelect"属性,允许使用ctrl+click 多选 slider:添加"converter"选项,允许用户决定如何将一个值转换为滑块的位置或滑块位置值。 searchbox:添加"disabled"属性。 searchbox:添加"disabled","enable","clear","reset"方法。 spinner:添加"readonly"属性、"readonly"方法和"onChange事件。

1,217

社区成员

发帖
与我相关
我的任务
社区描述
VB 数据库(包含打印,安装,报表)
社区管理员
  • 数据库(包含打印,安装,报表)社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧