Foxtable(狐表)用户栏目专家坐堂 → [求助]一开始用得挺好,然后就出了问题


  共有3662人关注过本帖树形打印复制链接

主题:[求助]一开始用得挺好,然后就出了问题

帅哥哟,离线,有人找我吗?
陈卫
  11楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:幼狐 帖子:126 积分:813 威望:0 精华:0 注册:2015/10/22 10:35:00
  发帖心情 Post By:2016/6/13 15:12:00 [只看该作者]

内部合同表如图:
图片点击可在新窗口打开查看此主题相关图片如下:内部合同表.bmp
图片点击可在新窗口打开查看

在表属性中的Datacolchanged事件中代码如下:
Select Case e.DataCol.Name
    Case "品种_杆径"
        Dim dr As DataRow = e.DataRow
        Dim pr1 As DataRow
        Dim pr2 As DataRow
        Dim pr3 As DataRow
        Dim pr4 As DataRow
        Dim pr5 As DataRow
        Dim pr6 As DataRow
        Dim filter1 As String
        filter1 = "品种_杆径 = '" & dr("品种_杆径") & "'"
        pr1 = DataTables("编号列表1").Find(filter1)
        If pr1 IsNot Nothing Then
            dr("品种_杆径编号") = pr1("品种_杆径编号")
        End If
        dr("品种_ID") = dr("品种_杆径编号")

    Case "品种_材质"
        Dim dr As DataRow = e.DataRow
        Dim pr2 As DataRow
        Dim filter2 As String
        filter2 = "品种_材质 = '" & dr("品种_材质") & "'"
        pr2 = DataTables("编号列表2").Find(filter2)
        If pr2 IsNot Nothing Then
            dr("品种_材质编号") = pr2("品种_材质编号")
        End If
        dr("品种_ID") = dr("品种_杆径编号") & dr("品种_材质编号")
        
    Case  "品种_长度"
        Dim dr As DataRow = e.DataRow
        Dim pr3 As DataRow
        Dim filter3 As String
        filter3 = "品种_长度 = '" & dr("品种_长度") & "'"
        pr3 = DataTables("编号列表3").Find(filter3)
        If pr3 IsNot Nothing Then
            dr("品种_长度编号") = pr3("品种_长度编号")
        End If
        dr("品种_ID") = dr("品种_杆径编号") & dr("品种_材质编号") & dr("品种_长度编号")
        
    Case "品种_级别"
        Dim dr As DataRow = e.DataRow
        Dim pr4 As DataRow
        Dim filter4 As String
        filter4 = "品种_级别 = '" & dr("品种_级别") & "'"
        pr4 = DataTables("编号列表4").Find(filter4)
        If pr4 IsNot Nothing Then
            dr("品种_级别编号") = pr4("品种_级别编号")
        End If
        dr("品种_ID") = dr("品种_杆径编号") & dr("品种_材质编号") & dr("品种_长度编号") & dr("品种_级别编号")
       
 Case "品种_接箍"
        Dim dr As DataRow = e.DataRow
        Dim pr6 As DataRow
        Dim filter6 As String
        filter6 = "品种_接箍 = '" & dr("品种_接箍") & "'"
        pr6 = DataTables("编号列表6").Find(filter6)
        If pr6 IsNot Nothing Then
            dr("品种_接箍编号") = pr6("品种_接箍编号")
        End If
        dr("品种_ID") = dr("品种_杆径编号") & dr("品种_材质编号") & dr("品种_长度编号") & dr("品种_级别编号") & dr("品种_接箍编号")
    

Case "品种_特殊要求"
        Dim dr As DataRow = e.DataRow
        Dim pr5 As DataRow
        Dim filter5 As String
        filter5 = "品种_特殊要求 = '" & dr("品种_特殊要求") & "'"
        pr5 = DataTables("编号列表5").Find(filter5)
        If pr5 IsNot Nothing Then
            dr("品种_特殊要求编号") = pr5("品种_特殊要求编号")
        End If
        dr("品种_ID") = dr("品种_杆径编号") & dr("品种_材质编号") & dr("品种_长度编号") & dr("品种_级别编号") & dr("品种_接箍编号") & dr("品种_特殊要求编号")
       
   End Select
