Home Page
Articoli
Tips & Tricks
News
Forum
Archivio Forum
Blogs
Sondaggi
Rss
Video
Utenti
Chi Siamo
Contattaci
Username:
Password:
Login
Registrati ora!
Recupera Password
Home Page
Stanze Forum
App. WinForms / WPF .NET
Lettura file
giovedì 02 marzo 2006 - 18.23
Elenco Threads
Stanze Forum
Aggiungi ai Preferiti
Cerca nel forum
attilio
Profilo
| Junior Member
115
messaggi | Data Invio:
gio 2 mar 2006 - 18:23
Ciao a tutti avrei bisogno di leggere il contenuto di un file ,che non ha estensione ma che è leggibile come txt file...,copiarlo(il contenuto) e creare una'altro file con il testo che ho copiato dal primo.Sapete darmi qualche indicazione sulla strada da seguire?
Grazie
trinity
Profilo
| Guru
3.465
messaggi | Data Invio:
gio 2 mar 2006 - 18:34
Utilizza la classe System.IO
Ciao
Cirillo Fabio
www.wondernet.biz
fabio@wondernet.biz
http://blogs.dotnethell.it/fabiocirillo/
attilio
Profilo
| Junior Member
115
messaggi | Data Invio:
gio 2 mar 2006 - 20:57
Ho provato guardando msdn a utilizzare un codice tipo questo
protected void ButtonOpen_Click_Click(object sender, System.EventArgs e)
{
String editingFileName = "";
Boolean saveAllowed = true;
// Displays the OpenFileDialog.
if (openFileDialog1.ShowDialog() == DialogResult.OK)
{
// Opens the file stream for the file selected by the user.
using (System.IO.Stream userStream = openFileDialog1.OpenFile())
{
this.RtfBoxMain.LoadFile(userStream,
RichTextBoxStreamType.PlainText);
userStream.Close();
}
// Attempts to get the file name selected by the user.
// Failure means that the application does not have
// unrestricted permission to the file.
try
{
editingFileName = openFileDialog1.FileName;
}
catch (Exception ex)
{
if (ex is System.Security.SecurityException)
{
// The application does not have unrestricted permission
// to the file so the save feature will be disabled.
saveAllowed = false;
}
else
{
throw ex;
}
}
}
}
ma openFileDialog1 mi da errore e non viene accettato.
Mi sapete dire perchè?
Torna su
Stanze Forum
Elenco Threads
Partecipa anche tu! Registrati!
Hai bisogno di aiuto ?
Perchè non ti registri subito?
Dopo esserti registrato potrai chiedere
aiuto sul nostro
Forum
oppure aiutare gli altri
Consulta le
Stanze
disponibili.
Registrati ora !