如何设置默认目标并在Vb.Net中选择目标路径 [英] How To Set Default Destination And Select Destination Paths In Vb.Net

查看:157
本文介绍了如何设置默认目标并在Vb.Net中选择目标路径的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

http://i1065.photobucket.com/专辑/ u394 / Izaz_Ahmed / Capture_zpsmotjpbwe.jpg [ ^ ]



在上面的URL中,您可以找到一个图像,您可以在其中看到2个单选按钮,我可以在其中选择默认目的地或选择目的地,但我不知道如何在代码中实现它们。我想要的是,当我选择默认目标单选按钮并单击生成HL7消息按钮时,该文件应保存在默认目标中,当我必须选择选择目标单选按钮时,它应该可以浏览并选择文件夹,当我点击 GENERATE HL7消息按钮时,它应该保存在所选目的地。我不知道该怎么做。现在,当我按下GENERATE HL7消息时,它会自动保存在代码中的给定路径中,你可以在代码中检查它。







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

推荐答案



我现在还不明白你的问题。

您可以执行以下操作:



- 如果选中了RadioButton1,则将变量(例如WorkingPath)设置为TextBox1中输入的值。与RadioButton2相同。为此,您可以使用控件中的事件'CheckedStateChanged'。



- 另一种可能是,你要求内部的RadioButton1.Checked-State显示的脚本。
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.


亲爱的朋友,



您可以在变量中的第一个单选按钮单击事件上设置默认路径然后单击 GENERATE HL7消息按钮传递相同的变量,以便将图像保存到默认路径,然后单击第二个单选按钮,即选择目标案件;您可以将目标路径保存在变量中,然后在单击 GENERATE HL7消息按钮时传递相同的变量,以便将图像保存到选定的目标路径文件夹。



请选择此作为您的答案,如果它可以帮助您解决问题。



问候



瓦伦
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


这篇关于如何设置默认目标并在Vb.Net中选择目标路径的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