Help with collection ArrayList conversion

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

  1. markyjj

    markyjj New Member

    Dec 7, 2005
    Likes Received:
    Trophy Points:
    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

    Jul 12, 2004
    Likes Received:
    Trophy Points:
    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