我有一个需要在vb.net上运行的vb6代码
Dim strFileName As String
Dim strText As String
Dim strFilter As String
Dim strBuffer As String
Dim FileHandle%
strFilter = "Comma Seperated File (*.csv)|*.csv"
CDMAIN.Filter = strFilter
CDMAIN.ShowSave
If CDMAIN.FileName <> "" Then
strFileName = CDMAIN.FileName
strText = Text1.Text
FileHandle% = FreeFile
'''''''''''''''''''''''''''''''''''''''''''''''''''''''
Open strFileName For Output As #FileHandle%
MousePointer = vbHourglass
Print #FileHandle%, strText
MousePointer = vbDefault
Close #FileHandle%
End If
该功能将数据保存到excel文件
答案 0 :(得分:0)
Open strFileName For Output As #FileHandle%
MousePointer = vbHourglass
Print #FileHandle%, strText
MousePointer = vbDefault
Close #FileHandle%
转换为VB.NET代码:
Me.Cursor = Cursors.WaitCursor
Using fs As New StreamWriter(strFileName, False)
fs.WriteLine(strText)
End Using
Me.Cursor = Cursors.Default