Click here to Skip to main content
15,891,248 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
http://i1065.photobucket.com/albums/u394/Izaz_Ahmed/Capture_zpsmotjpbwe.jpg[^]

In the above URL you find a image where you can see 2 radio buttons where i can select default destination or select destination, But i dont know how to implement them in code. What i want is, when i select the Default Destination radio button and click the GENERATE HL7 Message button the file should be save in the Default destination and when i have to selected the Select Destination radio button then it should be alble to browse and select the folder and when i click the GENERATE HL7 Message button it should be save in the selected destination. I dont know how to do so. right now when i press the GENERATE HL7 Message it automatically saves in the given path in the code, you can check that in code.



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
Posted
Comments
Thava Rajan 3-Jun-15 3:02am    
what do you mean by default destination
Shaik Izaz 3-Jun-15 3:21am    
i mean i have defined the destination in the code as "C:\psave\New folder\"

Hi,
I don't understand your Problem at the Moment.
You could do the following :

- If your RadioButton1 is checked you set a Variable (for example 'WorkingPath') to the Value entered in TextBox1. The same with RadioButton2. For this you could for example work with the Event 'CheckedStateChanged' from the controls.

- Another possibility could be, that you ask for the RadioButton1.Checked-State inside the displayed Script.
 
Share this answer
 
v2
Dear Friend,

You can set the default path on the first radio button click event in a variable and then pass the same variable on the click of the GENERATE HL7 Message button so that the image is saved to the default path and when you click on the second radio button which is the "Select Destination" in your case; you can save the destination path in a variable and then pass the same va riable on the click of the GENERATE HL7 Message button so that the image is saved to the selected destination path folder.

Please select this as your answer if it helps you out in your problem.

Regards

Varun
 
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