'Canned' data in VB program 
Author Message
 'Canned' data in VB program

In other languages, they allow the ability to put
'canned' data into the source code.

I am trying to create an internal table of records, where
each record has 4 fields.  I do not want to read the data
from an external data file, and do not want to perform a
SET command for each field of every record (200+ records).

The only way I see this being done is to create an object
module in C, and link it into the .EXE file.  Does anyone
have any suggestions on how to perform either of these?



Sun, 19 Apr 1998 03:00:00 GMT  
 'Canned' data in VB program

Quote:

>In other languages, they allow the ability to put
>'canned' data into the source code.

>I am trying to create an internal table of records, where
>each record has 4 fields.  I do not want to read the data
>from an external data file, and do not want to perform a
>SET command for each field of every record (200+ records).

>The only way I see this being done is to create an object
>module in C, and link it into the .EXE file.  Does anyone
>have any suggestions on how to perform either of these?

The solution I came up with for this problem was to write a program
which wrote the .BAS module which initialised all the variables. The
input to the program was, for your example, 200+ lines of 4 fields
such as:
5,Visual Widgets,3.79,T
The output was up to 800+ lines of the form
my_record[0].Stock_Code = 5
my_record[0].Description = "Visual Widgets"
my_record[0].Price = 3.79
my_record[0].Stock_Item = True
I inititialized all the fields to the most common values so that the
generating program did not have to output them. This saved space
rather than time.

I cannot claim this method has much merit and I would be pleased to
read of a better one. On the other hand it does work and it allows you
to inititialize global data. I do not see how you could do that in a C
module without copying the data.


Profectus Pty Ltd                 Compuserve: 100241,1211
25 Myrtle Road                    Telephone: +61 3 9830 5026
Canterbury, VIC, 3126 AUSTRALIA         Fax: +61 3 9830 0959



Wed, 22 Apr 1998 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. 'Remote Control'-like feature for a single VB program

2. VB 'Mirror' Program

3. VB, Excel, Unicode, data changing to '???'

4. problem of converting C's union type to VB's a data type

5. problem of converting C's union type to VB's a data type

6. using excel data in vb's visual data manager

7. **************!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!Help me !!!!!!!!!!!!!!!!!!!!!!!!'''''''''''''''''''''''*************

8. Calling 'C' functions in a standard 'C' program from VB

9. Corollary to the 'Great BASIC program'

10. ending a program with 'x'

11. 'Help-Find'-style interface for vb4 programmed database search

12. ending a program with 'x'

 

 
Powered by phpBB® Forum Software