Late Binding Vb .Net

282 views Asked by At

Trying to set my labels text to = the value of a specific row & columns value. I prefer to use Option Strict On but its disallowing the late binding. Ideas?

Private Sub BuildText(ByVal dtData As DataTable)
    Try
        lblVendor.Text = CType(CStr(dtData.Rows(0)("Vendor").value), String)
    Catch ex As Exception

    End Try
End Sub
1

There are 1 answers

0
Rob Windsor On BEST ANSWER

To get the value you can use Field(Of T)

lblVendor.Text = dtData.Rows(0).Field(Of String)("Vendor")

DataRowExtensions.Field(Of T) Method (DataRow, String)

To use this you'll need to add a reference to System.Data.DataSetExtensions