Shimms
04-09-2004, 02:18 AM
Hello all,
I'm trying to find a way to display a list of all available data type that an object can be declared as.
I'm creating an Add-In for UML design, and in the function/sub designer I need to be able to select from available datatypes for return types and argument types.
Any help would be much appreciated,
Shimms
LaVolpe
04-09-2004, 09:49 AM
Refer to your VB help files & look at TypeOf and VarType. The latter does what I think you are asking. VarTypes can be combined (i.e., a byte array is vbByte OR vbArray). Now if you want types of objects too, good luck. You'll never be able to test for all of them (i.e., status bars, flex grids, etc). However, VB's TypeOf would do most of the work for things like labels, textboxes, checkboxes, etc.
Mathijsken
04-09-2004, 09:54 AM
Make an array of a custom type like so:
Private Type AvVar
Name as String
'other stuff like size, where it can be used, ...
End Type
Dim AvaibleVars() as AvVar
then you can still add and delete certain types during runtime and use the custom type to determine the specifications for each variable
Mathijsken
Shimms
04-09-2004, 10:20 AM
Sorry, I didn't explain it too well.
What I want is a list of all available data types that are currently present on the system. Primitive data types and complex types.
For instance, when you type:
Dim myVar As[space] the list of data types pops up. I want to be able to generate my own list of these types for the end user to select from.
Thanks again
Mathijsken
04-10-2004, 04:22 AM
Okay, if I'm getting this right, you want to have such a list like VB gives you after typing As ... ?
With the type I suggested this should work. Simply loop through al the items in that custom type and put their names in the drop-down list.
Then when the user selects one, you should use a 'select case'-statement to determine what type it was.
That's how I would do it, but there could be an other way...
Mathijsken