View Single Post
  #3 (permalink)  
Old 05-05-2008, 02:39 PM
klaus's Avatar
klaus klaus is offline
Basic4ppc Expert
 
Join Date: Oct 2007
Location: Fully, Switzerland
Posts: 3,797
Awards Showcase
Forum Contributer Beta Tester Competition Winner 
Total Awards: 3
Default

Erel,
This behaviour looks strange.

I renamed PrevBtn to PrevBtn1
I added a new button named it PrevBtn
Deleted button PrevBtn1
Renamed Sub PrevBtn1 back to Sub PrevBtn
And it works normally. Source QuestionExampleNew
in this code when PrevBtn.Enabled=False is executed,
the Radio_Click routine is not called.

I also tried the following code
in this code when PrevBtn.Enabled=False is executed,
the Sender in the Radio_Click routine is RadioButton1

Code:
Sub ShowData
  Label1.Text=
"Q"&(AnsRec+1)&""
  
If Answer(AnsRec)=0 Then
    
For i=1 To 5
      Control(
"RadioBtn"&i).Checked=False
    
Next
  
Else
  Control(
"RadioBtn"&Answer(AnsRec)).Checked=True
  
End If
  
If AnsRec=0 Then
    PrevBtn.Enabled=
False
    NextBtn.Enabled=
True
  
Else If AnsRec=5 Then
    PrevBtn.Enabled=
True
    NextBtn.Enabled=
False
  
Else
    PrevBtn.Enabled=
True
    NextBtn.Enabled=
True
  
End If
End Sub
instead of

Code:
Sub ShowData
  
If AnsRec=0 Then
    PrevBtn.Enabled=
False
    NextBtn.Enabled=
True
  
Else If AnsRec=5 Then
    PrevBtn.Enabled=
True
    NextBtn.Enabled=
False
  
Else
    PrevBtn.Enabled=
True
    NextBtn.Enabled=
True
  
End If
  Label1.Text=
"Q"&(AnsRec+1)&""
  
If Answer(AnsRec)=0 Then
    
For i=1 To 5
      Control(
"RadioBtn"&i).Checked=False
    
Next
  
Else
  Control(
"RadioBtn"&Answer(AnsRec)).Checked=True
  
End If
End Sub
in this code when PrevBtn.Enabled=False is executed,
the Sender in the Radio_Click routine is RadioButton2 which gives the wrong information.

Best regards
__________________
Klaus
Switzerland
Reply With Quote