none
如何使用 VB SaveFileDialog 來儲存檔案 RRS feed

解答


  • 程式碼區塊

     

    Private Sub button1_Click(sender As Object, e As System.EventArgs)
    Dim myStream As Stream
    Dim saveFileDialog1 As New SaveFileDialog()

    saveFileDialog1.Filter = "txt files (*.txt)|*.txt|All files (*.*)|*.*"
    saveFileDialog1.FilterIndex = 2
    saveFileDialog1.RestoreDirectory = True

    If saveFileDialog1.ShowDialog() = DialogResult.OK Then
    myStream = saveFileDialog1.OpenFile()
    If Not (myStream Is Nothing) Then
    ' Code to write the stream goes here.
    myStream.Close()
    End If
    End If
    End Sub


    2007年12月29日 下午 03:38

所有回覆


  • 程式碼區塊

     

    Private Sub button1_Click(sender As Object, e As System.EventArgs)
    Dim myStream As Stream
    Dim saveFileDialog1 As New SaveFileDialog()

    saveFileDialog1.Filter = "txt files (*.txt)|*.txt|All files (*.*)|*.*"
    saveFileDialog1.FilterIndex = 2
    saveFileDialog1.RestoreDirectory = True

    If saveFileDialog1.ShowDialog() = DialogResult.OK Then
    myStream = saveFileDialog1.OpenFile()
    If Not (myStream Is Nothing) Then
    ' Code to write the stream goes here.
    myStream.Close()
    End If
    End If
    End Sub


    2007年12月29日 下午 03:38
  • 先列出你目前的程式碼,才知道你從哪裡開始不會做。

     

    2007年12月30日 上午 06:20
    版主