Option Strict ON 出现了一些错误
Option Strict ON made some errors
我必须启用 Option Script,才能正确使用 OpenXML 包。完成后,我有几个错误,关于从一种类型到另一种类型的隐式转换。
Label6.Text = FormatNumber(CInt(Form3.Label12.Text), "0.00") 'O.S. On disallows implicit conversions from String to Integer'
hrrspk.Add(Form3.ListBox2.Items(i)) 'O.S. On disallows implicit conversions from Double to Integer'
tsdom.Add(((hrrspk(ts) - CInt(Label6.Text)) * (CInt(Label3.Text) - CInt(Label4.Text)) / (CInt(Label6.Text))) + CInt(Label4.Text)) 'O.S. On disallows implicit conversions from Double to Integer'
hrrnativexcel = CreateObject("EXCEL.APPLICATION") 'O.S. On disallows implicit conversions from Object to Application'
hrrnativexcel.Cells(1, 1).value = "Time [s]" 'O.S. On disallows late binding'
For Each o As String In Form3.ListBox1.Items.Cast(Of Object).Zip(Form3.ListBox2.Items.Cast(Of Object), Function(x1, x2) x1 & "," & x2) 'O.S. On prohibits operands of type Object for operator &.'
如何更改此行以解决此错误?谢谢大家会回答我。
变化:
Label6.Text = FormatNumber(CInt(Form3.Label12.Text), "0.00") - O.S
收件人:
Label6.Text = CDbl(Form3.Label12.Text).ToString("0.00")
对于 Double to Integer 错误。
变化:
hrrspk.Add(Form3.ListBox2.Items(i))
收件人:
hrrspk.Add(CInt(Form3.ListBox2.Items(i)))
变化:
If Me.TextBox1.Text.Split(".")(1).Length < 3 Then
收件人:
If Me.TextBox1.Text.Split(".".ToCharArray())(1).Length < 3 Then
对于 Object and & one,更改:
Function(x1, x2) x1 & "," & x2
收件人:
Function(x1, x2) CStr(x1) & "," & CStr(x2) ' or use x1.ToString() and x2.ToString()
我必须启用 Option Script,才能正确使用 OpenXML 包。完成后,我有几个错误,关于从一种类型到另一种类型的隐式转换。
Label6.Text = FormatNumber(CInt(Form3.Label12.Text), "0.00") 'O.S. On disallows implicit conversions from String to Integer'
hrrspk.Add(Form3.ListBox2.Items(i)) 'O.S. On disallows implicit conversions from Double to Integer'
tsdom.Add(((hrrspk(ts) - CInt(Label6.Text)) * (CInt(Label3.Text) - CInt(Label4.Text)) / (CInt(Label6.Text))) + CInt(Label4.Text)) 'O.S. On disallows implicit conversions from Double to Integer'
hrrnativexcel = CreateObject("EXCEL.APPLICATION") 'O.S. On disallows implicit conversions from Object to Application'
hrrnativexcel.Cells(1, 1).value = "Time [s]" 'O.S. On disallows late binding'
For Each o As String In Form3.ListBox1.Items.Cast(Of Object).Zip(Form3.ListBox2.Items.Cast(Of Object), Function(x1, x2) x1 & "," & x2) 'O.S. On prohibits operands of type Object for operator &.'
如何更改此行以解决此错误?谢谢大家会回答我。
变化:
Label6.Text = FormatNumber(CInt(Form3.Label12.Text), "0.00") - O.S
收件人:
Label6.Text = CDbl(Form3.Label12.Text).ToString("0.00")
对于 Double to Integer 错误。
变化:
hrrspk.Add(Form3.ListBox2.Items(i))
收件人:
hrrspk.Add(CInt(Form3.ListBox2.Items(i)))
变化:
If Me.TextBox1.Text.Split(".")(1).Length < 3 Then
收件人:
If Me.TextBox1.Text.Split(".".ToCharArray())(1).Length < 3 Then
对于 Object and & one,更改:
Function(x1, x2) x1 & "," & x2
收件人:
Function(x1, x2) CStr(x1) & "," & CStr(x2) ' or use x1.ToString() and x2.ToString()