Click here to Skip to main content
15,899,679 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have already defined destination folder to save the file, and i want to select my choice of destination folder also?. i dont know how to do it.[/b]

Here is my code:


Private Sub BtnBrowse_Click(sender As Object, e As EventArgs) Handles BtnBrowse.Click
        Fbd.ShowDialog()
        TxtPath.Text = Fbd.SelectedPath
    End Sub

Private Sub HL_Click(sender As Object, e As EventArgs) Handles HL.Click
        If vld(TxtProcode) = False Then
            Exit Sub
        End If
        Dim file As System.IO.StreamWriter
        Dim fileDateTime As String = DateTime.Now.ToString("yyyyMMdd") & DateTime.Now.ToString("HHmmss") & ".HL7"
        Dim ts As String = DateTime.Now.ToString("yyyyMMdd") & DateTime.Now.ToString("HHmmss")
        file = My.Computer.FileSystem.OpenTextFileWriter("C:\psave\New folder\" & fileDateTime, True)
        TxtDob.Format = DateTimePickerFormat.Custom
        TxtDob.CustomFormat = "yyyyMMdd"
        TxtExamtime.Format = DateTimePickerFormat.Custom
        TxtExamtime.CustomFormat = "hhMMss"
        TxtExamdate.Format = DateTimePickerFormat.Custom
        TxtExamdate.CustomFormat = "yyyyMMdd"
        file.WriteLine("MSH|^~\&|||||" & TxtExamdate.Text & "" & TxtExamtime.Text & "||ORM^O01||P|2.3.1")
        file.WriteLine("PID|||" & TxtId.Text & "||" & TxtFamilyname.Text & "^" & TxtGivenname.Text & "||" & TxtDob.Text & "||" & TxtGender.Text & "|||" & TxtStreet.Text & " " & TxtHouse.Text & "^^/>" & TxtCity.Text & "^^/>" & TxtPostcode.Text)
        file.WriteLine("PV1||O|||||||||||||||||" & TxtId.Text & "|||||||||||||||||||||||||" & ts)
        file.WriteLine("ORC|NW|" & ts & "|||||^^/>^S||" & TxtExamdate.Text)
        file.WriteLine("OBR||" & ts & "^" & ts & "||" & TxtProcode.Text & "|||" & TxtExamdate.Text & "" & TxtExamtime.Text & "|" & TxtExamdate.Text & "" & TxtExamtime.Text)
        file.WriteLine()
        file.Close()
        MessageBox.Show("HL7 Message Saved to " & fileDateTime, "HL7")
        TxtDob.Format = DateTimePickerFormat.Short
        TxtExamtime.CustomFormat = "hh:MM tt"
        TxtExamdate.CustomFormat = "dd-MMM-yy"
    End Sub
End Class
Posted
Updated 2-Jun-15 3:02am
v2
Comments
[no name] 2-Jun-15 8:45am    
What "filebrowsedialog"?
Shaik Izaz 2-Jun-15 9:01am    
Oops! its actualyy FolderBrowserdialog
[no name] 2-Jun-15 9:11am    
There is an example of how to use that class in the documentation. So, what is the question exactly?

1 solution

Please, see: FolderBrowserDialog Class[^] - on the bottom of page you'll find an example.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900