表属性中的DataRowAdding事件中代码如下:e.DataRow("序号") = e.DataTable.Compute("Max(序号)") + 1

合同录入窗口设计如图
图片点击可在新窗口打开查看此主题相关图片如下:内部合同录入设计界面.bmp
图片点击可在新窗口打开查看
窗口的Afterload事件编码如下:
Dim lbl As WinForm.Label
lbl = e.Form.Controls("Welcome")
lbl.Text = "今 天 是 " & format(Date.Today,"yyyy年MM月dd日") & ", 大 地 石 油 机 械 公 司 欢 迎 您 !"

Dim txtBox As WinForm.TextBox
txtBox = e.Form.Controls("合同号栏")
txtBox.ReadOnly = BooleanEnum.True
txtBox = e.Form.Controls("生产数量栏")
txtBox.ReadOnly = BooleanEnum.True
txtBox = e.Form.Controls("客户新增要求录入栏")
txtBox.ReadOnly = BooleanEnum.True

Dim combobox As WinForm.ComboBox
ComboBox = e.Form.Controls("杆径栏")
ComboBox.ReadOnly = BooleanEnum.True
ComboBox = e.Form.Controls("材质栏")
ComboBox.ReadOnly = BooleanEnum.True
ComboBox = e.Form.Controls("长度栏")
ComboBox.ReadOnly = BooleanEnum.True
ComboBox = e.Form.Controls("级别栏")
ComboBox.ReadOnly = BooleanEnum.True
ComboBox = e.Form.Controls("接箍栏")
ComboBox.ReadOnly = BooleanEnum.True
ComboBox = e.Form.Controls("特殊要求栏")
ComboBox.ReadOnly = BooleanEnum.True
ComboBox = e.Form.Controls("甲方栏")
ComboBox.ReadOnly = BooleanEnum.True
ComboBox = e.Form.Controls("乙方栏")
ComboBox.ReadOnly = BooleanEnum.True
ComboBox = e.Form.Controls("客户名称栏")
ComboBox.ReadOnly = BooleanEnum.True

Dim DateTimePicker As WinForm.DateTimePicker
DateTimePicker = e.Form.Controls("交付日期栏")
DateTimePicker.ReadOnly = BooleanEnum.True
DateTimePicker = e.Form.Controls("签订日期栏")
DateTimePicker.ReadOnly = BooleanEnum.True

e.Form.Controls("内贸").Enabled=False
e.Form.Controls("外贸").Enabled=False


 回到顶部
帅哥哟,离线,有人找我吗?
陈卫
  12楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:幼狐 帖子:126 积分:813 威望:0 精华:0 注册:2015/10/22 10:35:00
  发帖心情 Post By:2016/6/13 15:13:00 [只看该作者]

控件“合同号栏”的事件leave中编写代码:e.Sender.HideToolTip()
在该控件的事件Validating编写代码:
If e.Sender.Value Is Nothing Then
    e.Cancel = True
End If
With Forms("抽油杆分公司内部合同录入窗口").Controls("合同号栏")
    Dim txt As String = e.Sender.Text
    If txt = "" OrElse txt.Length <> 11  Then
        e.Cancel = True
        Messagebox.Show("必须按格式输入编号!","提示",MessageBoxButtons.OK,MessageBoxIcon.Information)
        Return
    End If
End With
Tables("内部合同").Current("合同编号") = e.Sender.Text

控件“录入新合同”Click事件编码如下:
Tables("内部合同").AddNew()
Dim txtBox As WinForm.TextBox
txtBox = e.Form.Controls("合同号栏")
txtBox.ReadOnly = BooleanEnum.False
txtBox = e.Form.Controls("生产数量栏")
txtBox.ReadOnly = BooleanEnum.False
txtBox = e.Form.Controls("客户新增要求录入栏")
txtBox.ReadOnly = BooleanEnum.False

