CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
+ Reply to Thread
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 Lindley has much to be proud of (1500+) Lindley has much to be proud of (1500+) Lindley has much to be proud of (1500+) Lindley has much to be proud of (1500+) Lindley has much to be proud of (1500+) Lindley has much to be proud of (1500+) Lindley has much to be proud of (1500+) Lindley has much to be proud of (1500+) Lindley has much to be proud of (1500+) Lindley has much to be proud of (1500+) Lindley has much to be proud of (1500+)
    Join Date
    Oct 2007
    Location
    Fairfax, VA
    Posts
    10,861

    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
    ovidiucucu's Avatar
    ovidiucucu is offline Moderator/Reviewer Power Poster ovidiucucu has a reputation beyond repute (3000+) ovidiucucu has a reputation beyond repute (3000+) ovidiucucu has a reputation beyond repute (3000+) ovidiucucu has a reputation beyond repute (3000+) ovidiucucu has a reputation beyond repute (3000+) ovidiucucu has a reputation beyond repute (3000+) ovidiucucu has a reputation beyond repute (3000+) ovidiucucu has a reputation beyond repute (3000+) ovidiucucu has a reputation beyond repute (3000+) ovidiucucu has a reputation beyond repute (3000+) ovidiucucu has a reputation beyond repute (3000+)
    Join Date
    Feb 2003
    Location
    Iasi - Romania
    Posts
    7,888

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

    [ Moved thread ]

+ Reply to Thread

Tags for this Thread

Bookmarks

Posting Permissions

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



HTML5 Development Center

Click Here to Expand Forum to Full Width