i've been looking for a way to do this for days now, i'm not very talented myself im quite new to VB but heres my prob.
i want to create a collection i think, or instances of a class or something like that, right now i have a class called 'Entity' with property 'keycomments' this is just one of the properties i have a few irrelevant ones.
when i click my button i want the text entered in KeyvalID to use as the name of my new instance of Entity, shown as follows:
Code:
If KeyvalID.Text = "" Then
MsgBox ("You must enter an ID.")
End If
Dim temp
temp = KeyvalID.Text
Dim bla(temp) As New Entity
'in a function later on this lower section will happen
'and for now it assumes the KeyvalID.Text earlier was "npc_roll"
bla(npc_roll).keycomments = "It Works!"
KeyvalComments.Text = bla(npc_roll).keycomments 'this is on screen for the user to see.
i know this doesnt work because i have to have a constant expression when making the bla(temp), and 'temp' is not constant, but how can i go about achieving this, all i want is the ability to type
Code:
bla(npc_roll).keycomments = "It Works!"
i have to be able to create an instance of the class Entity with the name of the users choice.
also if i'm going to have to use a collection, can you explain very carefully because no matter how much i look at tutorials and examples on MSDN or other sites, i just cant figure them out! for a start i cant type
Code:
public class bla
...
end class
it doesnt allow any of it.
i'm just totally stumped on making collections.
Read on if your willing to help find an alternative

:
if theres an alternative you can think of then i'll be just as happy, i'm taking a few values that have been entered and trying to store them for saving later on. there can be any number of them and each will have a few values inside, some wont include some of the values, and in a special case, some will need to create extras (called Choice1, Choice2, Choice3... etc.) if possible i'd also like to create all these inside other classes, for example:
No1.ID
No1.Name
No1.Keyvals.1.ID
No1.Keyvals.1.Name
No1.Keyvals.1.Comments
No1.Keyvals.2.ID
No2.ID
...
this is basically the exact system i want. i just dont have the skill to do it, and i cant find out how to create something like keyvals, where it has a second or third list of properties inside it.
sorry for the long post.