Help with collection ArrayList conversion

Discussion in 'C#' started by markyjj, Apr 22, 2006.

  1. markyjj

    markyjj New Member

    Joined:
    Dec 7, 2005
    Messages:
    19
    Likes Received:
    0
    Trophy Points:
    0
    Can someone please give me some advise on the following.

    I am currently doing a project where I have to store students records and I have to retrieve

    these records. This has to be done by using windows forms with C#. My idea is, is to use a

    collection array list to store the records. In the form I want to add code for a button

    click event that displays the records within the textboxes of the form when a record is

    retrieved from the collection array List. The problem that I have however, is how to

    convert the entered string to be displayed in the text box. For example, if the entered

    string is 'science' and stored in the collection array list called RegList. When I try to

    display this string in the text box, the fully qualified name is displayed, i.e

    System.Windows.Forms.TextBox, Text: science.

    I just want the entered string to be displayed.

    This is the conversion code that I use to display the code in the textbox:

    txtFirstnm.Text = RegList[1].ToString();

    'txtFirstnm' is the name of the text box and 'RegList' is the collection array list.

    I hope someone can assist with this it would be of great help. Thanks
     
  2. shabbir

    shabbir Administrator Staff Member

    Joined:
    Jul 12, 2004
    Messages:
    15,375
    Likes Received:
    388
    Trophy Points:
    83
    Just write txtFirstnm.Text = RegList[1] and not txtFirstnm.Text = RegList[1].ToString()
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice