home *** CD-ROM | disk | FTP | other *** search
/ PC World Komputer 1997 May / Pcwk0597.iso / borland / cb / setup / cbuilder / data.z / FFACTWIN.CPP < prev    next >
C/C++ Source or Header  |  1997-02-28  |  2KB  |  50 lines

  1. //----------------------------------------------------------------------------
  2. //Borland C++Builder
  3. //Copyright (c) 1987, 1997 Borland International Inc. All Rights Reserved.
  4. //----------------------------------------------------------------------------
  5. //---------------------------------------------------------------------------
  6. #include <vcl.h>
  7. #pragma hdrstop
  8.  
  9. #include "FFactWin.h"
  10. //---------------------------------------------------------------------------
  11. #pragma resource "*.dfm"
  12. TForm1 *Form1;
  13. //---------------------------------------------------------------------------
  14. __fastcall TForm1::TForm1(TComponent* Owner)
  15.   : TForm(Owner)
  16. {
  17. }
  18. //---------------------------------------------------------------------------
  19.  
  20. // This application shows how to display Paradox style memo and graphic
  21. // fields in a form. Table1's DatabaseName property should point to the
  22. // Borland sample database. Table1's TableName property should be set to 
  23. // the BIOLIFE table.
  24. //
  25.  
  26. void __fastcall TForm1::SaveClick(TObject *Sender)
  27. {
  28.     FILE *outfile;
  29.     char buff[100];
  30.  
  31.     sprintf(buff, "Save Info For: %s", DBLabel1->Field->AsString.c_str());
  32.     SaveDialog1->Title = buff;
  33.  
  34.     if (SaveDialog1->Execute())
  35.     {
  36.         outfile = fopen(SaveDialog1->FileName.c_str(), "wt");
  37.         if (outfile)
  38.         {
  39.             fprintf(outfile, "Facts on the %s\n\n", (LPSTR)DBLabel1->Field->AsString.c_str());
  40.             for (int i=0; i < DBGrid1->FieldCount; i++)
  41.                  fprintf(outfile, "%s: %s\n",
  42.                     (LPSTR)DBGrid1->Fields[i]->FieldName.c_str(),
  43.                     (LPSTR)DBGrid1->Fields[i]->AsString.c_str());
  44.             fprintf(outfile, "\n%s\n", (LPSTR)DBMemo1->Text.c_str());
  45.         }
  46.         fclose(outfile);
  47.     }
  48. }
  49. //---------------------------------------------------------------------
  50.