mardi 21 avril 2015

Most Simple way to pragramatically delete textboxes in C#?

I have a dictionary of text boxes I'm using for my program. When changing options I want the boxes to be deleted so that new ones can be made for the next page.

    public static bool command0 () {
        foreach (TextBox tBox in Globals.inputBoxes)
            tBox = null;
        return true;
    }

that returns this error

Cannot convert type 'System.Collections.Generic.KeyValuePair<string,System.Windows.Forms.TextBox>' to 'System.Windows.Forms.TextBox' (CS0030) - C:\Users\e309706\Documents\SharpDevelop Projects\simulator 3\simulator 3\Globals.cs:73,4

Is there a simple and correct way to do what I'm trying to do?

Aucun commentaire:

Enregistrer un commentaire