Results 1 to 11 of 11

Thread: [RESOLVED] Fixing Parameters

  1. #1

    Thread Starter
    Hyperactive Member Tarablue's Avatar
    Join Date
    Feb 2007
    Location
    Somewhere West of GMT
    Posts
    398

    Resolved [RESOLVED] Fixing Parameters

    Hello To All,

    In my program there are several combinations of parameters that the user can set. What I have managed to do is run a small program everytime the main program is run, there the user sets up his/her parameters, but this has to be done each time the program is run. What I would like to do is for the user, at the first run of the program, to set their own styles and have them permanantly fixed.

    My current code, though it works is very long winded, is as follows.

    Code:
    Private Sub Command1_Click()
    
        OpenSplash.Command1.Enabled = True
        OpenSplash.Command2.Enabled = True
    
    Parameters.Visible = False
    
    
        If Combo1.ListIndex = 0 Then
            LamairInput.Combo3.ListIndex = 0
            BXInput.Combo1.ListIndex = 0
            
        ElseIf Combo1.ListIndex = 1 Then
            LamairInput.Combo3.ListIndex = 1
            BXInput.Combo1.ListIndex = 1
    
        ElseIf Combo1.ListIndex = 2 Then
            LamairInput.Combo3.ListIndex = 2
            BXInput.Combo1.ListIndex = 2
    
        ElseIf Combo1.ListIndex = 3 Then
            LamairInput.Combo3.ListIndex = 3
            BXInput.Combo1.ListIndex = 3
    
        ElseIf Combo1.ListIndex = 4 Then
            LamairInput.Combo3.ListIndex = 4
            BXInput.Combo1.ListIndex = 4
    
    End If
    
        If Combo2.ListIndex = 0 Then
            LamairInput.Combo5.ListIndex = 0
            BXInput.Combo2.ListIndex = 0
    
        ElseIf Combo2.ListIndex = 1 Then
            LamairInput.Combo5.ListIndex = 1
            BXInput.Combo2.ListIndex = 1
    
        ElseIf Combo2.ListIndex = 2 Then
            LamairInput.Combo5.ListIndex = 2
            BXInput.Combo2.ListIndex = 2
    
        ElseIf Combo2.ListIndex = 3 Then
            LamairInput.Combo5.ListIndex = 3
            BXInput.Combo2.ListIndex = 3
    
    End If
    
        If Combo3.ListIndex = 0 Then
            LamairInput.Combo7.ListIndex = 0
            BXInput.Combo3.ListIndex = 0
    
        ElseIf Combo3.ListIndex = 1 Then
            LamairInput.Combo7.ListIndex = 1
            BXInput.Combo3.ListIndex = 1
                LamairInput.Combo6.Text = 68
                BXInput.Combo14.Text = 68
    
    End If
    
        If Combo4.ListIndex = 0 Then
            LamairInput.Combo9.ListIndex = 0
            BXInput.Combo4.ListIndex = 0
            
        ElseIf Combo4.ListIndex = 1 Then
            LamairInput.Combo9.ListIndex = 1
            BXInput.Combo4.ListIndex = 1
    
    End If
    
    LamairInput.Visible = False
    BXInput.Visible = False
    OpenSplash.Visible = True
    
    
    End Sub
    
    Private Sub Form_Load()
    
    'Label 1
        Label6.Caption = "Do not show again?"
    
    'combo1
        Combo1.Clear
        Combo1.AddItem "m3/s"
        Combo1.AddItem "m3/min"
        Combo1.AddItem "m3/hr"
        Combo1.AddItem "l/s"
        Combo1.AddItem "cfm"
        Combo1.ListIndex = 0
        
    'combo2
        Combo2.Clear
        Combo2.AddItem "Pa"
        Combo2.AddItem "mm wg"
        Combo2.AddItem "in wg"
        Combo2.AddItem "mbar"
        Combo2.ListIndex = 0
    
    'combo3
        Combo3.Clear
        Combo3.AddItem "°C"
        Combo3.AddItem "°F"
        Combo3.ListIndex = 0
        
    'combo4
        Combo4.Clear
        Combo4.AddItem "m"
        Combo4.AddItem "ft"
        Combo4.ListIndex = 0
        
        Parameters.Visible = True
    Combo1.SetFocus
    
    End Sub
    Can anyone advise me onhow to do this and offer up some coding, as I'm no master programmer by any stretch of the imagination.

    Thank You
    Tarablue

  2. #2

  3. #3
    PowerPoster Ellis Dee's Avatar
    Join Date
    Mar 2007
    Location
    New England
    Posts
    3,530

    Re: Fixing Parameters

    Quote Originally Posted by Tarablue
    Can anyone advise me onhow to do this and offer up some coding, as I'm no master programmer by any stretch of the imagination.
    In addition to using the registry as Martin suggested, your Command1_Click code can be tightened up to this:
    Code:
    Private Sub Command1_Click()
    
        OpenSplash.Command1.Enabled = True
        OpenSplash.Command2.Enabled = True
    
        Parameters.Visible = False
        
        LamairInput.Combo3.ListIndex = Combo1.ListIndex
        BXInput.Combo1.ListIndex = Combo1.ListIndex
        
        LamairInput.Combo5.ListIndex = Combo2.ListIndex
        BXInput.Combo2.ListIndex = Combo2.ListIndex
        
        LamairInput.Combo7.ListIndex = Combo3.ListIndex
        BXInput.Combo3.ListIndex = Combo3.ListIndex
        If Combo3.ListIndex = 1 Then
            LamairInput.Combo6.Text = 68
            BXInput.Combo14.Text = 68
        End If
        
        LamairInput.Combo9.ListIndex = Combo4.ListIndex
        BXInput.Combo4.ListIndex = Combo4.ListIndex
            
    
        LamairInput.Visible = False
        BXInput.Visible = False
        OpenSplash.Visible = True
    End Sub

  4. #4

    Thread Starter
    Hyperactive Member Tarablue's Avatar
    Join Date
    Feb 2007
    Location
    Somewhere West of GMT
    Posts
    398

    Re: Fixing Parameters

    Hello Martin Liss,

    Looked at "How to use SaveSetting and GetSetting" and thought is was going to be fairly simple. It may be for most but me - No.

    OK, trying your idea on just one part of my program, I placed SaveSetting Roof, "SmallRoofInput", "Combo6", Combo6.Text at the end of my code and when run I get an error message Expected Sub, Function, or Property.

    As for the Combo3.ListIndex = GetSetting(Roof, "SmallRoofInput", "Combo3") I originall got an error Variable not defined, so I placed Dim Roof As ApplicationStartConstants in my code. This time I get an error Type missmatch.

    As I said before, I'm no programmer, especially when it comes to this so I'm back for more help please.

    Thank you
    Tarablue

  5. #5

    Thread Starter
    Hyperactive Member Tarablue's Avatar
    Join Date
    Feb 2007
    Location
    Somewhere West of GMT
    Posts
    398

    Re: Fixing Parameters

    Hello Ellis Dee,

    That's fantastic, thankyou. See I told you it was long winded. Better not let you get your hands on the rest of it, I don't want to be responsible for you turning in your grave at the sight of it.

    Thank you
    Tarablue

  6. #6
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: Fixing Parameters

    Is this resolved now?

  7. #7
    PowerPoster Ellis Dee's Avatar
    Join Date
    Mar 2007
    Location
    New England
    Posts
    3,530

    Re: Fixing Parameters

    Quote Originally Posted by Tarablue
    I told you it was long winded. Better not let you get your hands on the rest of it, I don't want to be responsible for you turning in your grave at the sight of it.
    heh, don't beat yourself up. Everybody started out as a beginner.

  8. #8
    Former Admin/Moderator MartinLiss's Avatar
    Join Date
    Sep 1999
    Location
    San Jose, CA
    Posts
    33,431

    Re: Fixing Parameters

    Quote Originally Posted by Tarablue
    Hello Martin Liss,

    Looked at "How to use SaveSetting and GetSetting" and thought is was going to be fairly simple. It may be for most but me - No.

    OK, trying your idea on just one part of my program, I placed SaveSetting Roof, "SmallRoofInput", "Combo6", Combo6.Text at the end of my code and when run I get an error message Expected Sub, Function, or Property.

    As for the Combo3.ListIndex = GetSetting(Roof, "SmallRoofInput", "Combo3") I originall got an error Variable not defined, so I placed Dim Roof As ApplicationStartConstants in my code. This time I get an error Type missmatch.

    As I said before, I'm no programmer, especially when it comes to this so I'm back for more help please.

    Thank you
    Tarablue
    What is Roof, the name of your program? Normally that first parameter would be, but you can put anything there that you like as long as the SaveSetting and GetSetting are consistent. Also in 20 years I've never used an ApplicationStartConstants. In any case you don't need to Dim Roof, just do this

    SaveSetting "Roof", "SmallRoofInput", "Combo6", Combo6.Text

    And for GetSetting (this would not be the matching call for the SaveSetting above)

    Combo3.ListIndex = GetSetting("Roof", "SmallRoofInput", "Combo3", -1)

    The 4th parameter is used as the default if the value hasn't been saved before.

  9. #9

    Thread Starter
    Hyperactive Member Tarablue's Avatar
    Join Date
    Feb 2007
    Location
    Somewhere West of GMT
    Posts
    398

    Re: Fixing Parameters

    Hello Martin Liss,

    GOT IT!!!!

    It looks as if I missed out some quotes "", but that wasn't all, I still had to fix up the Parameters program i.e. where to place the code. This I have just done on a dummy run and WOW!! there it was, now all I need to do is not panic and take it one step at a time.

    Thank You Again
    Tarablue

  10. #10
    Former Admin/Moderator MartinLiss's Avatar
    Join Date
    Sep 1999
    Location
    San Jose, CA
    Posts
    33,431

    Re: Fixing Parameters

    Quote Originally Posted by Tarablue
    Hello Martin Liss,

    GOT IT!!!!

    It looks as if I missed out some quotes "", but that wasn't all, I still had to fix up the Parameters program i.e. where to place the code. This I have just done on a dummy run and WOW!! there it was, now all I need to do is not panic and take it one step at a time.

    Thank You Again
    Tarablue
    Did you ever read the Hitchhikers Guide to the Galaxy? In any case "Don't panic" is always a good approach.

  11. #11
    PowerPoster Ellis Dee's Avatar
    Join Date
    Mar 2007
    Location
    New England
    Posts
    3,530

    Re: [RESOLVED] Fixing Parameters

    I saw a digital watch the other day. I tell you, those are a really neat idea.

Posting Permissions

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



Click Here to Expand Forum to Full Width