[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now

x
?
Solved

How to interpret the object returned from PropInfo.GetValue()

Posted on 2003-12-11
3
Medium Priority
?
390 Views
Last Modified: 2010-04-16

I'd like to save the results of the PropInfo.GetValue() to a file and use it later to recreate a form.  I'm having difficulties dealing with the variations of the object type returned by the method.  How does the PropertyGrid class enumerate the properties and determine the valid options?
 
 
0
Comment
Question by:nlwelch
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 9

Expert Comment

by:malharone
ID: 9930612
what's PropInfo
0
 

Author Comment

by:nlwelch
ID: 9930700
Sorry

System.Reflection.PropertyInfo
0
 
LVL 9

Accepted Solution

by:
malharone earned 1500 total points
ID: 9930823
this is general way for saving to file

    Public Sub readFromFile()
        Dim fs1 As New System.IO.FileStream("c:\file.txt", IO.FileMode.OpenOrCreate)
        Dim obj As Object
        Dim BinFormatter As New BinaryFormatter()
        obj = CType(BinFormatter.Deserialize(fs1), Object)
        '-- do obj.getType to get the object's type
        myPropInfo = obj
        fs1.Close()
    End Sub

    Public Sub writeToFile()
        Dim obj as Object
        Dim FS1 As New System.IO.FileStream("c:\file.txt", IO.FileMode.Create)
        Dim BinFormatter As New BinaryFormatter()
        BinFormatter.Serialize(FS1, myPropInfo.getValue(...))
        FS1.Close()
    End Sub


----

once you get the propInfo object, you can call propInfo.getValue(...).getType '<-- this will tell you the type of the object returned by the getValue method.
0

Featured Post

Ask an Anonymous Question!

Don't feel intimidated by what you don't know. Ask your question anonymously. It's easy! Learn more and upgrade.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Entity Framework is a powerful tool to help you interact with the DataBase but still doesn't help much when we have a Stored Procedure that returns more than one resultset. The solution takes some of out-of-the-box thinking; read on!
This article aims to explain the working of CircularLogArchiver. This tool was designed to solve the buildup of log file in cases where systems do not support circular logging or where circular logging is not enabled
Please read the paragraph below before following the instructions in the video — there are important caveats in the paragraph that I did not mention in the video. If your PaperPort 12 or PaperPort 14 is failing to start, or crashing, or hanging, …
In a question here at Experts Exchange (https://www.experts-exchange.com/questions/29062564/Adobe-acrobat-reader-DC.html), a member asked how to create a signature in Adobe Acrobat Reader DC (the free Reader product, not the paid, full Acrobat produ…

650 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question