convert from string to int

This is a discussion on convert from string to int within the C# Programming forums, part of the General Programming Boards category; I want to get from a String an Int. I've tried something like this: Code: String s=textBox1.Text; int i = ...

  1. #1
    Registered User
    Join Date
    Dec 2005
    Posts
    167

    convert from string to int

    I want to get from a String an Int.

    I've tried something like this:
    Code:
    String s=textBox1.Text;
                int i = Integer.parseInt(s);
                i++;
    but it doesn't work. I'm new with C# so don't give up on me

    thank you!

  2. #2
    The Right Honourable psychopath's Avatar
    Join Date
    Mar 2004
    Location
    Where circles begin.
    Posts
    1,070
    Code:
    int i = Convert.ToInt32(s);
    Memorial University of Newfoundland
    Computer Science

    Mac and OpenGL evangelist.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. how to combine these working parts??
    By transgalactic2 in forum C Programming
    Replies: 0
    Last Post: 02-01-2009, 07:19 AM
  2. Replies: 8
    Last Post: 04-25-2008, 02:45 PM
  3. Debug Error Really Quick Question
    By GCNDoug in forum C Programming
    Replies: 1
    Last Post: 04-23-2007, 12:05 PM
  4. Half-life SDK, where are the constants?
    By bennyandthejets in forum Game Programming
    Replies: 29
    Last Post: 08-25-2003, 11:58 AM
  5. Quack! It doesn't work! >.<
    By *Michelle* in forum C++ Programming
    Replies: 8
    Last Post: 03-01-2003, 11:26 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21