Wrox Programmer Forums
|
VB How-To Ask your "How do I do this with VB?" questions in this forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the VB How-To section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old March 26th, 2008, 08:50 PM
Registered User
 
Join Date: Apr 2006
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi Woody,
   I don't fear that this is going to be hard. As I was telling you, I already have 3 years invested in this program. I started this project over 10 years ago using "Basic", later I re-wrote the program using "Q-Basic", then, about 5 years ago, I used "VB6" and done a complete overhaul. Each time I would buy books and teach myself how to do the programming. The best thing that happened to me was getting connected to the internet which also connected me with people like you, Brian, and all of the other wonderful people who offer their help on programming. This is not "hard" at all to me. This is FUN! I love to learn. But this program is also quite complex so I know that I am going to have a lot of time invested in it. My wonderful woman tests all of my code so well that once she can't crash the program anymore, I don't have to worry. Three years of use and dozens of users and nobody ever crashed this program. I want to keep it that way and I know that means investing the time to do it right and test it every step of the way.
   I will do some reading about "Classes" as you suggest because, as I said before, I love to learn. I think that I read about them before but I'm sure a re-read will do me good. I am also trying to learn "VB2008" while teaching my 2 step girls and their 2 friends how to program with it. (ages 9, 10, 12, & 12)
   Thanks again. You guys are GREAT! Garner

 
Old March 26th, 2008, 09:19 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 2,189
Thanks: 5
Thanked 59 Times in 57 Posts
Send a message via MSN to gbianchi
Default

Well, the new idea behind every new language is to make your life easier, like automatic classes that save data to a database (altough there are quite simple, the usually do the work in a correct way).
If you know VB6, you know the sintaxys before .NET, so you are in the rigth track.

Don't answer this if you don't want to, but what make you rebuild a system that is already working?

And for the rest, I never try this, but you can keep track of forms positions, colors and other things, .NET do it automatic, so what could be the diference in serialize the rest of the objects inside the form?

HTH

Gonzalo

================================================== =========
Read this if you want to know how to get a correct reply for your question:
http://www.catb.org/~esr/faqs/smart-questions.html
^^Took that from dparsons signature and he Took that from planoie's profile
================================================== =========
My programs achieved a new certification (can you say the same?):
WORKS ON MY MACHINE
http://www.codinghorror.com/blog/archives/000818.html
================================================== =========
I know that CVS was evil, and now i got the proof:
http://worsethanfailure.com/Articles...-Hate-You.aspx
================================================== =========
 
Old March 27th, 2008, 12:59 PM
Friend of Wrox
 
Join Date: Nov 2004
Posts: 1,621
Thanks: 1
Thanked 3 Times in 3 Posts
Default

Garner,

You might be jumping to the wrong solution—maybe.

Though databases are, of course, useful for this sort of thing, that might not be the perfect fit here (though also it might be...).

There are a couple of things to contemplate.

There is a storage mechanism using defined types (the same thing as structures in C).
If you define a type, you can save &retrieve all of the “fields” of that type in one step, using file access procedures built into VB.
Using that technique, you could do this:
  • Create a type, having one “field” per datum, a field of the proper data type.
    Code:
    Public Type MyType
        FName As String
        LName As String
        . . .
    End Type
  • Create a global variable of that type.
    Code:
        Public tmpType As MyType
  • In each control, use the OnUpdate/OnChange/OnEtc event to change the value of the field in the variabe that corresponds to that datum, and save the variable to a temp, local file.
    Code:
    Private Sub txtFName_OnUpdate()
    
        tmpType.FName = txtFName.Text
        SaveMyTmpVar ' A Sub you’ve written to do the saving.
    
    End Sub
This way, the file would be almost 100% up to date at all times, and sometimes even [u]at</u> 100%.
When you “save” the contents of the form, delete the file.
If, when the user opens the form, there is a temp file in existence locally, there were lost data, and you can reload the form from the contents of the file.

Since data in a form are usually not relational, a flat-file storage approach is often adequate. After all, these data have not been tagged by the user for saving, so adding them to the database can be premature.
 
Old March 27th, 2008, 09:14 PM
Registered User
 
Join Date: Apr 2006
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Gonzalo,
   The main reason for the "rebuild" was that the power goes off so much in the area where this program is used. A lap top with a battery usually solved the problem but sometimes the power was off even to long for that. The reasonable thing to do seemed to be to find a way to store the information to the hard drive. Save the information and when the power comes back on you can just reload it.
   The second reason is that I never wrote a program that saved information in this way. I wanted to learn how to do it. Now, thanks to great people like You, Woody, & Brian, I have a ton of new information to investigate and try to put to use.
   I don't know how to thank all of you and Wrox for making the learning experience so enjoyable. I hope that "Thanks" will work for now.
   Garner






Similar Threads
Thread Thread Starter Forum Replies Last Post
Save As Dialog in web forms collie ASP.NET 1.0 and 1.1 Basics 0 March 18th, 2008 08:41 AM
save, edit, and delete sime_tyres VB Databases Basics 1 September 1st, 2006 09:45 PM
Delete records in MySQL using checkboxes in forms taslim Beginning PHP 2 August 10th, 2006 05:01 AM
Save Dynamically created forms DaDeViL Access VBA 2 August 17th, 2005 08:29 AM
to save forms' properties vubinhsg BOOK: Access 2003 VBA Programmer's Reference 1 December 20th, 2004 06:20 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.