Results 1 to 2 of 2

Thread: what's wrpmg with this code?

  1. #1

    Thread Starter
    Member
    Join Date
    Jan 2000
    Location
    Launceston, Tasmania, Australia
    Posts
    44

    Post

    Ok I am having a little bit of trouble with some simple code that should be workin fine, but for some reason its not workin how it should be.

    Ok on one of my forms I have four check boxes 1 by the name of option1 one by the name of option2 and the other 2 are named SecYes and SecNo.

    In their click events the code looks like this:

    Private Sub Option1_Click()
    Option2.Value = 0
    If Option1.Value = 1 Then
    SetTime.Enabled = False
    Label7.Enabled = False
    Label8.Enabled = False
    BeginTime.Enabled = False
    Label9.Enabled = False
    Label1(1).Enabled = False
    Liney1.Text = "Automatic"
    End If

    End Sub

    Private Sub Option2_Click()
    Option1.Value = 0
    If Option2.Value = 1 Then
    SetTime.Enabled = True
    Label7.Enabled = True
    Label8.Enabled = True
    BeginTime.Enabled = True
    Label9.Enabled = True
    Label1(1).Enabled = True
    Liney1.Text = "Time"
    End If

    End Sub


    Private Sub SecYes_Click()
    SecNo.Value = 0
    If SecYes.Value = 1 Then Liney3.Text = "Yes"
    End Sub

    SecYes.Value = 0
    If SecNo.Value = 1 Then Liney3.Text = "No"

    Ok now when my project first loads it reads from an ini file called Settings.ini

    to determine which check boxes are checked and which ones are not the form load code looks like this:


    Private Sub Form_Load()
    Open "Settings.ini" For Input As #1
    Input #1, Line1
    Input #1, Line2
    Input #1, Line3
    Input #1, Line4
    Input #1, Line5
    Input #1, Line6
    Input #1, Line7
    Input #1, Line8
    Input #1, Line9
    Input #1, Line10
    Close #1


    Liney1.Text = Line1
    Liney2.Text = Line2
    Liney3.Text = Line3
    Liney4.Text = Line4
    Liney5.Text = Line5
    Liney6.Text = Line6
    Liney7.Text = Line7
    Liney8.Text = Line8
    Liney9.Text = Line9
    Liney10.Text = Line10

    If Liney1.Text = "Automatic" Then Option1.Value = 1 And Option2.Value = 0
    If Liney1.Text = "Set Time" Then Option2.Value = 1 And Option1.Value = 0
    If Liney1.Text = "" Then Option2.Value = 0 And Option1.Value = 0

    BeginTime.Text = Liney2.Text

    If Liney3.Text = "No" Then SecNo.Value = 1 And SecYes.Value = 0
    If Liney3.Text = "Yes" Then SecNo.Value = 0 And SecYes.Value = 1

    Username.Text = Liney4.Text
    Password.Text = Liney5.Text


    Now The problem is for the checkboxes named option1 and option2 for some reason the value will not change when the form loads it stays on option1 checked which is defaultly on the first time it is run.

    and for Secyes and Secno the values are both not checked. Why is this happening to what I thought was a perfectly simple piece of code and how do I fix it?

    ------------------
    Mooose

  2. #2

    Thread Starter
    Member
    Join Date
    Jan 2000
    Location
    Launceston, Tasmania, Australia
    Posts
    44

    Post

    geeez I just saw the typo in my topics title what was I drinkin?

    Well i found the problem with the code, I was trying to do it on a SStab strip It must not have supported setting the values in the form load property, incase anyone else has had similar problems to fix it all I had to do was make frames on the sstab strip, and place the check boxes in the appropriate frame.

    ------------------
    Mooose

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