每当想不到如何做。我就想睡觉





\^O^/
Public Function GetFileContents(ByVal FullPath As String, _ Optional ByRef ErrInfo As String = "") As String Dim strContents As String Dim objReader As StreamReader Try objReader = New StreamReader(FullPath) strContents = objReader.ReadToEnd() objReader.Close() Return strContents Catch Ex As Exception ErrInfo = Ex.Message End Try End Function Public Function SaveTextToFile(ByVal strData As String, _ ByVal FullPath As String, _ Optional ByVal ErrInfo As String = "") As Boolean Dim Contents As String Dim bAns As Boolean = False Dim objReader As StreamWriter Try objReader = New StreamWriter(FullPath) objReader.Write(strData) objReader.Close() bAns = True Catch Ex As Exception ErrInfo = Ex.Message End Try Return bAns End Function
Dim myOpenFileDialog As New OpenFileDialog 'myOpenFileDialog.Filter = "Excel Files(*.xls)|*.xlsx" Dim result = myOpenFileDialog.ShowDialog If result = 1 Then ButtonEdit1.EditValue = myOpenFileDialog.FileName If File.Exists(ButtonEdit1.EditValue) Then tHardwareID.EditValue = GetFileContents(ButtonEdit1.EditValue) End If End If
Dim myOpenFileDialog As New FolderBrowserDialog Dim result = myOpenFileDialog.ShowDialog If result = 1 Then tExportPath.EditValue = myOpenFileDialog.SelectedPath End If
At Problem Setup Project – right click “Detected Dependencies” and “Refresh Dependencies”. This works in vs.net 2010