Hello Guest, please login or register.
Did you miss your activation email?
Login with username, password and session length.

Pages: [1]   Go Down

Author Topic: RESOLVED: [C#] Using string array values in lists  (Read 1153 times)

0 Members and 1 Guest are viewing this topic.
RESOLVED: [C#] Using string array values in list...
« on: August 19, 2006, 09:30:56 pm »
  • You're the yellow bird that I've been waiting for.
  • *
  • Reputation: +0/-0
  • Offline Offline
  • Gender: Male
  • Posts: 242
Is it possible to use value of a string array as the names of the items? If so, can someone explain to me how to do it, because I can't seem to figure it out :/
« Last Edit: August 19, 2006, 10:10:24 pm by brighteyes »
Logged
Re: [C#] Variable Names in a list
« Reply #1 on: August 19, 2006, 09:41:22 pm »
  • *
  • Reputation: +3/-0
  • Offline Offline
  • Gender: Male
  • Posts: 6629
Variable names as item names O_o, sorry could you give me an example of what you mean?

Edit: Sorry, even with your edit that dosen't make sense, could you post some example code of what you want?
« Last Edit: August 19, 2006, 09:43:12 pm by Helios »
Logged
Re: [C#] Need Help: Using string array values in...
« Reply #2 on: August 19, 2006, 09:44:32 pm »
  • You're the yellow bird that I've been waiting for.
  • *
  • Reputation: +0/-0
  • Offline Offline
  • Gender: Male
  • Posts: 242
Well I'm making a card maker for YVD, and I want to have a sort of card selector (the list). However instead of simply displaying "Card1" or something like that I want it to display the card's name which has been stored in an array.
Logged
Re: [C#] Need Help: Using string array values in...
« Reply #3 on: August 19, 2006, 09:48:04 pm »
  • *
  • Reputation: +3/-0
  • Offline Offline
  • Gender: Male
  • Posts: 6629
Sorry I still haven't a clue what you mean. Do you mean you want to add a string to a list then get it back out of the list and display its value? Or do you mean an array of bytes you want to display as a string? Or do you mean you want to display a string element of an array?

Edit: Is this what you mean?
Code: [Select]
string[] cardNames = new string[3] { "CardA", "CardB", "CardC" }
int myCurrentCard = 1;
Console.WriteLine("My current card's name is {0}", cardNames[myCurrentCard]);
« Last Edit: August 19, 2006, 09:54:09 pm by Helios »
Logged
Re: [C#] Need Help: Using string array values in...
« Reply #4 on: August 19, 2006, 09:58:52 pm »
  • You're the yellow bird that I've been waiting for.
  • *
  • Reputation: +0/-0
  • Offline Offline
  • Gender: Male
  • Posts: 242

See that big white box in the bottom right hand corner of the program. That is a list with selectable items in it. When you create the list, you can also edit it's collection of items. In this case, I would like it to list all of the cards that the creator has made thus far. Clicking on the card will allow the creator to view and edit that cards. All of the cards' names are stored into a string array. My problem is that in the collection editor I can only enter plain text, but I want to enter the the variables to display the cards' names rather than a predefined unchangable text. Does that clear things up at all?
Logged
Re: [C#] Need Help: Using string array values in...
« Reply #5 on: August 19, 2006, 10:05:01 pm »
  • *
  • Reputation: +3/-0
  • Offline Offline
  • Gender: Male
  • Posts: 6629
Yep thanks, and no its not possible to display a variables name without reflection. You have to realise to the compiler all a variable is, is a stack index or heap index, the identifier is just for ease of use, its never actually stored in the compiled code.
« Last Edit: August 19, 2006, 10:07:27 pm by Helios »
Logged
Re: [C#] Need Help: Using string array values in...
« Reply #6 on: August 19, 2006, 10:09:40 pm »
  • You're the yellow bird that I've been waiting for.
  • *
  • Reputation: +0/-0
  • Offline Offline
  • Gender: Male
  • Posts: 242
 Phooey :'(. I guess it's better that I know now, and didn't spend hours trying to figure out though. Well, thanks for your help :]
Logged
Pages: [1]   Go Up

 


Contact Us | Legal | Advertise Here
2013 © ZFGC, All Rights Reserved



Page created in 0.416 seconds with 51 queries.