Autocomplete list does not show all possible completions with BindingSource.Item
I've got a BindingSource for a DataSet. I'm fairly new to this whole binding business and databases, and it took me hours to figure out how to use Bindi开发者_开发技巧ngSource to get to an item, because the Row method was not included in the autocomplete. Not to confuse anyone, here's some sample code:
Dim somePreperty As String
Dim dataSet As New MyDataSet
Dim table As New MyDataSetTableAdapters.MyTableAdapter
Dim source As New BindingSource
source.DataSource = dataSet
source.DataMember = "SomeMember"
table.Fill(dataSet.SomeMember)
lablCabinet.DataBindings.Add("Text", source(0), "MemberID") '<This works fine>'
someProperty = source.Item(0).Row("ProductModel") '<So does this>'
The code runs perfectly and does exactly what I want. My problem is the following: When I've typed in source.Item(0).
, autocomplete does not display Row
in the list. Is this perhaps not the best way to do what I'm doing? Is there a reason it's hidden? Is this a good coding practice to do so? The fact that is wasn't there took me lots of time Googling, so I'm trying to figure out whether it's a Visual Studio glitch or my own.
Thanks in advance! = )
source.item(0) returns an object, so intellisense has no idea what is is. You know what it should be, the compiler does not. If you cast it first to a table or assing it to a table, intellisense will kick in.
So either:
ctype(source.item(0),datatable)
Or
dim tbl as datatable=source.item(0).
精彩评论