6 Replies - 273 Views - Last Post: 17 July 2012 - 01:02 PM Rate Topic: -----

#1 Raminator  Icon User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 219
  • Joined: 16-July 12

Assigning each leter in a textbox to a different variable

Posted 17 July 2012 - 12:45 PM

I need to get a text in a textbox and assign each letter of that text to a different variable.Anyone know how to do this?
Is This A Good Question/Topic? 0
  • +

Replies To: Assigning each leter in a textbox to a different variable

#2 modi123_1  Icon User is offline

  • Suitor #2
  • member icon



Reputation: 6626
  • View blog
  • Posts: 23,984
  • Joined: 12-June 08

Re: Assigning each leter in a textbox to a different variable

Posted 17 July 2012 - 12:47 PM

What have you tried?
Was This Post Helpful? 0
  • +
  • -

#3 Raminator  Icon User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 219
  • Joined: 16-July 12

Re: Assigning each leter in a textbox to a different variable

Posted 17 July 2012 - 12:53 PM

View Postmodi123_1, on 17 July 2012 - 12:47 PM, said:

What have you tried?

I havent tryed anything yet i just need to do it but i cant think of anyway to do it i thougt of using arrays but couldnt manage to right anything.
Was This Post Helpful? 0
  • +
  • -

#4 Martyr2  Icon User is offline

  • Programming Theoretician
  • member icon

Reputation: 3911
  • View blog
  • Posts: 11,448
  • Joined: 18-April 07

Re: Assigning each leter in a textbox to a different variable

Posted 17 July 2012 - 12:57 PM

One thing you can play with is the idea that Strings have a method called "ToCharArray" which will take your string and put each character into a spot on an array. This will serve the purpose of each array spot being like a variable, plus it is easy to iterate, pull out single chars based on index and also gives you array properties like slicing etc.

http://msdn.microsof...y/ezftk57x.aspx

Won't need to create individual variables either. :)
Was This Post Helpful? 1
  • +
  • -

#5 Raminator  Icon User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 219
  • Joined: 16-July 12

Re: Assigning each leter in a textbox to a different variable

Posted 17 July 2012 - 12:59 PM

View PostMartyr2, on 17 July 2012 - 12:57 PM, said:

One thing you can play with is the idea that Strings have a method called "ToCharArray" which will take your string and put each character into a spot on an array. This will serve the purpose of each array spot being like a variable, plus it is easy to iterate, pull out single chars based on index and also gives you array properties like slicing etc.

http://msdn.microsof...y/ezftk57x.aspx

Won't need to create individual variables either. :)

Could you make a sample/example code please?
Was This Post Helpful? 0
  • +
  • -

#6 Martyr2  Icon User is offline

  • Programming Theoretician
  • member icon

Reputation: 3911
  • View blog
  • Posts: 11,448
  • Joined: 18-April 07

Re: Assigning each leter in a textbox to a different variable

Posted 17 July 2012 - 01:00 PM

How about you go to the MSDN link there where there is an example? Come on now, I think you are smart enough to figure out what it means by saying a string is put into an array of single characters ;)

This post has been edited by Martyr2: 17 July 2012 - 01:01 PM

Was This Post Helpful? 1
  • +
  • -

#7 Raminator  Icon User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 219
  • Joined: 16-July 12

Re: Assigning each leter in a textbox to a different variable

Posted 17 July 2012 - 01:02 PM

View PostMartyr2, on 17 July 2012 - 01:00 PM, said:

How about you go to the MSDN link there where there is an example? Come on now, I think you are smart enough to figure out what it means by saying a string is put into an array of single characters ;)

haha sorry im a big noob but ill try. thanks a lot
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1