CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Mar 2002
    Location
    Colorado
    Posts
    105

    Property Bag Conversion

    Hi,

    I have some converted VB 6 to C# code that used the property bag to store user control settings. How can I convert the following the read statement to correctly work:

    Code:
    private void  userControl_ReadProperties( UpgradeStubs.VBRUN_PropertyBag propbag)
    {
           					
    		//UPGRADE_ISSUE: (2064) PropertyBag method PropBag.ReadProperty was not upgraded. More Information: http://www.vbtonet.com/ewis/ewi2064.aspx
    		this.Color = ColorTranslator.FromOle(DefaultPropHelper.GetDefaultProperty<int>(propbag.ReadProperty("Color", ColorTranslator.ToOle(K_DEFAULT_COLOR))));
    
    		//UPGRADE_ISSUE: (2064) PropertyBag method PropBag.ReadProperty was not upgraded. More Information: http://www.vbtonet.com/ewis/ewi2064.aspx
    		Enabled = DefaultPropHelper.GetDefaultProperty<bool>(propbag.ReadProperty("Enabled", true));
    
    		//UPGRADE_WARNING: (6021) Casting 'Variant' to Enum may cause different behaviour. More Information: http://www.vbtonet.com/ewis/ewi6021.aspx
    		//UPGRADE_ISSUE: (2064) PropertyBag method PropBag.ReadProperty was not upgraded. More Information: http://www.vbtonet.com/ewis/ewi2064.aspx
    
    		Direction = (enDirection) DefaultPropHelper.GetDefaultProperty<int>(propbag.ReadProperty("Direction", true));
    
    }
    Thanks,

    LB
    Last edited by lbargers; February 22nd, 2010 at 06:00 PM.

  2. #2
    Join Date
    Mar 2005
    Location
    Vienna, Austria
    Posts
    4,538

    Re: Property Bag Conversion

    Quote Originally Posted by lbargers View Post
    Hi,

    I have some converted VB 6 to C# code that used the property bag to store user control settings. How can I convert the following the read statement to correctly work:...
    Simple create a class for your data and store that class using XML Reader/Writer this will save the data in a textfile and you can reload them when starting the program. You also may use the settings for your data and simple use
    Code:
    Properties.Settings.Default.Save(); 
    
    This should not be too complicated at way.
    Jonny Poet

    To be Alive is depending on the willingsness to help others and also to permit others to help you. So lets be alive. !
    Using Code Tags makes the difference: Code is easier to read, so its easier to help. Do it like this: [CODE] Put Your Code here [/code]
    If anyone felt he has got help, show it in rating the post.
    Also dont forget to set a post which is fully answered to 'resolved'. For more details look to FAQ's about Forum Usage. BTW I'm using Framework 3.5 and you ?
    My latest articles :
    Creating a Dockable Panel-Controlmanager Using C#, Part 1 | Part 2 | Part 3 | Part 4 | Part 5 | Part 6 | Part 7

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured