Go Back  Xtreme Visual Basic Talk > Legacy Visual Basic (VB 4/5/6) > General > Enumerating Valid Data Type


Reply
 
Thread Tools Display Modes
  #1  
Old 04-09-2004, 02:18 AM
Shimms Shimms is offline
Newcomer
 
Join Date: Jul 2003
Posts: 14
Default Enumerating Valid Data Type


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
Reply With Quote
  #2  
Old 04-09-2004, 09:49 AM
LaVolpe's Avatar
LaVolpe LaVolpe is offline
Ultimate Contributor

* Expert *
 
Join Date: Apr 2004
Location: Illinois
Posts: 2,499
Default

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.
Reply With Quote
  #3  
Old 04-09-2004, 09:54 AM
Mathijsken's Avatar
Mathijsken Mathijsken is offline
Contributor
 
Join Date: May 2003
Location: Oostkamp - Belgium
Posts: 730
Default

Make an array of a custom type like so:
Code:
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
__________________
Fear is the first step towards intolerance.
Reply With Quote
  #4  
Old 04-09-2004, 10:20 AM
Shimms Shimms is offline
Newcomer
 
Join Date: Jul 2003
Posts: 14
Default

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
Reply With Quote
  #5  
Old 04-10-2004, 04:22 AM
Mathijsken's Avatar
Mathijsken Mathijsken is offline
Contributor
 
Join Date: May 2003
Location: Oostkamp - Belgium
Posts: 730
Default

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
__________________
Fear is the first step towards intolerance.
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
its me agian with another q basic question computerkid Miscellaneous Languages 5 04-05-2004 02:56 PM
Tutorial on Editing, Inserting and Displaying data using Datasets Denaes .NET Database and Reporting 0 03-16-2004 12:02 AM
Date/time Data type CraigKyson General 2 10-24-2002 09:34 PM
case study problem dfdfsfer Database and Reporting 3 04-18-2001 07:02 AM

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
 
 
-->