I have following function in my program. The line with the ** is where it goes wrong. The value of Textbox.Text returns the old value instead of the new one. The .Text property of the textboxes get set with a different function. Then the user can change them and run this function. But the Textbox.Text field still has the old value and isn't updated. Anyone know how I can fix this?
Thanks.
Private Function saveListFromEditor()
Dim newpartialfunctionlist As New List(Of Te)
For Each Tab As TabPage In TabControl1.TabPages
For Each TObj In Tab.Controls
If TObj.GetType.ToString.ToLower = "system.windows.forms.flowlayoutpanel" Then
Dim flowlayout As FlowLayoutPanel = CType(TObj, FlowLayoutPanel)
Dim values As NameValueCollection = New NameValueCollection
For Each obj In flowlayout.Controls
If (obj.GetType.ToString.ToLower = "system.windows.forms.textbox") Then
Dim textbox As TextBox = CType(obj, TextBox)
If (textbox.Name.ToString.ToLower = "display") Then
newfunction.display = textbox.Text
Else
**values.Add(textbox.Name, textbox.Text)**
End If
End If
Next
End If
Next
Next
Return values
End Function
textboxcould be considered to be the same asTextBoxwhich can lead to unexpected results