6 Replies - 720 Views - Last Post: 12 November 2012 - 04:01 PM Rate Topic: -----

#1 robgw3  Icon User is offline

  • D.I.C Head

Reputation: -3
  • View blog
  • Posts: 138
  • Joined: 23-February 12

Creating an array based on text in textbox?

Posted 12 November 2012 - 02:15 PM

Is it possible to create an array based on the text a user enters into a textbox? Like if i enter "One" into a textbox then it makes an array called "One" if i enter "Two" then it makes an array called "Two" or do they need to be set in code?

[Note that i mean the name of the array not the data thats in it, i am well aware you can enter data from a textbox into an array so thats not what i am asking. Just realized that mistake might be made and wanted to clear that up.]

This post has been edited by robgw3: 12 November 2012 - 02:21 PM


Is This A Good Question/Topic? 0
  • +

Replies To: Creating an array based on text in textbox?

#2 tlhIn`toq  Icon User is offline

  • Please show what you have already tried when asking a question.
  • member icon

Reputation: 5537
  • View blog
  • Posts: 11,866
  • Joined: 02-June 10

Re: Creating an array based on text in textbox?

Posted 12 November 2012 - 02:46 PM

Could it somehow be done: Probably with a one of work and trickery.

But what would be the point? If the array name was dynamically created based on user input then how would your application code know how to use it?

More likely you want to make an object whose 'Name' property is whatever the user enters.
Was This Post Helpful? 0
  • +
  • -

#3 robgw3  Icon User is offline

  • D.I.C Head

Reputation: -3
  • View blog
  • Posts: 138
  • Joined: 23-February 12

Re: Creating an array based on text in textbox?

Posted 12 November 2012 - 03:25 PM

Yeah perhaps, trying to think of how to do something. Basically just a list of names, and each name has a list of other things connected to them. Well if that wont work i guess i will have to take some time to think about it and figure out how to do it.
Was This Post Helpful? 0
  • +
  • -

#4 macosxnerd101  Icon User is online

  • Self-Trained Economist
  • member icon




Reputation: 10596
  • View blog
  • Posts: 39,258
  • Joined: 27-December 08

Re: Creating an array based on text in textbox?

Posted 12 November 2012 - 03:39 PM

It sounds like you're describing a Graph. You could use something like a lookup table or Dictionary to relate keys (names) to values. I'm not a .NET guy, so maybe there is a more standards adherent Collection to use, but something similar to a Dictionary should get you going on the right track.
Was This Post Helpful? 0
  • +
  • -

#5 tlhIn`toq  Icon User is offline

  • Please show what you have already tried when asking a question.
  • member icon

Reputation: 5537
  • View blog
  • Posts: 11,866
  • Joined: 02-June 10

Re: Creating an array based on text in textbox?

Posted 12 November 2012 - 03:45 PM

View Postrobgw3, on 12 November 2012 - 04:25 PM, said:

Basically just a list of names, and each name has a list of other things connected to them.


Sounds like a class to me. Link to a tutorial in my signature block.
Was This Post Helpful? 0
  • +
  • -

#6 robgw3  Icon User is offline

  • D.I.C Head

Reputation: -3
  • View blog
  • Posts: 138
  • Joined: 23-February 12

Re: Creating an array based on text in textbox?

Posted 12 November 2012 - 03:50 PM

View PosttlhIn`toq, on 12 November 2012 - 10:45 PM, said:

View Postrobgw3, on 12 November 2012 - 04:25 PM, said:

Basically just a list of names, and each name has a list of other things connected to them.


Sounds like a class to me. Link to a tutorial in my signature block.



I know how to use classes and objects, just wasnt sure if an object would be the best choice for it. Especially since i would need multiple lists linked together.
Was This Post Helpful? 0
  • +
  • -

#7 tlhIn`toq  Icon User is offline

  • Please show what you have already tried when asking a question.
  • member icon

Reputation: 5537
  • View blog
  • Posts: 11,866
  • Joined: 02-June 10

Re: Creating an array based on text in textbox?

Posted 12 November 2012 - 04:01 PM

You really won't know until you try. Trial and error are the best teachers. We never learn so much about PLANNING as we discover after painting our selves into a corner.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1