Can someone explain this error to me please?
The line my program fails at is:
Whilst I can seemingly work around this error, by "On Error Resume Next", this in turn seems to cause some strange binding errors later on.
The whole subroutine is as follows:
I can't find anywhere else where I'm binding either the commentTextBox.text property, or the "comment" field of entrantcontrolBindingSource, so I'm mystified by the error message. I guess I'm probably being daft and misinterpreting the message.
Can someone suggest what may be going on here?
Thanks,
Tim
An unhandled exception of type 'System.ArgumentException' occurred in System.Windows.Forms.dll
Additional information: This causes two bindings in the collection to bind to the same property.
The line my program fails at is:
VB.NET:
commentTextBox.DataBindings.Add("text", entrantcontrolBindingSource, "comment")
Whilst I can seemingly work around this error, by "On Error Resume Next", this in turn seems to cause some strange binding errors later on.
The whole subroutine is as follows:
VB.NET:
Public Sub BindEntrantControl()
'sub to bind data to entrant control (entrant details form)
entrants = eventdataDS.Tables("entrant")
If entrants.Rows.Count = 0 Then
entrants.Clear()
Exit Sub
End If
entrantcontrolBindingSource.DataSource = entrants
If issearch = True Then
entrantcontrolBindingSource.Filter = searchcriteria
Else
entrantcontrolBindingSource.RemoveFilter()
End If
DataGridView1.DataSource = entrantcontrolBindingSource
EntrantControl1.BindingNavigator1.BindingSource = entrantcontrolBindingSource
'next line temporarily commented out
'On Error Resume Next
With EntrantControl1
.urnLabel.DataBindings.Add("text", entrantcontrolBindingSource, "urn")
.surnameTextBox.DataBindings.Add("text", entrantcontrolBindingSource, "surname")
.firstnameTextBox.DataBindings.Add("text", entrantcontrolBindingSource, "firstname")
.dobDTP.DataBindings.Add("value", entrantcontrolBindingSource, "dateofbirth")
.ageLabel.DataBindings.Add("text", entrantcontrolBindingSource, "age")
.sexComboBox.DataBindings.Add("text", entrantcontrolBindingSource, "sex")
.address1TextBox.DataBindings.Add("text", entrantcontrolBindingSource, "address1")
.address2TextBox.DataBindings.Add("text", entrantcontrolBindingSource, "address2")
.address3TextBox.DataBindings.Add("text", entrantcontrolBindingSource, "address3")
.address4TextBox.DataBindings.Add("text", entrantcontrolBindingSource, "address4")
.postcodeTextBox.DataBindings.Add("text", entrantcontrolBindingSource, "postcode")
.entrantphoneTextBox.DataBindings.Add("text", entrantcontrolBindingSource, "entrantphone")
.entrantemailTextBox.DataBindings.Add("text", entrantcontrolBindingSource, "entrantemail")
.ecnameTextBox.DataBindings.Add("text", entrantcontrolBindingSource, "ecname")
.ecphoneTextBox.DataBindings.Add("text", entrantcontrolBindingSource, "ecphone")
.clubnameComboBox.DataBindings.Add("text", entrantcontrolBindingSource, "clubname")
.ukathleticsnumberTextBox.DataBindings.Add("text", entrantcontrolBindingSource, "ukathleticsnumber")
.nsrraTextBox.DataBindings.Add("text", entrantcontrolBindingSource, "nsrra")
.feeLbl.DataBindings.Add("text", entrantcontrolBindingSource, "entryfee")
.feecategoryComboBox.DataBindings.Add("text", entrantcontrolBindingSource, "feecategory")
.paidCheckBox.DataBindings.Add("checked", entrantcontrolBindingSource, "paid")
.methodComboBox.DataBindings.Add("text", entrantcontrolBindingSource, "method")
.commentTextBox.DataBindings.Add("text", entrantcontrolBindingSource, "comment")
.numberissuedbyComboBox.DataBindings.Add("text", entrantcontrolBindingSource, "numberissuedby")
.dupnumberflagCheckBox.DataBindings.Add("checked", entrantcontrolBindingSource, "duplicatenumber")
.racenumberTextBox.DataBindings.Add("text", entrantcontrolBindingSource, "racenumber")
.ranCheckBox.DataBindings.Add("checked", entrantcontrolBindingSource, "ran")
.timeMaskedTextBox.DataBindings.Add("text", entrantcontrolBindingSource, "time")
.overallposTextBox.DataBindings.Add("text", entrantcontrolBindingSource, "overallpos")
.classposTextBox.DataBindings.Add("text", entrantcontrolBindingSource, "classpos")
End With
End Sub
I can't find anywhere else where I'm binding either the commentTextBox.text property, or the "comment" field of entrantcontrolBindingSource, so I'm mystified by the error message. I guess I'm probably being daft and misinterpreting the message.
Can someone suggest what may be going on here?
Thanks,
Tim