有关vb.net 调用dll
Imports Public Class TXTClass1
Private SW As StreamWriter
Public Sub New()
End Sub
'写入追加的形式写入一行
Public Sub ZhuiJiaSingle(ByVal Parth As String, ByVal strline As String)
SW = New StreamWriter(Parth, True, System.Text.Encoding.Default)
SW.WriteLine(strline)
SW.Flush()
SW.Close()
SW = Nothing
End Sub
以上是dll内容,以下是调用总报错!请高手指教。谢谢!
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Dim bool As Boolean = False
bool = ZhuiJiaSingle(Application.StartupPath & "\Wenben1.txt", TextBox1.Text)
If bool Then
MessageBox.Show("数据已写入")
Else
MessageBox.Show("写入数据时出错")
End If
End Sub