Click here to Skip to main content
15,900,687 members
Home / Discussions / C#
   

C#

 
GeneralRe: Loading a form in another form like win explorer Pin
Arun Bhalla17-Mar-03 18:16
Arun Bhalla17-Mar-03 18:16 
GeneralRe: Loading a form in another form like win explorer Pin
foxms13-Apr-03 4:29
foxms13-Apr-03 4:29 
GeneralRe: Loading a form in another form like win explorer Pin
LongRange.Shooter11-Mar-03 8:55
LongRange.Shooter11-Mar-03 8:55 
GeneralRe: Loading a form in another form like win explorer Pin
John'o12-Mar-03 12:09
John'o12-Mar-03 12:09 
GeneralRe: Loading a form in another form like win explorer Pin
LongRange.Shooter13-Mar-03 4:36
LongRange.Shooter13-Mar-03 4:36 
GeneralRe: Loading a form in another form like win explorer Pin
John'o24-Mar-03 20:11
John'o24-Mar-03 20:11 
GeneralRe: Loading a form in another form like win explorer Pin
LongRange.Shooter28-Mar-03 2:49
LongRange.Shooter28-Mar-03 2:49 
Generalpopulating an input of file type textbox Pin
CucumberPickles10-Mar-03 12:24
CucumberPickles10-Mar-03 12:24 
GeneralRe: populating an input of file type textbox Pin
James T. Johnson10-Mar-03 17:59
James T. Johnson10-Mar-03 17:59 
GeneralA simple Form OK button question Pin
DionChen10-Mar-03 11:36
DionChen10-Mar-03 11:36 
GeneralRe: A simple Form OK button question Pin
Gogou10-Mar-03 12:02
Gogou10-Mar-03 12:02 
GeneralRe: A simple Form OK button question Pin
DionChen10-Mar-03 16:48
DionChen10-Mar-03 16:48 
GeneralRe: A simple Form OK button question Pin
James T. Johnson10-Mar-03 18:07
James T. Johnson10-Mar-03 18:07 
GeneralRe: A simple Form OK button question Pin
Zek3vil11-Mar-03 7:01
Zek3vil11-Mar-03 7:01 
GeneralRe: A simple Form OK button question Pin
LongRange.Shooter11-Mar-03 7:33
LongRange.Shooter11-Mar-03 7:33 
QuestionBackground color on a TreeView checkbox? Pin
se99ts10-Mar-03 10:35
se99ts10-Mar-03 10:35 
QuestionDataSet bind to datagrid, how to flush or reject changes on Form.Closing ? Pin
Chris Richner10-Mar-03 10:25
Chris Richner10-Mar-03 10:25 
AnswerRe: DataSet bind to datagrid, how to flush or reject changes on Form.Closing ? Pin
leppie10-Mar-03 10:39
leppie10-Mar-03 10:39 
Override on closing rather Wink | ;)

This what I did (in fact just yesterday):
<font  size=2 face="Courier New"><font color="#0000FF">protected </font><font color="#000000">override </font><font color="#0000FF">void </font><font color="#000000">OnClosing</font>(<font color="#000000">CancelEventArgs e</font>)
{
   <font color="#000000">DataSet ds </font>= <font color="#000000">dataSet1</font>.<font color="#000000">GetChanges</font>();

   <font color="#0000FF">if </font>(<font color="#000000">ds </font>!= <font color="#000000">null</font>)
   {
      <font color="#000000">DialogResult result </font>= <font color="#000000">MessageBox</font>.<font color="#000000">Show</font>(<font color="#0000FF">this</font>, 
<font color="#FFFFFF">	</font><font color="#FF8000">"Would you like to save " </font>+ <font color="#000000">datafile </font>+ <font color="#FF8000">" ?"</font>, <font color="#FF8000">"Confirm save file..."</font>,
         <font color="#000000">MessageBoxButtons</font>.<font color="#000000">YesNoCancel</font>, <font color="#000000">MessageBoxIcon</font>.<font color="#000000">Question</font>);

      <font color="#0000FF">switch </font>(<font color="#000000">result</font>)
      {
         <font color="#0000FF">case </font><font color="#000000">DialogResult</font>.<font color="#000000">Yes</font>:
            <font color="#000000">SaveXml</font>(<font color="#000000">datafile</font>);
            <font color="#0000FF">break</font>;
         <font color="#0000FF">case </font><font color="#000000">DialogResult</font>.<font color="#000000">No</font>:
            <font color="#0000FF">break</font>;
         <font color="#0000FF">case </font><font color="#000000">DialogResult</font>.<font color="#000000">Cancel</font>:
            <font color="#000000">e</font>.<font color="#000000">Cancel </font>= <font color="#0000FF">true</font>;
            <font color="#0000FF">break</font>;
      }
   }
   <font color="#000000">base</font>.<font color="#000000">OnClosing</font>(<font color="#000000">e</font>);
}
</font>
SaveXml() is just a method I have to save the XML and datafile is a string that is the file's full path and name.

Hope this helps Smile | :)

[edit] I just realize its almost the same, except perhaps that you are using the event rather than overriding, and that you call GetChanges(). Never did try that Poke tongue | ;-P How do you persist (load/save) the dataset anyways? Are you not calling AcceptChanges somewher in between, that would cause it to return false more than often. I call AcceptChanges only one after I have read the XML from a file.[/edit]

I rated this article 2 by mistake. It deserves more. I wanted to get to the second page... - vjedlicka 3:33 25 Nov '02
GeneralRe: DataSet bind to datagrid, how to flush or reject changes on Form.Closing ? Pin
Chris Richner10-Mar-03 22:48
Chris Richner10-Mar-03 22:48 
GeneralRe: DataSet bind to datagrid, how to flush or reject changes on Form.Closing ? Pin
ed2d11-Mar-03 21:25
ed2d11-Mar-03 21:25 
GeneralRe: DataSet bind to datagrid, how to flush or reject changes on Form.Closing ? Pin
Chris Richner12-Mar-03 5:08
Chris Richner12-Mar-03 5:08 
QuestionGet xpath of current Node? Pin
Bog10-Mar-03 10:00
Bog10-Mar-03 10:00 
AnswerRe: Get xpath of current Node? Pin
Christian Graus10-Mar-03 10:08
protectorChristian Graus10-Mar-03 10:08 
GeneralDrawing my own tab... Pin
Gogou10-Mar-03 9:35
Gogou10-Mar-03 9:35 
GeneralRe: Drawing my own tab... Pin
leppie10-Mar-03 9:50
leppie10-Mar-03 9:50 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.