Michael Maddison
michael at ddisolutions.com.au
Thu Dec 29 18:38:47 CST 2011
Hi Arthur, Doesn't get much more newbie than this ;-) In the old VB world I assume that like me we all had a dialog class that we reused from project to project. That class would have included various win32 api calls. The dotnet framework libraries are huge and it will take time to suss out where the objects you need are. MSDN and help are pretty good these days, I recommend browsing the contents and reading what seems interesting or useful. VS2010 comes with a number of standard dialogs in the toolbox by default, color, browser, font, open and save. You have 2 options. Drag the control onto a form or declare an instance in your code. Drag onto form and set properties in the property window. Call the openFileDialog1.ShowDialog ( ) method and you are in business. If you declare an instance in your code you just need to make sure you ref 'using System.Windows.Forms;' Then create the dialog using ' private OpenFileDialog dlg = new OpenFileDialog ( );' or however you want to create and scope the object. HTH Michael M Subject: [dba-VB] C# Newbie Question I've got a simple little RichTextEditor program working in C#, thanks to a book I'm working through. But the code I have makes a simple assumption, a hard-coded filename to load and read back. That works ok, as do all the buttons (Bold, etc.), but I want to move this up a notch and call the FileSave and FileOpen stuff rather than use the hard-coded filename. Can anyone help me do this? I want the Open button to invoke the standard dialog and the Save button to invoke the standard FileSaveAs dialog. I'm guessing this can be done in a line or two, and I know how to do it from Access, but I don't have any idea how to do it from C#. Any advice most gratefully appreciated. Thanks and to one and all, Happy New Year! You can deduce how exciting is my life, by the fact that I'm doing this as opposed to roasting chestnuts on a fire with a lovely loved one :) -- Arthur Cell: 647.710.1314 Prediction is difficult, especially of the future. _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com ----- No virus found in this message. Checked by AVG - www.avg.com Version: 10.0.1416 / Virus Database: 2109/4110 - Release Date: 12/29/11