please help me in Private Sub bt1_Click()


compile error:
Method or data member not found

Private Sub balance_Click()

Dim sc As Single
Dim sd As Single

sc = 0
sd = 0

For i = 0 To listcr.ListCount - 1
sc = sc + CSng(List.List(i))

Next i
For j = 0 To listde.ListCount - 1
sd = sd + CSng(List.List(j))

Next j
totcr.Caption = sc
totde.Caption = sd
totb = sc - sd

End Sub

Private Sub bt1_Click()

If opt1.Value = True Then

listcr.AddItem (t1.Text)
listde.AddItem ("0")

listcr.AddItem (t1.Text)
listcr.addltem ("0")
End If

End Sub

Private Sub bt2_Click()

listcr.RemoveItem (listcr.ListCount - 1)
listde.RemoveItem (listde.ListCount - 1)

End Sub

Private Sub bt3_Click()


End Sub

Private Sub Form_Load()
bt1.Enabled = False
bt2.Enabled = False

End Sub

Private Sub t1_Change()
If t1.Text <> "" Then
bt1.Enabled = True
bt2.Enabled = True
End If
End Sub

Private Sub t1_validate(cancel As Boolean)

If Not IsNumeric(t1.Text) Then
cancel = True
cancel = False
End If
End Sub

picture in error

Hi mahdouch5,

I am 100% sure this will solve your problem. By looking your attached Image I found out that your control opt1 has array. Just change your code as under.

If opt1(0).Value = True Then

Or you can clear Index on Properties on that option if you have unique name.


What that error is telling you is that you do not have a control by that name. So, go to form design view and click on the option button that you think is of that name and see what its name is in properties...

Good Luck

it cause your option button is an array control.. so vb doesn't recognize the control..
so your code must be :

If Opt1(0).Value = True Then