Extract values from vary controls and Write it on XML

This has found in forum who shared the problem and solution as mentioned above title.
Background:
A form contains many controls, such as TextBox, ComboBox and etc...
Then, we need to extract the value from these options.

The code example is as below:

foreach(Control control in this.Controls)
{
    //here 'this' is representing the form you want to iterate through

    //you can check whether it is a combobox or a text box
    if(control.GetType() == typeof(Combobox))
    {
        //this is a combo box
    }
    else if(control.GetType() == typeof(Textbox))
    {
        //this is a text box
    }
}
This is a nice example as for beginner like me ^^/
Link: http://stackoverflow.com/questions/6400382/how-do-i-extract-values-from-controls-and-write-it-on-xml

Comments

Popular posts from this blog

Why should we adopt LabVIEW FPGA as a tool for developing FPGA Project?

Split Container Control in C#

LabVIEW State Machine Basic Example