如何在我的保存按钮代码中添加txt过滤器

时间:2017-05-26 23:21:54

标签: vb.net

我正在开发一个从网上抓取照片的应用程序。我有保存按钮工作。但是,当我尝试保存时,我需要在名称之后输入名称和缩写,例如name.txt 如何将过滤器添加到我的保存代码中?

这是我的代码:

Private Sub SaveButton_Click(sender As Object, e As EventArgs) Handles SaveButton.Click
    If My.Application.CommandLineArgs IsNot Nothing AndAlso _
My.Application.CommandLineArgs.Count > 0 Then
        Dim UserFile As String = My.Application.CommandLineArgs(0)


    End If

    If SaveFD.ShowDialog() = DialogResult.OK Then
        Dim sb As New System.Text.StringBuilder()

        For Each o As Object In LstMain.Items
            sb.AppendLine(o)
        Next

        System.IO.File.WriteAllText(SaveFD.FileName, sb.ToString())
    End If

End Sub

0 个答案:

没有答案