CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4
  1. #1
    Join Date
    Sep 2010
    Posts
    3

    Problem with List textbox

    Hi everybody.

    I have got a textbox called "textbox1". And an object, called player[0]
    There I generated a list: public List<TextBox> textboxInformation = new List<TextBox>();

    In the main method i wrote:
    player[0].textboxInformation .Add(textbox1);

    I want to access this box, by calling the "object.textboxInformation"

    If i count "player[0].textboxInformation.Count" , i get "1" as a result.
    So it has to be stored.

    But i can´t access it by:
    MessageBox.Show(player[0].textboxInformation [0].Text);
    And I also can´t modify the text:
    spieler[0].textboxInformation [0].Text = "TEST";

    It always says, its no object...

    Does anyone know, who to access it correctly?


    Thx alot!

  2. #2
    Join Date
    Sep 2010
    Posts
    3

    Re: Problem with List textbox

    Quote Originally Posted by daniel1000 View Post
    Hi everybody.

    I have got a textbox called "textbox1". And an object, called player[0]
    There I generated a list: public List<TextBox> textboxInformation = new List<TextBox>();

    In the main method i wrote:
    player[0].textboxInformation .Add(textbox1);

    I want to access this box, by calling the "object.textboxInformation"

    If i count "player[0].textboxInformation.Count" , i get "1" as a result.
    So it has to be stored.

    But i can´t access it by:
    MessageBox.Show(player[0].textboxInformation [0].Text);
    And I also can´t modify the text:
    spieler[0].textboxInformation [0].Text = "TEST";

    It always says, its no object...

    Does anyone know, who to access it correctly?


    Thx alot!

    *spieler = player

    I tranlated it from german And forgot one

  3. #3
    Join Date
    Sep 2010
    Posts
    3

    Re: Problem with List textbox

    public partial class Spielfeld : Form
    {
    spielerClass[] spieler = new spielerClass[3];

    public Spielfeld()
    {
    spieler[0] = new spielerClass();
    spieler[0].text.Add(S0kartenGesamtWertA);
    MessageBox.Show(Convert.ToString(spieler[0].einsatzAuswahl[0].Value));
    }
    ...
    }



    - - - - - -

    class spielerClass
    {
    public List<NumericUpDown> einsatzAuswahl = new List<NumericUpDown>();
    ...
    }



    Thats the original code. Oh and its no textbox, it´s numericUpAnDown

  4. #4
    Arjay's Avatar
    Arjay is offline Moderator / EX MS MVP Power Poster
    Join Date
    Aug 2004
    Posts
    13,490

    Re: Problem with List textbox

    What are you trying to do exactly? What's your game plan?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured