hello! i just wanna ask on how to load an html or txt file from a certain monitoring software(specif ically commView for WiFi) to VB programming language?
TnX a lot:)
TnX a lot:)
Private Function Open_File() Dim STRTEMP As String TextBox.Text = "" On Error GoTo Cancel_Function With CommonDialog .CancelError = True .Filter = "Text (.txt)|*.txt" .InitDir = Environ$("USERPROFILE") & "\My Documents" .DialogTitle = "Open a file..." .ShowOpen On Error GoTo Error_Open_File Open .FileName For Input As #1 Do Until EOF(1) Input #1, STRTEMP TextBox.Text = TextBox.Text & STRTEMP Loop Close #1 Caption = Left(Caption, 26) & ": " & .FileName End With CMDunix2dos.Enabled = True TEXTCHANGED = False CMDsave.Enabled = True CMDsaveAs.Enabled = True MnuFile(2).Enabled = True MnuFile(3).Enabled = True Exit Function Error_Open_File: Close #1 MsgBox "There is an error opening the file" Exit Function Cancel_Function: End Function
Dim FF As Long Dim TotalFile As String CommonDialog1.ShowOpen FF = FreeFile Open CommonDialog1.FileName For Binary As #FF ' Allocate a buffer equal in size to the file ' (see LOF function) so that the Get statement ' can stuff text from the file into it. TotalFile = Space(LOF(FF)) Get #FF, , TotalFile Close #FF Text1.Text = TotalFile
Private Sub Form_Load() Dim FileIn As Integer FileIn = FreeFile On Error GoTo Error_Laden Open App.Path & "\document.txt" For Input As #FileIn Do While Not EOF(FileIn) Input #FileIn, inputdata TEXTBLOCK = TEXTBLOCK & inputdata & vbCrLf Loop Close #FileIn Text2.Text = TEXTBLOCK Exit Sub Error_Laden: Close #FileIn MsgBox ("Error loading !") End Sub
Private Sub Command1_Click() Dim Fle$, L&, Channel%, S$ Fle$ = "c:\t\test.txt" L = FileLen(Fle$) S$ = Space$(L) Channel = FreeFile Open Fle$ For Binary Access Read As #Channel Get #Channel, 1, S$ Close #Channel End Sub
Comment