0

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
2
  • Note: I would avoid the use of control types for your variable names as VB is case insensitive (which is both a good and a bad thing). So textbox could be considered to be the same as TextBox which can lead to unexpected results Commented Sep 4, 2012 at 16:17
  • Thanks for the tip. I changed the variable names. Of course does not help the problem I am currently having. Commented Sep 5, 2012 at 7:18

1 Answer 1

1

Problem has been solved. Issues was not part of this piece of code. Thanks for the comments and help anyway. Topic can be closed.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.