Dim combobox As WinForm.ComboBox
ComboBox = e.Form.Controls("杆径栏")
ComboBox.ReadOnly = BooleanEnum.False
ComboBox = e.Form.Controls("材质栏")
ComboBox.ReadOnly = BooleanEnum.False
ComboBox = e.Form.Controls("长度栏")
ComboBox.ReadOnly = BooleanEnum.False
ComboBox = e.Form.Controls("级别栏")
ComboBox.ReadOnly = BooleanEnum.False
ComboBox = e.Form.Controls("接箍栏")
ComboBox.ReadOnly = BooleanEnum.False
ComboBox = e.Form.Controls("特殊要求栏")
ComboBox.ReadOnly = BooleanEnum.False
ComboBox = e.Form.Controls("甲方栏")
ComboBox.ReadOnly = BooleanEnum.False
ComboBox = e.Form.Controls("乙方栏")
ComboBox.ReadOnly = BooleanEnum.False
ComboBox = e.Form.Controls("客户名称栏")
ComboBox.ReadOnly = BooleanEnum.False

Dim DateTimePicker As WinForm.DateTimePicker
DateTimePicker = e.Form.Controls("交付日期栏")
DateTimePicker.ReadOnly = BooleanEnum.False
DateTimePicker = e.Form.Controls("签订日期栏")
DateTimePicker.ReadOnly = BooleanEnum.False

e.Form.Controls("内贸").Enabled=True
e.Form.Controls("外贸").Enabled=True

 回到顶部
帅哥哟,离线,有人找我吗?
大红袍
  13楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:贵宾 帖子:39310 积分:196782 威望:0 精华:1 注册:2015/4/25 9:23:00
  发帖心情 Post By:2016/6/13 15:16:00 [只看该作者]

 上传实例说明问题。单独做个例子啊


 回到顶部
帅哥哟,离线,有人找我吗?
陈卫
  14楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:幼狐 帖子:126 积分:813 威望:0 精华:0 注册:2015/10/22 10:35:00
  发帖心情 Post By:2016/6/13 15:21:00 [只看该作者]

怎么做?编码发出来不对吗?

 回到顶部
帅哥哟,离线,有人找我吗?
大红袍
  15楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:贵宾 帖子:39310 积分:196782 威望:0 精华:1 注册:2015/4/25 9:23:00
  发帖心情 Post By:2016/6/13 15:22:00 [只看该作者]

单独做个例子发上来,或者上传你的项目。


 回到顶部
帅哥哟,离线,有人找我吗?
陈卫
  16楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:幼狐 帖子:126 积分:813 威望:0 精华:0 注册:2015/10/22 10:35:00
  发帖心情 Post By:2016/6/13 15:37:00 [只看该作者]

这是我的项目,才开始,请专家指教
 下载信息  [文件大小:   下载次数: ]
图片点击可在新窗口打开查看点击浏览该文件:管理项目1.foxdb



 回到顶部
帅哥哟,离线,有人找我吗?
大红袍
  17楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:贵宾 帖子:39310 积分:196782 威望:0 精华:1 注册:2015/4/25 9:23:00
  发帖心情 Post By:2016/6/13 17:05:00 [只看该作者]

密码贴出来

 回到顶部
帅哥哟,离线,有人找我吗?
陈卫
  18楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:幼狐 帖子:126 积分:813 威望:0 精华:0 注册:2015/10/22 10:35:00
  发帖心情 Post By:2016/6/13 18:03:00 [只看该作者]

用户:陈卫,密码000

 回到顶部
帅哥哟,离线,有人找我吗?
大红袍
  19楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:贵宾 帖子:39310 积分:196782 威望:0 精华:1 注册:2015/4/25 9:23:00
  发帖心情 Post By:2016/6/13 19:35:00 [只看该作者]

各个Validating事件,加上判断是否为空的代码

 

If Tables("内部合同").Current IsNot Nothing Then
    Tables("内部合同").Current("客户_单位名称") = e.Sender.Text
End If


 回到顶部
帅哥哟,离线,有人找我吗?
陈卫
  20楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:幼狐 帖子:126 积分:813 威望:0 精华:0 注册:2015/10/22 10:35:00
  发帖心情 Post By:2016/6/14 8:24:00 [只看该作者]

专家您好,我按照您的办法,把每个Validating事件,都加上了判断是否为空的代码,但问题没有解决,在录入新合同编号的时候,显示出错:.
NET Framework 版本:2.0.50727.3655
Foxtable 版本:2016.5.13.1
错误所在事件:窗口,抽油杆分公司内部合同录入窗口,客户名称栏,Validating
详细错误信息:
未将对象引用设置到对象的实例。
其他问题没有变。


 回到顶部
总数 32 上一页 1 2 3 4 下一页