Holmes
Holmes

Reputation: 21

Late Binding Vb .Net

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

Upvotes: 0

Views: 285

Answers (1)

Rob Windsor
Rob Windsor

Reputation: 6859

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

Upvotes: 0

Related Questions