hi
i have 90 textBoxes at my program and i want to insert them for my DataBase (sql)
how can i do that?
i know that i can to do array like -> TextBox[] arr = {textBox1,texBox2......textBox(n)};
but i dont wanna this way cause that a lot of work.
how can i do that in another way and easy?
thanks...
moshe12007 0 Light Poster
Recommended Answers
Jump to PostTry doing a loop through foreach control of the form:
private void Insert() { foreach (Control c in this.Controls) { if (c is TextBox && c != null) { string valueOfTextBox = c.Text; } } }
Jump to Post@Mitja
Right, but you would have the textboxes in the order they are added to the Controls collection of the form, is that always OK?
Jump to Post@Momerath: I've already seen sudoku game code here build with 81 textboxes.
All 11 Replies
Mitja Bonca 557 Nearly a Posting Maven
ddanbe 2,724 Professional Procrastinator Featured Poster
Momerath 1,327 Nearly a Senior Poster Featured Poster
Mitja Bonca 557 Nearly a Posting Maven
moshe12007 0 Light Poster
Mitja Bonca 557 Nearly a Posting Maven
Mitja Bonca 557 Nearly a Posting Maven
moshe12007 0 Light Poster
ddanbe 2,724 Professional Procrastinator Featured Poster
Mitja Bonca 557 Nearly a Posting Maven
moshe12007 0 Light Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.