注册 登录
编程论坛 VB.NET论坛

有关vb.net 调用dll

shunlai 发布于 2018-08-24 16:42, 2033 次点击
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
1 回复
#2
shunlai2018-09-02 09:22
问题已解决,谢谢大家!
1