in

C1 Community

ComponentOne Community is a free source for developers and help authors to collaborate and communicate.

array of ComboBoxes

Last post 04-28-2008 1:04 PM by C1_JohnAd. 1 replies.
Page 1 of 1 (2 items)
Sort Posts: Previous Next
  • 04-23-2008 1:34 PM

    array of ComboBoxes

    With the C1 Textbox, if I have an array of field names, I can do the following:

        this.Controls["tb_" + ColName].Text = ColValues[i].ToString();

    Is there a way to do the same thing with ComboBoxes? The following does not work:

        this.Controls["cb_" + ColName].SelectedText = ColValues[i].ToString();

    According to the error output, 'System.Windows.Forms.Control' does not contain a definition for 'SelectedText' and no extension method 'SelectedText' accepting a first argument of type 'System.Windows.Forms.Control' could be found (are you missing a using directive or an assembly reference?).

     Any help would be much appreciated.

    Thanks!

    Joe

     

  • 04-28-2008 1:04 PM In reply to

    Re: array of ComboBoxes

    Hi Joe,
     
    Please try the following code:
     
    this.Controls["cb_" + ColName].Text = ColValues[i].ToString();
     
    This should work.
     
    Regards,
    John Adams
     
     
     
    <iddjoe> wrote in message news:204210@10.0.1.98...

    With the C1 Textbox, if I have an array of field names, I can do the following:

        this.Controls["tb_" + ColName].Text = ColValues[i].ToString();

    Is there a way to do the same thing with ComboBoxes? The following does not work:

        this.Controls["cb_" + ColName].SelectedText = ColValues[i].ToString();

    According to the error output, 'System.Windows.Forms.Control' does not contain a definition for 'SelectedText' and no extension method 'SelectedText' accepting a first argument of type 'System.Windows.Forms.Control' could be found (are you missing a using directive or an assembly reference?).

     Any help would be much appreciated.

    Thanks!

    Joe

     



    http://helpcentral.componentone.com/cs/forums/p/75052/204210.aspx#204210

Page 1 of 1 (2 items)
Contact ComponentOne: 1.800.858.2739 ©1987-2008 ComponentOne LLC All Rights Reserved.