ma tu passi al command il nome del file??
forse devo fare il contrario.......
metti che il tuo programma si chiami notepad2.exe, e supponi di eseguirlo da un finestra di dos.
Così non funziona:
notepad2.exe
Così funziona:
notepad2.exe C:\tuofile.txt
ok..ma cosa c'è da mettere a posto nel codice di sopra?
hai provato a compilare e vedere se funziona?
codice:Private Sub Form_Load() Command$ = Filename If Filename <> "" Then F = FreeFile Open Filename For Input As F ' Open the file selected in the File Open About dialog box. frmEditor!txtEdit.Text = Input(LOF(F), F) Close F ' Close the file. ' frmEditor.mnuFileItem(3).Enabled = True ' Enable the Close command on the File menu. UpdateMenu frmEditor.Caption = "CodeWorld Editor - 1.0 : " + Filename Unload Me End If End Sub
ho fatto così...e mi dice che la chiamata di funzione deve restituire o variant o object...
non ne vengo a capo..............![]()
sono arrivato a questo punto:
codice:Filename = Command$ If Filename <> "" Then OpenFile (Filename) 'frmEditor.Show 'frmEditor!txtEdit.Text = Input frmEditor.Caption = "CodeWorld Editor - 1.0 : " + Filename frmEditor.Show Unload Me End If
funziona perchè mi prende il nome del file...nel Caption
ma come faccio a prendere il testo contenuto nel file che apro e a metterlo nella mia rich text box?
nono riesco...
ma cos'è OpenFile???
Una funzione? un Sub?
Mostra il codice.
codice:Private Sub Form_Load() Label1.Caption = Environ$("USERNAME") Filename = Command$ If Filename <> "" Then OpenFile (Filename) frmEditor.Caption = "CodeWorld Editor - 1.0 : " + Filename frmEditor.Show Unload Me End If End Sub