I have activated Option Explicit
and Option Strict
, and it appears to me that I get some errors:
Option Strict On disallows implicit conversion from 'String' to 'Double'
and
Option Strict On disallows implicit conversion from 'Double' to 'String'.
Why do I get these errors?
If I remove Option Strict
, I have no more errors. Some errors may not be fixed, so what should I do? Why use Option Strict
if these errors occur?
TxtCheckDraws.Text = TxtBoxIntDrawsCount.Text - 1
TxtCheckList.Text = TxtBoxIntDrawsCount.Text - 1
Code:
Private Sub BttImport_Click(sender As Object, e As EventArgs) Handles BttImport.Click
TxtBoxIntDraws.Clear()
TxtBoxIntDraws.Text = System.IO.File.ReadAllText(My.Application.Info.DirectoryPath + ("\itemInfo.txt"))
Dim sr As New IO.StreamReader(My.Application.Info.DirectoryPath + ("\itemInfo.txt"))
Dim strLines() As String = Strings.Split(sr.ReadToEnd, Environment.NewLine)
TxtBoxIntDrawsCount.Text = strLines.Length
sr.Close()
TxtCheckDraws.Text = TxtBoxIntDrawsCount.Text - 1
TxtCheckList.Text = TxtBoxIntDrawsCount.Text - 1
TxtBoxIntDraws.Text = String.Join(Environment.NewLine, TxtBoxIntDraws.Lines.Select(Function(l) String.Join(",", l.Split(",").Select(Function(s) Integer.Parse(s)))))
End Sub