Welcome To The Home Of The Visual FoxPro Experts  
home. signup. forum. archives. search. google. articles. downloads. faq. members. weblogs. file info. rss.
 From: Pete Sass
  Where is Pete Sass?
 Marathon, Ontario
 Canada
 Pete Sass
 To: Cyril Baskir
  Where is Cyril Baskir?
 
 Australia
 Cyril Baskir
 Tags
Subject: RE: C# program: change date in settings file
Thread ID: 395805 Message ID: 395858 # Views: 41 # Ratings: 0
Version: Visual FoxPro 9 SP2 Category: General VFP Topics
Date: Monday, January 20, 2014 7:36:05 PM         
   


> I have an exe program written in C# (with source code). It stores some defaults (e.g. dates) in a settings file xrep.xst. I want to change the dates in this file using FoxPro.
>
> The author doesn't know FoxPro, but when I asked him how to do it he said:
>
> You can open file
XeroValueObject.cs

> You can define in your program as
XeroValueObject.cs
file.
>
> Does anyone know what this means in FoxPro?
>
> I opened the file he mentioned in notepad. This is what it contains (FromDate and ToDate are at the end):
>
>
>
using System;
> using System.Collections.Generic;
> using System.Linq;
> using System.Text;
> 
> namespace XeroApi.SystemOne
> {
>     [Serializable()]
>     public class XeroValueObject
>     {
>         public string UserAgent { get; private set; }
>         public string ConsumerKey { get; set; }
>         public string ConsumerSecret { get; set; }
>         public string OutputFolder { get; set; }
>         public string Delimeter { get; set; }
>         public DateTime FromDate { get; set; }
>         public DateTime ToDate { get; set; }
>     }
> }

>
>
>
>
> He has a settings button on his form, where I can change the dates. But I want to prefill the dates from VFP.
> Looking thru the code, this is where he saves the settings:
>
>
>
      private void SaveSettings(XeroValueObject xvo, string strFilename)
>         {
>             if (xvo == null) return;
>             try
>             {
>                 Stream s = File.Open(strFilename, FileMode.OpenOrCreate);
>                 BinaryFormatter b = new BinaryFormatter();
>                 b.Serialize(s, xvo);
>                 s.Close();
>                 MessageBox.Show("The Setting file has been saved successfully.", "Message");
>             }
>             catch (Exception)
>             {
>                 MessageBox.Show("Error in saving File.", "Error");
>             }
>         }
> 

>
>
> I dont know C#, but there are clever people here who do :)
>
> Can you give me some ideas as to how I can write my own dates to the settings file (or at least tell me what questions to ask)?
>
> BTW the settings file xrep.xst, when opened in notepad, is a binary file of some kind (I guess that's what the Serialize does).
> I can recognize some of the words in the file, but the dates are not in readable format.
>
>
> Cyril


Hi Cyril,

I am not 100% sure if you are talking about dates that are part of a system setup default setting
versus
dates that could change each time say a report is run.

If the dates are more along the lines of system configuration settings like:
- Start and ending date range in an accounting systems fiscal year period.
- Such system things such as tax codes and tax rates.
- etc.
I generally store these kinds of things in a table in my SQL Server backend and read from the table
when my Home web page is first loaded.

Maybe I misunderstand the intent of what is going on in your case but anything that is non-static I store
in a table and stay clear of settings in files.

If you compare this back to VFP, one could ask the question do I store 12 system configuration settings
in a table or in a text .ini file? I go with the table storage method for true dynamic settings that
may need to be changed from time to time.

Pete "the IceMan", from the Great White North of Canada.
www.marathongriffincomputers.com

ENTIRE THREAD

C# program: change date in settings file Posted by Cyril Baskir @ 1/20/2014 6:18:15 AM
RE: C# program: change date in settings file Posted by David Mustakim @ 1/20/2014 7:33:47 AM
RE: C# program: change date in settings file Posted by Stefan Wuebbe @ 1/20/2014 11:09:49 AM
RE: C# program: change date in settings file Posted by Pete Sass @ 1/20/2014 7:36:05 PM
RE: C# program: change date in settings file Posted by Cyril Baskir @ 1/20/2014 11:05:57 PM
RE: C# program: change date in settings file Posted by Tom Saddul @ 1/21/2014 5:18:28 AM