Re: how to get the values from dynamically created textboxes to create fields in database table

  • 13 years ago

    I honestly don't know what you tried to do that generated a runtime exception, the only reason you need that !=null check is because you're casting the control to a textbox, if that failes, since you're enumerating all the controls it'll produce a null. My code how ever only selects textboxes from the collection, hence no casting and no null check, not even the following would produce an exception

    string m = "";

    TextBox x=null;

    this.Controls.Add(x);

    foreach (TextBox t in this.Controls)

    {

    m += t.Name +

    "\n\r";

    }

    MessageBox.Show(m);

Post a reply

No one has replied yet! Why not be the first?

Sign in or Join us (it's free).

Contribute

Why not write for us? Or you could submit an event or a user group in your area. Alternatively just tell us what you think!

Our tools

We've got automatic conversion tools to convert C# to VB.NET, VB.NET to C#. Also you can compress javascript and compress css and generate sql connection strings.

“Linux is only free if your time has no value” - Jamie Zawinski