私はこの機能を持っています:
Function WriteTextToFile(ByVal data)
Dim file As New System.IO.StreamWriter("E:\storage.txt")
file.WriteLine(data)
file.Close()
End Function
複数のストレージファイルを許可するためにファイルパスを渡すことができる変数になるように調整しようとしています。このようなもの:
Function AppendTextToFile(ByVal data, ByVal path)
Dim file As New System.IO.StreamWriter(path, True)
file.WriteLine(data)
file.Close()
End Function
ただし、関数1は機能しますが、関数2は機能しません-この役に立たないエラーが発生します。
Overload resolution failed because no accessible 'New' can be called without a narrowing conversion:
'Public Sub New(path As String)': Argument matching parameter 'path' narrows from 'Object' to 'String'.
'Public Sub New(stream As System.IO.Stream)': Argument matching parameter 'stream' narrows from 'Object' to 'System.IO.Stream'. C:\Users\films ratings\films ratings\Form1.vb
私は通常PHPで作業していますが、この種のエラーはこれまで見たことがありません。それはどういう意味ですか?関数を書き直して必要なものを取得できますか?