Follow along with the video below to see how to install our site as a web app on your home screen.
Anmerkung: This feature currently requires accessing the site using the built-in Safari browser.
protected void button1_Click(object sender, System.EventArgs e)
{
Stream myStream;
OpenFileDialog openFileDialog1 = new OpenFileDialog();
openFileDialog1.InitialDirectory = "c:\\" ;
openFileDialog1.Filter = "txt files (*.txt)|*.txt|All files (*.*)|*.*" ;
openFileDialog1.FilterIndex = 2 ;
openFileDialog1.RestoreDirectory = true ;
if(openFileDialog1.ShowDialog() == DialogResult.OK)
{
if((myStream = openFileDialog1.OpenFile())!= null)
{
// Insert code to read the stream here.
myStream.Close();
}
}
}
protected void button1_Click(object sender, System.EventArgs e)
{
Stream myStream;
OpenFileDialog openFileDialog1 = new OpenFileDialog();
openFileDialog1.InitialDirectory = "c:\\" ;
openFileDialog1.Filter = "txt files (*.txt)|*.txt|All files (*.*)|*.*" ;
openFileDialog1.FilterIndex = 2 ;
openFileDialog1.RestoreDirectory = true ;
if(openFileDialog1.ShowDialog() == DialogResult.OK)
{
if((myStream = openFileDialog1.OpenFile())!= null)
{
// Insert code to read the stream here.
myStream.Close();
}
}
}
Hört sich aber ganz anders an alsaxelfxxx hat gesagt.:Ich brächte einfach eine funktion, wo ich per openFileDialog eine beliebige Datei im Editor öffnen kann.
Der Editor öffnet sich schon aber nicht Datei die ich auswähle. Wie sage ich ihm dass er die Datei lesen soll?
axelfxxx hat gesagt.:[...]eine Datei öffen, z.b. txt-datei. Das habe ich geschafft!. So nun möchte ich diese Datei, das hatte ich vorher vergessen zu schreiben, im selben Formular anzeigen lassen.
RrichTextBox rtbPrview;
if(openFileDialog1.ShowDialog() == DialogResult.OK){
rtbPreview.LoadFile( openFileDialog1.FileName );
}
System.Diagnistics.Process.Start( openFileDialog1.FileName );
thx an alle,cosmochaosmaker hat gesagt.:Hört sich aber ganz anders an als
- EigenerEditor:
Code:RrichTextBox rtbPrview; if(openFileDialog1.ShowDialog() == DialogResult.OK){ rtbPreview.LoadFile( openFileDialog1.FileName ); }
- MS Editor:
MfG,cosmoCode:System.Diagnistics.Process.Start( openFileDialog1.FileName );