以文本方式查看主题 - Foxtable(狐表) (http://foxtable.net/bbs/index.asp) -- 专家坐堂 (http://foxtable.net/bbs/list.asp?boardid=2) ---- 代码问题 (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=132047) |
-- 作者:mtx -- 发布时间:2019/3/12 17:39:00 -- 代码问题 此主题相关图片如下:微信图片_20190312174707.png 您好,我在程序运行过程中,出现了这种问题,不知道是哪里的问题,是列属性不对吗? 此主题相关图片如下:微信图片_20190312174702.png |
-- 作者:有点甜 -- 发布时间:2019/3/12 17:48:00 --
贴出你对应事件所写的代码
|
-- 作者:mtx -- 发布时间:2019/3/12 17:50:00 -- Afterload: Dim cmb3 As WinForm.ComboBox = e.Form.Controls("ComboBox3") cmb3.items.add("1") cmb3.items.add("2") cmb3.items.add("3") cmb3.items.add("4") Dim cmb1 As WinForm.ComboBox = e.Form.Controls("ComboBox1") Dim cmb2 As WinForm.ComboBox = e.Form.Controls("ComboBox2") Dim i As Integer For i = 0 To Tables("可能性").Rows.Count -1 cmb1.items.add(Tables("可能性").Rows(i)("等级")) Next For i = 0 To Tables("严重度").Rows.Count -1 cmb2.items.add(Tables("严重度").Rows(i)("等级")) Next Dim Lr As Integer Dim Lc As Integer Dim Sr As Integer Dim Sc As Integer Lr = Tables("可能性").Rows.Count Lc = Tables("可能性").Cols.Count Sr = Tables("严重度").Rows.Count Sc = Tables("严重度").Cols.Count Dim j As Integer For i = 1 To Lc-1 Tables("风险矩阵")(0,i-1)=Tables("可能性").Cols(i).Caption Next For i = Lr-1 To 0 Step -1 For j = 1 To Lc-1 Tables("风险矩阵")(Lr-1-i+1,j-1)=Tables("可能性")(i,j) Next Next For i = Lr-1 To 0 Step -1 Tables("风险矩阵")(Lr-1-i+1,0)="等级"&Tables("风险矩阵")(Lr-1-i+1,0) Next \' For i = 0 To Sr-1 Tables("风险矩阵")(Lr+1,i+Lc-1)="等级"&Tables("严重度").rows(i)("等级") Next For i = 0 To Sr-1 Tables("风险矩阵")(0,i+Lc-1)="等级"&Tables("严重度").rows(i)("等级") Next \' For j = 1 To Sc-1 Tables("风险矩阵")(Lr+j,Lc-2)=Tables("严重度").Cols(j).Caption Next \' For i = 0 To Sc-3 For j = 0 To Sr-1 \'messagebox.show(j,i+2) Tables("风险矩阵")(Lr+i+2,j+Lc-1)=Tables("严重度")(j,i+2) Next Next Dim k As Integer For i = 1 To Lr For j = Lc-1 To Lc+4 For k = 0 To Tables("风险值").Rows.count -1 If Tables("风险矩阵")(i,0) = "等级" & cstr(Tables("风险值").Rows(k)("可能性")) And Tables("风险矩阵")(Lr+1,j) = "等级" & cstr(Tables("风险值").Rows(k)("严重度")) Then Tables("风险矩阵")(i,j) = Tables("风险值").Rows(k)("风险值") \'Tables("中石油风险矩阵表")(i,j).Font= New Font("宋体",15,FontStyle.Regular) \'ForeColor = Color.DarkBlue \'messagebox.show(i,j) End If Next Next Next \' For i = 0 To Tables("风险矩阵").Cols.Count-1 Tables("风险矩阵").Cols(i).CloseWindow Next Tables("风险矩阵").SetColVisibleWidth("第1列|80|第2列|260|第3列|260|第4列|260|第5列|260|第6列|260|第7列|260|第8列|260|第9列|260|第10列|260|第11列|260|第12列|260|第13列|260|第14列|260|第15列|260|第16列|260|第17列|260|第18列|260|第19列|260|第20列|260|第21列|260|第22列|260|第23列|260|第24列|260|第25列|260") Tables("风险矩阵").AutoSizeRows Tables("风险矩阵").Cols.Frozen =1 For Each dt As DataTable In DataTables dt.Save() Next
|
-- 作者:mtx -- 发布时间:2019/3/12 17:50:00 -- button-1:click Dim cmb1 As WinForm.ComboBox = e.Form.Controls("ComboBox1") Dim cmb2 As WinForm.ComboBox = e.Form.Controls("ComboBox2") Dim cmb3 As WinForm.ComboBox = e.Form.Controls("ComboBox3") Dim i As Integer Dim a As Integer a=0 If cmb1.text<>"" And cmb2.text<>"" And cmb3.text<>"" Then For i = 0 To Tables("风险值").Rows.Count -1 If Tables("风险值").Rows(i)("可能性") = cmb1.text And Tables("风险值").Rows(i)("严重度") = cmb2.text Then Tables("风险值").Rows(i)("风险值") = cmb3.text a=a+1 End If Next If a=0 Then Tables("风险值").AddNew() Tables("风险值").Rows(i)("可能性") = cmb1.text Tables("风险值").Rows(i)("严重度") = cmb2.text Tables("风险值").Rows(i)("风险值") = cmb3.text End If Dim j As Integer Dim k As Integer Dim sumcol As Integer Dim sumrow As Integer sumcol = Tables("可能性").Cols.count -1 +Tables("严重度").Rows.count sumrow = Tables("可能性").Rows.count +Tables("严重度").cols.count-1 For j =0 To sumcol-1 For k = 0 To sumrow-1 If Tables("风险矩阵")(0,k) <>"" And Tables("风险矩阵").Rows(j)("等级") <>""then If Tables("风险矩阵")(0,k) = "等级" & cmb2.text And Tables("风险矩阵").Rows(j)("等级") = "等级" & cmb1.text Then Tables("风险矩阵")(j,k) = cmb3.text End If End If Next Next For Each dt As DataTable In DataTables dt.Save() Next Else messagebox.show("请选择合适的可能性和严重度,并确定风险等级","提示") End If
|
-- 作者:有点甜 -- 发布时间:2019/3/12 17:54:00 -- 应该是你赋值的时候出错了。比如你某个列是 双精度小数,但你赋值了一个字符,就会报错。
请自行定位出错位置
http://www.foxtable.com/webhelp/scr/1485.htm
|