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

    Possible? Simple loop to attach int to a string

    I have a Windows Form app that has over 100 textboxes. I need to convert them all into integers so I can add them to an array. Is something to this extent possible:

    int a [99]

    for(int i = 0, i < 100, i++)
    {
    Int32::TryParse(textBox(i)->Text, a[i]);
    }



    I know it cant be done like this but I need something relatively simple like this. Thanks in advance.

  2. #2
    Lindley is offline Elite Member Power Poster
    Join Date
    Oct 2007
    Location
    Seattle, WA
    Posts
    10,895

    Re: Possible? Simple loop to attach int to a string

    You could use a stringstream, or strtol().

  3. #3
    Join Date
    Feb 2010
    Posts
    2

    Re: Possible? Simple loop to attach int to a string

    Sorry to be such a newbie but could give me an example of stringstream. I have read various sources on the net but they kind of go over my head alittle. I really feel like I'm not getting my money's worth in my Visual C++ class because we aren't going over a lot of things that to me seem vary important.

  4. #4
    Join Date
    Feb 2003
    Location
    Iasi - Romania
    Posts
    8,234

    Re: Possible? Simple loop to attach int to a string

    [ Moved thread ]

Tags for this Thread

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