You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
ITAgnesmeyer edited this page Feb 22, 2019
·
1 revision
OpenFileDialog
With the object OpenFileDialog a file dialog can be opened.
privatevoidFileOpen_Click(objectsender,MouseClickEventArgse){OpenFileDialogofd=newOpenFileDialog();//Title of the Dialogofd.Title="Open a Text File...";//All Values have to be separated with \0 ofd.Filter="All File(*.*)\0*.*\0Text(*.txt)\0*.txt\0";//Shows Text(*.txt) as defaultofd.DefaultFilterIndex=2;//Show the Dialog modal to the current Form.if(ofd.Show(this)){//Read the selected PathstringfileName=ofd.File;//File Actions.stringtext=File.ReadAllText(fileName);this._TextBox.Text=text;this.Text="Little Edit:"+fileName;}}