Click here to Skip to main content
15,918,050 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I've been using structures for storing Prgs settings and so far everything is working nicley- Now I'm in the process of improving some of my error handling and I stumbled over the following "problem" I'm not able to figure out ..
I'm trying to read out the type of the variable held in the structure ( Boolean, string, int ..)

Below code is just as a non working sample of how I initalize the structures today(obvosuly my structures are working just fine )

If I try to read the Typename on my structure
, I get an exeption ???
How can I read the typename off my structure variable ?? What am I missing ??
tyypname is working just fine on a my normal varible

 Dim D_string As String
Public Module T_structures
        Public ST As S_T
        Public Structure S_T
        Public S_string as string
        End Structure
    End Module
Updated 12-Sep-11 21:05pm

1 solution

Does it give any error?
I found this to be wrong. Check if it is a typo, or error in code. It should be
Public S_string as string
Share this answer
Georg Kohler 13-Sep-11 3:15am    
Correct -It's just a typo
I think I also have to rework the question a bit ...
The main thing is not for the Structure to work - The question is why I can not read out the Variable type befor I assigned anything to it ...
It seems once I assigne a value to the variable it works ...
As I'm loading Config values I would like to know forhand what Type can be accepted by the variable.
Prerak Patel 13-Sep-11 3:21am    
What exception do you get?
Georg Kohler 13-Sep-11 3:33am    
Actually I just realized that It's not throwing an exeption at that point
It just reads out Nothing ( As nothing has been assigned) The exeption happend when I tried to compare it to a Type.. (sloppy me ..sorry)
Do you have any ideas what to use to read out the Type of the variable ?? (I've tried typof and son on and so on) TypeName just seemed the logical thing to use - but it looks like it won't work for Structures??

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900