Results 1 to 2 of 2
  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 - initialising the text boxes

    In theory you have two command buttons "OK" and "Cancel" and have now built two more "Refresh" and "Save". Here comes the code for the "click" events for those two buttons.

    You'll want to throw up your form and double-click on the button "Refresh"; you'll be taken into a skeleton procedure as for the other buttons, and uou'll want to flesh it out as I have done below.

    Likewise for the "Save" button.

    In a reply to this post I'll post some more declaratives, in case you haven't got them yet (rough translation: I forget whether I've posted thsm)


    <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>


    Notes:

    1. I'm using "me" as the generic name of my form.

    2. I make heavy use of string constants (strc)

    3. I make use of the default values for the strGP calls. For this reason all my applications can regenerate the INI file should it be deleted. i tell users: If you corrupt the INI file, just delete. The application will regrow it.

    4. If you gave your text boxes names other than txtBusiness etc. you'll have to use your names in here.

  2. #2
    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 - initialising the text boxes

    [pre]
    ' Declarations for Envelope/Header/Footer GUI form (frmHeader)
    Public Const strcBusiness As String = "Business"
    Public Const strcAddressLine1 As String = "AddressLine1"
    Public Const strcAddressLine2 As String = "AddressLine2"
    Public Const strcAddressLine3 As String = "AddressLine3"
    Public Const strcTelephone As String = "Telephone"
    Public Const strcEmail As String = "Email"
    Public Const strcWebPage As String = "WebPage"
    Public Const strcDefaultBusiness As String = "Chris Greaves Inc."
    Public Const strcDefaultAddressLine1 As String = "3 Foxcote Crescent"
    Public Const strcDefaultAddressLine2 As String = "Toronto; Ontario"
    Public Const strcDefaultAddressLine3 As String = "CANADA; M9C 4B9"
    Public Const strcDefaultTelephone As String = "(416) 621-9348"
    Public Const strcDefaultEmail As String = "cgreaves@vif.com"
    Public Const strcDefaultWebPage As String = "www.vif.com/users/cgreaves"
    Public strBusiness As String
    Public strAddressLine1 As String
    Public strAddressLine2 As String
    Public strAddressLine3 As String
    Public strTelephone As String
    Public strEmail As String
    Public strWebPage As String

Posting Permissions

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