views:

144

answers:

1
txtAddress.Text = DB.ProfileDataset.Tables("tblCustomers").Rows.Item("Address").toString

The above code generated Option Strict On disallows implicit conversions from 'String' to 'Integer' error under the Item("Address") I don't know what i did wrong...

+4  A: 

The DataRowCollection.Item property requires an integer for the row index.

I think you are after the following syntax:

txtAddress.Text = DB.ProfileDataset.Tables("tblCustomers").Rows(0)("Address").ToString()

EDIT

Something to keep in mind:

original code
    = DB.ProfileDataset.Tables("tblCustomers").Rows.Item("Address").toString
compiler sees
    = DB.ProfileDataset.Tables.Item("tblCustomers").Rows.Item("Address").toString
fixed code
    = DB.ProfileDataset.Tables("tblCustomers").Rows(0)("Address").ToString()
compiler sees
    = DB.ProfileDataset.Tables.Item("tblCustomers").Rows.Item(0).Item("Address").ToString()
Philip Fourie