Mark_FreeSoftware
asked on
Enum and string?
what i want is this:
Public Enum Con_Com
rcon_login = "rcon login"
rcon_serverinfo = "rcon serverinfo"
rcon_systeminfo = "rcon systeminfo"
rcon_status = "rcon status"
rcon_exec = "rcon_exec "
rcon_writeconfig = "rcon writeconfig "
rcon_say = "rcon say "
End Enum
but that gives me an error
how should i do this?
The values inside the enum must map to Long integers
E.g.
Public Enum Con_Com
rcon_login = 1
rcon_serverinfo = 2
rcon_systeminfo = 3
rcon_status = 4
rcon_exec = 5
rcon_writeconfig = 6
rcon_say = 7
End Enum
You can then use a Select Case statement to convert the number to the string equivalent where you use the Con_Com type
E.g.
Public Enum Con_Com
rcon_login = 1
rcon_serverinfo = 2
rcon_systeminfo = 3
rcon_status = 4
rcon_exec = 5
rcon_writeconfig = 6
rcon_say = 7
End Enum
You can then use a Select Case statement to convert the number to the string equivalent where you use the Con_Com type
you can use array instead
i.e.
Dim arr
arr = Array("rcon login", "rcon serverinfo", "rcon systeminfo", _
"rcon status", "rcon_exec", "rcon writeconfig", "rcon say")
Debug.Print arr(1)
i.e.
Dim arr
arr = Array("rcon login", "rcon serverinfo", "rcon systeminfo", _
"rcon status", "rcon_exec", "rcon writeconfig", "rcon say")
Debug.Print arr(1)
ASKER
yeah, but then it doesnt act like i want,
i want it to act like a boolean,
it pops up, and when you select true or false it prints that in the vb IDE.
but since i have spaces in it, this didnt work with a normal enum
now i try to find another way...
Maybe you need to do this with a class??
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
clsRcon.cls not clsRcon.bas
ASKER
is that the only way?
that I know of.... are u used to object oriented (kinda) vb6?
You can do allot that way....
You can do allot that way....
ASKER
>>are u used to object oriented (kinda) vb6?
can you explain that a little?
i do have 2.5 years vb experience if that's what you asking...
can you explain that a little?
i do have 2.5 years vb experience if that's what you asking...
Thats quite a topic... There are many examples on the web ex. http://www.insteptech.com/techlibrary/vbclassic/vb6_oo.htm
Although vb6 is not object oriented you can come very close. There are many benifits for example you can have objects save thiere childeren and so you only have to save the parent.
If and when you move to vb.net you will be forced into a object oriented stype of programming....
Check it out, once you 'get-it' there is not other way to go...
Although vb6 is not object oriented you can come very close. There are many benifits for example you can have objects save thiere childeren and so you only have to save the parent.
If and when you move to vb.net you will be forced into a object oriented stype of programming....
Check it out, once you 'get-it' there is not other way to go...
ASKER
thanks!
then i'm going for the class.
then i'm going for the class.
Its actually quite easy once you get the idea... Its worth you time to figure it out...
It will also give you insight as to how many of the vb objects work...
It will also give you insight as to how many of the vb objects work...
Public Enum Con_Com
rcon_login = 0
rcon_serverinfo = 1
rcon_status = 2
rcon_exec = 3
rcon_writeconfig = 4
rcon_say = 5
End Enum