无法将类型“Integer”的起始值、门类“String”的限制值和类型“Integer”的步长值转换为常用数值类型
无法将类型“Integer”的起始值、类型“String”的限制值和类型“Integer”的步长值转换为常用数值类型。
for i=0 to k :无法将类型“Integer”的起始值、类型“String”的限制值和类型“Integer”的步长值转换为常用数值类型。
Private Sub ProductsForm_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim k = GetSetting(Application.CompanyName, "y", "left", CmbType.Items.Count - 1)
Dim i
For i = 0 To k
CmbType.Items.Add(GetSetting(Application.CompanyName, "y", "top" & i))
Next
CheckBox1.CheckState = (GetSetting(Application.CompanyName, "checkbox", "apple", CheckBox1.CheckState))
TxtCheck.Text = (GetSetting(Application.CompanyName, "textbox", "apple", TxtCheck.Text))
If CheckBox1.Checked = True Then
Me.checked()
End If
End Sub
------解决方案--------------------
dim i 后面没有as 类型,样默认的类型是为object的。
讲i定义为整形
Dim i as interger
楼主试试。。。
------解决方案--------------------
运行到for时debug一下k的值和 isnumberic(k)的结果
------解决方案--------------------
变量k应该是字符串,试试
for i as int=0 to cint(k)
for i=0 to k :无法将类型“Integer”的起始值、类型“String”的限制值和类型“Integer”的步长值转换为常用数值类型。
Private Sub ProductsForm_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim k = GetSetting(Application.CompanyName, "y", "left", CmbType.Items.Count - 1)
Dim i
For i = 0 To k
CmbType.Items.Add(GetSetting(Application.CompanyName, "y", "top" & i))
Next
CheckBox1.CheckState = (GetSetting(Application.CompanyName, "checkbox", "apple", CheckBox1.CheckState))
TxtCheck.Text = (GetSetting(Application.CompanyName, "textbox", "apple", TxtCheck.Text))
If CheckBox1.Checked = True Then
Me.checked()
End If
End Sub
------解决方案--------------------
dim i 后面没有as 类型,样默认的类型是为object的。
讲i定义为整形
Dim i as interger
Dim k = GetSetting(Application.CompanyName, "y", "left", CmbType.Items.Count - 1)
Dim i as interger
For i = 0 To k
CmbType.Items.Add(GetSetting(Application.CompanyName, "y", "top" & i))
Next
CheckBox1.CheckState = (GetSetting(Application.CompanyName, "checkbox", "apple", CheckBox1.CheckState))
TxtCheck.Text = (GetSetting(Application.CompanyName, "textbox", "apple", TxtCheck.Text))
If CheckBox1.Checked = True Then
Me.checked()
End If
楼主试试。。。
------解决方案--------------------
运行到for时debug一下k的值和 isnumberic(k)的结果
------解决方案--------------------
变量k应该是字符串,试试
for i as int=0 to cint(k)