another late binding error

D

Dean Slindee

Can someone explain how to remedy the two late binding errors below when
Option Strict On:

Public Function ControlDataRowArrayListPaint(ByRef frm As Form, _

ByRef ctl As Control, _

ByRef dr As DataRow, _

ByRef arrControl As
ArrayList) As Integer

Dim tag As String

Dim int As Integer = 0

For int = 0 To arrControl.Count - 1

tag = arrControl(int).tag 'LATE BINDING ERROR

arrControl(int).Checked = True 'LATE BINDING ERROR

Next

End Function



Each form that calls this function has the following define:

Friend ctlArray As ArrayList = New ArrayList(0)

Thanks,

Dean Slindee
 
K

Ken Tucker [MVP]

Hi,

Use DirectCast

tag = DirectCast(arrControl(int),Checkbox).tag

DirectCast(arrControl(int),CheckBox).Checked = True

Ken
--------------------

Can someone explain how to remedy the two late binding errors below when
Option Strict On:

Public Function ControlDataRowArrayListPaint(ByRef frm As Form, _

ByRef ctl As Control, _

ByRef dr As DataRow, _

ByRef arrControl As
ArrayList) As Integer

Dim tag As String

Dim int As Integer = 0

For int = 0 To arrControl.Count - 1

tag = arrControl(int).tag 'LATE BINDING ERROR

arrControl(int).Checked = True 'LATE BINDING ERROR

Next

End Function



Each form that calls this function has the following define:

Friend ctlArray As ArrayList = New ArrayList(0)

Thanks,

Dean Slindee
 
D

Dean Slindee

Thanks Ken for putting me on the right track

The second line works as stated. The first line should read:
tag = DirectCast(arrControl(int), Control).Tag.ToString

for anyone else reading.

Dean Slindee
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top