If语句有错误。 [英] Having Error with If statement.
本文介绍了If语句有错误。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我收到此代码的错误:
对于 j = 1 至 srchtbl.RowCount
< span class =code-keyword>如果 srchtbl.Item( 1 ,j).Value = ComboBox1.Text 然后
irs =(srchtbl.Item( 0 ,j).Value)
branchID =(srchtbl.Item( 2 ,j).Value)
Else
结束 如果
下一步
i在srchtbl中有29行和3列。
错误信息:
索引超出范围。必须是非负数且小于集合的大小。
参数名称:index
解决方案
没关系。我解决了。
继承人新代码
对于 j = 1 srchtbl.RowCount
如果 srchtbl.Item( 1 ,j - 1 )。Value = ComboBox1.Text 然后
irs =(srchtbl.Item( 0 ,j - 1 )。值)
branchID =(srchtbl.Item( 2 ,j - 1 )。值)
其他
结束 如果
下一步跨度>
i''m getting error with this code:
For j = 1 To srchtbl.RowCount
If srchtbl.Item(1, j).Value = ComboBox1.Text Then
irs = (srchtbl.Item(0, j).Value)
branchID = (srchtbl.Item(2, j).Value)
Else
End If
Next
i have 29 row and 3 columns in srchtbl.
Error message:
Index was out of range. Must be non-negative and less than the size of the collection. Parameter name: index
解决方案
It''s okay na. I solved it.
heres the new code
For j = 1 To srchtbl.RowCount If srchtbl.Item(1, j - 1).Value = ComboBox1.Text Then irs = (srchtbl.Item(0, j - 1).Value) branchID = (srchtbl.Item(2, j - 1).Value) Else End If Next
这篇关于If语句有错误。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文