Cricket
Active member
I'm creating a form that has a number of dropdown lists that relate to different tables. I have a strange problem that I can't seem to figure out.
I can create a list of customers, and a list of standard features. But for some reason after I create the list of standard features the displayed value of the customer list is 'System.Data.DataRowView' for each item. I've created a ton of other lists on this form and none of them mess up except this particular one. I've stepped through the code and know that the problem is between these two lists. To fix it I simple run the sub that created the customer list again and voila all is well. But I would love it if someone could tell me why exactly this is occuring.
Here is the code in question (I've only pasted in the applicable code).
I can create a list of customers, and a list of standard features. But for some reason after I create the list of standard features the displayed value of the customer list is 'System.Data.DataRowView' for each item. I've created a ton of other lists on this form and none of them mess up except this particular one. I've stepped through the code and know that the problem is between these two lists. To fix it I simple run the sub that created the customer list again and voila all is well. But I would love it if someone could tell me why exactly this is occuring.
Here is the code in question (I've only pasted in the applicable code).
VB.NET:
[size=2]
[/size][size=2][color=#008000]' Sets up the Customer list.
[/color][/size][size=2][color=#0000ff]Private[/color][/size][size=2][color=#0000ff]Sub[/color][/size][size=2] SetupCustomerList()
[/size][size=2][color=#0000ff]Me[/color][/size][size=2].daCustomerList.SelectCommand = [/size][size=2][color=#0000ff]New[/color][/size][size=2] System.Data.OleDb.OleDbCommand(CsCustomerList, modGlobal.ocConnection)
GetCustomerList()
[/size][size=2][color=#0000ff]Me[/color][/size][size=2].cboCustomer.DisplayMember = "FullName"
[/size][size=2][color=#0000ff]Me[/color][/size][size=2].cboCustomer.ValueMember = "uid_Customer"
[/size][size=2][color=#0000ff]Me[/color][/size][size=2].cboCustomer.DataSource = [/size][size=2][color=#0000ff]Me[/color][/size][size=2].dtCustomerList.DefaultView()
[/size][size=2][color=#0000ff]End[/color][/size][size=2][color=#0000ff]Sub
[/color][/size][size=2][color=#008000]' Gets a list of customers.
[/color][/size][size=2][color=#0000ff]Private[/color][/size][size=2][color=#0000ff]Sub[/color][/size][size=2] GetCustomerList()
[/size][size=2][color=#0000ff]If[/color][/size][size=2][color=#0000ff]Me[/color][/size][size=2].dsPO.Tables.Contains("tblCustomer") [/size][size=2][color=#0000ff]Then
[/color][/size][size=2][color=#0000ff]Me[/color][/size][size=2].dsPO.Tables("tblCustomer").Clear()
[/size][size=2][color=#0000ff]End[/color][/size][size=2][color=#0000ff]If
[/color][/size][size=2][color=#0000ff]Me[/color][/size][size=2].daCustomerList.Fill([/size][size=2][color=#0000ff]Me[/color][/size][size=2].dsPO, "tblCustomer")
[/size][size=2][color=#0000ff]Me[/color][/size][size=2].dtCustomerList = [/size][size=2][color=#0000ff]Me[/color][/size][size=2].dsPO.Tables("tblCustomer")
[/size][size=2][color=#0000ff]Me[/color][/size][size=2].dtCustomerList.DefaultView.Sort = CsCustomerSort
[/size][size=2][color=#0000ff]End[/color][/size][size=2][color=#0000ff]Sub[/color][/size]
[size=2][color=#0000ff][size=2][/size][size=2][color=#008000]' Sets up the Standard Feature List.
[/color][/size][size=2][color=#0000ff]Private[/color][/size][size=2][color=#0000ff]Sub[/color][/size][size=2] SetupStandardFeatureList()
[/size][size=2][color=#0000ff]Try
[/color][/size][size=2][color=#0000ff]Dim[/color][/size][size=2] ocCommand [/size][size=2][color=#0000ff]As[/color][/size][size=2][color=#0000ff]New[/color][/size][size=2] System.Data.OleDb.OleDbCommand(CsStandardFeatureList, modGlobal.ocConnection)
[/size][size=2][color=#0000ff]With[/color][/size][size=2] ocCommand.Parameters.Add("@fuid_Series", [/size][size=2][color=#0000ff]GetType[/color][/size][size=2]([/size][size=2][color=#0000ff]Long[/color][/size][size=2]))
.SourceColumn = "fuid_Series"
[/size][size=2][color=#0000ff]End[/color][/size][size=2][color=#0000ff]With
[/color][/size][size=2][color=#0000ff]Me[/color][/size][size=2].daStandardFeatureList.SelectCommand = ocCommand
GetStandardFeatureList([/size][size=2][color=#0000ff]CLng[/color][/size][size=2]([/size][size=2][color=#0000ff]Me[/color][/size][size=2].cboSeries.SelectedValue))
[/size][size=2][color=#0000ff]Me[/color][/size][size=2].lstStandardFeatures.DisplayMember = "Feature"
[/size][size=2][color=#0000ff]Me[/color][/size][size=2].lstStandardFeatures.ValueMember = "uid_StandardFeature"
[/size][size=2][color=#0000ff]Me[/color][/size][size=2].lstStandardFeatures.DataSource = [/size][size=2][color=#0000ff]Me[/color][/size][size=2].dtStandardFeatureList.DefaultView()
[/size][size=2][color=#0000ff]Catch[/color][/size][size=2] ex [/size][size=2][color=#0000ff]As[/color][/size][size=2] Exception
MsgBox(ex.Message())
[/size][size=2][color=#0000ff]End[/color][/size][size=2][color=#0000ff]Try
[/color][/size][size=2][color=#0000ff]End[/color][/size][size=2][color=#0000ff]Sub
[/color][/size][size=2][color=#008000]' Gets the Standard Feature List.
[/color][/size][size=2][color=#0000ff]Private[/color][/size][size=2][color=#0000ff]Sub[/color][/size][size=2] GetStandardFeatureList([/size][size=2][color=#0000ff]ByVal[/color][/size][size=2] lSeries [/size][size=2][color=#0000ff]As[/color][/size][size=2][color=#0000ff]Long[/color][/size][size=2])
[/size][size=2][color=#0000ff]If[/color][/size][size=2][color=#0000ff]Me[/color][/size][size=2].dsPO.Tables.Contains("tblStandardFeature") [/size][size=2][color=#0000ff]Then
[/color][/size][size=2][color=#0000ff]Me[/color][/size][size=2].dsPO.Tables("tblStandardFeature").Clear()
[/size][size=2][color=#0000ff]End[/color][/size][size=2][color=#0000ff]If
[/color][/size][size=2][color=#0000ff]Me[/color][/size][size=2].daStandardFeatureList.SelectCommand.Parameters("@fuid_Series").Value = lSeries
[/size][size=2][color=#0000ff]Me[/color][/size][size=2].daStandardFeatureList.Fill([/size][size=2][color=#0000ff]Me[/color][/size][size=2].dsPO, "tblStandardFeature")
[/size][size=2][color=#0000ff]Me[/color][/size][size=2].dtStandardFeatureList = [/size][size=2][color=#0000ff]Me[/color][/size][size=2].dsPO.Tables("tblStandardFeature")
[/size][size=2][color=#0000ff]Me[/color][/size][size=2].dtStandardFeatureList.DefaultView.Sort = "[Feature]"
[/size][size=2][color=#0000ff]End[/color][/size][size=2][color=#0000ff]Sub
[/color][/size][/color][/size]