33 lines
1.1 KiB
VB.net
33 lines
1.1 KiB
VB.net
|
|
Public Class link_frm
|
|||
|
|
Public filename As String =""
|
|||
|
|
Public filepath As String =""
|
|||
|
|
|
|||
|
|
Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
|
|||
|
|
If String.IsNullOrEmpty (TextBox1.Text) Then
|
|||
|
|
TextBox1.Text=filename
|
|||
|
|
Else
|
|||
|
|
|
|||
|
|
End If
|
|||
|
|
Me.DialogResult = System.Windows.Forms.DialogResult.OK
|
|||
|
|
End Sub
|
|||
|
|
|
|||
|
|
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
|
|||
|
|
Using openFileDialog As New OpenFileDialog
|
|||
|
|
Dim tmpInitDir As String = Application .StartupPath
|
|||
|
|
openFileDialog.InitialDirectory = tmpInitDir
|
|||
|
|
openFileDialog.RestoreDirectory = True
|
|||
|
|
openFileDialog.Title = "打开文件"
|
|||
|
|
'openFileDialog.Filter = $"配置文件(*.xml)|*.xml"
|
|||
|
|
|
|||
|
|
|
|||
|
|
If openFileDialog.ShowDialog() = DialogResult.OK Then
|
|||
|
|
filename=openFileDialog.SafeFileName
|
|||
|
|
filepath=openFileDialog.FileName
|
|||
|
|
TextBox2.Text =filepath
|
|||
|
|
End If
|
|||
|
|
End Using
|
|||
|
|
|
|||
|
|
End Sub
|
|||
|
|
|
|||
|
|
|
|||
|
|
End Class
|