Results 1 to 2 of 2

Thread: using Guid struct as a variable

  1. #1

    Thread Starter
    Member upstream's Avatar
    Join Date
    Jun 2007
    Location
    Philippines
    Posts
    48

    Exclamation using Guid struct as a variable

    Hi everyone,

    Im using C# 2008. I have a problem wherein i wanted to use the System.Guid as a variable. is this possible? because im having a hard time trying to figure out how to assigned a value to that variable.

    Check this out guys:
    Code:
        public partial class FrmLogin : Form
        {
            private static Guid prv_FormID;
    
            public FrmLogin()
            {
                InitializeComponent();
            }
    
            /// <summary>
            /// Guid of this form
            /// </summary>
            public static Guid FormID
            {
                get
                {
                    return prv_FormID;
                }
            }
    i want to assign a predefined value to the prv_FormID

    something like this:
    Code:
        public partial class FrmLogin : Form
        {
            private static Guid prv_FormID = "5c95ad91-24f9-4ad6-a5c2-b192daa48953";
    
            public FrmLogin()
            {
                InitializeComponent();
            }
    
            /// <summary>
            /// Guid of this form
            /// </summary>
            public static Guid FormID
            {
                get
                {
                    return prv_FormID;
                }
            }
    but of course its wrong. because its a string and not a Guid.

    Please help! i really appreciate if someone can give me some flash light on this problem

  2. #2
    Software Carpenter dee-u's Avatar
    Join Date
    Feb 2005
    Location
    Pinas
    Posts
    11,127

    Re: using Guid struct as a variable

    Try it like this.
    Code:
    private static Guid prv_FormID = new Guid("5c95ad91-24f9-4ad6-a5c2-b192daa48953");
    Regards,


    As a gesture of gratitude please consider rating helpful posts. c",)

    Some stuffs: Mouse Hotkey | Compress file using SQL Server! | WPF - Rounded Combobox | WPF - Notify Icon and Balloon | NetVerser - a WPF chatting system

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