开发者

Value was either too large or too small for an Int16 error

开发者 https://www.devze.com 2023-01-02 17:13 出处:网络
I am working on fixing a bug in VB that is giving this error.I am new to VB, so there is some syntax that I am not fully understanding.The code that开发者_如何转开发 is throwing the error says:

I am working on fixing a bug in VB that is giving this error. I am new to VB, so there is some syntax that I am not fully understanding. The code that开发者_如何转开发 is throwing the error says:

.Row(itemIndex).Item("parentIndex") = CLng(oID) + 1000000

I understand that adding 1000000 is too much for an int16. I can't change that value (not right now anyway). What I don't understand, and can't seem to find, is what .Row is referring too. Any ideas?


Next to the .Row do you see a With keyword?

With allows you to do stuff like this:

With myClass
   .FirstName  ="John"
End With

Which is the same as this:

myClass.FirstName = "John"

Usually you will use a With block if you have a lot of references to the same object. For example:

myClass.FirstName = "John"
myClass.FirstName = "John"
myClass.FirstName = "John"
myClass.FirstName = "John"
myClass.FirstName = "John"

can be changed to this:

With myClass
  .FirstName = "John" 
  .FirstName = "John"
  .FirstName = "John"
  .FirstName = "John"
  .FirstName = "John"
End With

EDIT:

I copied and pasted the above code, hence the repeated use of the property FirstName.

0

精彩评论

暂无评论...
验证码 换一张
取 消