Results 1 to 5 of 5
  1. #1
    Platinum Lounger
    Join Date
    Feb 2001
    Location
    Yilgarn region of Toronto, Ontario
    Posts
    5,453
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Code: frmHeader - Save and Refresh

    here's the last bit of code for the GUI form - for now. If you've worked through this far you've got a pretty good idea of the basics.

    I have purposely left out some stuff, such as aligning buttons, resizing them etc because I want to get on with general utility code.

    Please questions if you're having problems.

    Once this code is in place you should have a rudimentary form that can accept string data from the user, save it to an INI file, and bring it back for modification and use in an application.

    The GUI form is an example (a vehicle if you will) for a typical use of the INI file routines.


    In the VBE you'll want to double-click on the Save button 9and later on on the Refresh button) to make a spot for these two routines.

    <pre>Private Sub cmdRefresh_Click()
    ' Procedure : cmdRefresh_Click
    ' Description: Obtain values from the INI file.
    ' By: Chris Greaves Inc.
    ' Inputs: None
    ' Returns: None
    ' Assumes: Nothing
    ' Side Effects: None.
    ' Tested: By a call from the form.
    '
    ' We load each one of the text boxes with data from the INI file
    '
    Me.txtBusiness = strGp(strcApplication, strcBusiness, strcDefaultBusiness)
    Me.txtAddressLine1 = strGp(strcApplication, strcAddressLine1, strcDefaultAddressLine1)
    Me.txtAddressLine2 = strGp(strcApplication, strcAddressLine2, strcDefaultAddressLine2)
    Me.txtAddressLine3 = strGp(strcApplication, strcAddressLine3, strcDefaultAddressLine3)
    Me.txtTelephone = strGp(strcApplication, strcTelephone, strcDefaultTelephone)
    Me.txtEmail = strGp(strcApplication, strcEmail, strcDefaultEmail)
    Me.txtWebPage = strGp(strcApplication, strcWebPage, strcDefaultWebPage)
    End Sub

    Private Sub cmdSave_Click()
    ' Procedure : cmdSave_Click
    ' Description: Store values to the INI file.
    ' By: Chris Greaves Inc.
    ' Inputs: None
    ' Returns: None
    ' Assumes: Nothing
    ' Side Effects: None.
    ' Tested: By a call from the form.
    '
    ' We put each value of the text boxes to the INI file
    '
    Call strPP(strcApplication, strcBusiness, Me.txtBusiness, strcApplication)
    Call strPP(strcApplication, strcAddressLine1, Me.txtAddressLine1, strcApplication)
    Call strPP(strcApplication, strcAddressLine2, Me.txtAddressLine2, strcApplication)
    Call strPP(strcApplication, strcAddressLine3, Me.txtAddressLine3, strcApplication)
    Call strPP(strcApplication, strcTelephone, Me.txtTelephone, strcApplication)
    Call strPP(strcApplication, strcEmail, Me.txtEmail, strcApplication)
    Call strPP(strcApplication, strcWebPage, Me.txtWebPage, strcApplication)

    End Sub
    </pre>


  2. #2
    Gold Lounger
    Join Date
    Dec 2000
    Location
    Hollywood (sorta), California, USA
    Posts
    2,759
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Code: frmHeader - Save and Refresh

    A little

    With me

    End with

    wouldn't hurt.
    Kevin <IMG SRC=http://www.wopr.com/w3tuserpics/Kevin_sig.gif alt="Keep the change, ya filthy animal...">
    <img src=/w3timages/blackline.gif width=33% height=2><img src=/w3timages/redline.gif width=33% height=2><img src=/w3timages/blackline.gif width=33% height=2>

  3. #3
    Platinum Lounger
    Join Date
    Feb 2001
    Location
    Yilgarn region of Toronto, Ontario
    Posts
    5,453
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Code: frmHeader - Save and Refresh

    You mean like this:


    <pre> With me
    .txtBusiness = strGp(strcApplication, strcBusiness, strcDefaultBusiness)
    .txtAddressLine1 = strGp(strcApplication, strcAddressLine1, strcDefaultAddressLine1)
    .txtAddressLine2 = strGp(strcApplication, strcAddressLine2, strcDefaultAddressLine2)
    .txtAddressLine3 = strGp(strcApplication, strcAddressLine3, strcDefaultAddressLine3)
    .txtTelephone = strGp(strcApplication, strcTelephone, strcDefaultTelephone)
    .txtEmail = strGp(strcApplication, strcEmail, strcDefaultEmail)
    txtWebPage = strGp(strcApplication, strcWebPage, strcDefaultWebPage)
    end me
    </pre>


    ??

  4. #4
    Gold Lounger
    Join Date
    Dec 2000
    Location
    Hollywood (sorta), California, USA
    Posts
    2,759
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Code: frmHeader - Save and Refresh

    That's the technique.
    Kevin <IMG SRC=http://www.wopr.com/w3tuserpics/Kevin_sig.gif alt="Keep the change, ya filthy animal...">
    <img src=/w3timages/blackline.gif width=33% height=2><img src=/w3timages/redline.gif width=33% height=2><img src=/w3timages/blackline.gif width=33% height=2>

  5. #5
    Platinum Lounger
    Join Date
    Feb 2001
    Location
    Yilgarn region of Toronto, Ontario
    Posts
    5,453
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Code: frmHeader - Save and Refresh

    OK, I'm with you. Now take that scared look off your face.

    And thanks for the teaching. I'm still not used to the WITH stuff. I should maybe take a 5-minute look at the HELP files .....

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •