E
Edward
My function to populate fields on a form from a collection:
Private Sub cbfSetUpAddresses(ByVal pcolAddress As Collection)
Line 1 Me.txtAddress1.Text = pcolAddress(1).ToString
Line 2 Me.txtAddress2.Text = pcolAddress(2).ToString
Line 3 Me.txtAddress3.Text = pcolAddress(3).ToString
Line 4 Me.txtAddress4.Text = pcolAddress(4).ToString
Line 5 Me.txtPostCode.Text = pcolAddress(5).ToString
Line 6 End Sub
The Postcode text box is corrupted. As well as containing the correct
data it also contains a bunch of trailing stuff from another field.
If I look at these values in a Watch window, I notice the following:
At Line 1 in the function the value of Me.txtPostCode.Text = "GL5 4RT"
At Line 1 in the function the value of pcolAddress(5).ToString = "GL5
4RT"
At Line 6 in the function the value of Me.txtPostCode.Text = "GL5 4RT
NOTE THE MISSING " AT THE END.
The text box then displays:
GL5 4RTershire
Incidentally, the " is missing from all the populated text boxes, but
it only corrupts the display in the Postcode text box.
I tried this:
Dim strTemp As String = ""
strTemp = Trim(pcolAddress(5).ToString)
Me.txtPostCode.Text = strTemp.ToString
but it made no difference.
Clearly there are dark forces at work. Can anyone help?
TIA
Edward
Private Sub cbfSetUpAddresses(ByVal pcolAddress As Collection)
Line 1 Me.txtAddress1.Text = pcolAddress(1).ToString
Line 2 Me.txtAddress2.Text = pcolAddress(2).ToString
Line 3 Me.txtAddress3.Text = pcolAddress(3).ToString
Line 4 Me.txtAddress4.Text = pcolAddress(4).ToString
Line 5 Me.txtPostCode.Text = pcolAddress(5).ToString
Line 6 End Sub
The Postcode text box is corrupted. As well as containing the correct
data it also contains a bunch of trailing stuff from another field.
If I look at these values in a Watch window, I notice the following:
At Line 1 in the function the value of Me.txtPostCode.Text = "GL5 4RT"
At Line 1 in the function the value of pcolAddress(5).ToString = "GL5
4RT"
At Line 6 in the function the value of Me.txtPostCode.Text = "GL5 4RT
NOTE THE MISSING " AT THE END.
The text box then displays:
GL5 4RTershire
Incidentally, the " is missing from all the populated text boxes, but
it only corrupts the display in the Postcode text box.
I tried this:
Dim strTemp As String = ""
strTemp = Trim(pcolAddress(5).ToString)
Me.txtPostCode.Text = strTemp.ToString
but it made no difference.
Clearly there are dark forces at work. Can anyone help?
TIA
Edward