Solved

DefInstance(Default Instance) Property for form in c#(Urgent Requirment)

Posted on 2004-09-29
7
1,023 Views
Last Modified: 2012-08-14
Please tell me how to create a definstance  for a form  in C# (I have the code  in VB.NET)
 I tried the following code but it gives build error - 'Not all paths return a value'
-------------------------------------------------------------------------------------------------------------------------------------------
                              private static  frm_CSGeoCommand m_CSFormDefInstance  ;
            private static Boolean m_InitializingDefInstance  ;
            public  frm_CSGeoCommand  DefInstance
            {
                  get
                  {
                        if (m_CSFormDefInstance == null |  m_CSFormDefInstance.IsDisposed )
                        {
                              m_InitializingDefInstance = true;
                              m_CSFormDefInstance = new frm_CSGeoCommand();
                               m_InitializingDefInstance = false;      
                              
                        }
                        DefInstance  = m_CSFormDefInstance;
                  }
                  set
                  {
                        m_CSFormDefInstance = value;
                  }
                  
                        
            }

---------------------------------------------------------------------------------------------------------------------------------------------

**************************************************************************************
   Also what is the C# equivalent of the VB.NET code -  System.Reflection.Assembly.GetExecutingAssembly.EntryPoint.DeclaringType
**************************************************************************************

    if you want to see the complete  form sourcecode, it  is available at http://www.geocities.com/samsonks/frm_CSGeoCommand.txt
 
             Thanks
   
0
Comment
Question by:sgs1970
  • 2
7 Comments
 
LVL 10

Accepted Solution

by:
123654789987 earned 125 total points
ID: 12178583
u have to make a change


public  frm_CSGeoCommand  DefInstance
          {
               get
               {
                    if (m_CSFormDefInstance == null |  m_CSFormDefInstance.IsDisposed )
                    {
                         m_InitializingDefInstance = true;
                         m_CSFormDefInstance = new frm_CSGeoCommand();
                          m_InitializingDefInstance = false;    
                         
                    }
                    DefInstance  = m_CSFormDefInstance;
                   return DefInstance ; // A get should return a value
               }
               set
               {
                    m_CSFormDefInstance = value;  
               }
               
                   
          }
0
 
LVL 18

Assisted Solution

by:armoghan
armoghan earned 125 total points
ID: 12178584
System.Reflection.Assembly.GetExecutingAssembly.EntryPoint.DeclaringType
=
System.Reflection.Assembly.GetExecutingAssembly().EntryPoint.DeclaringType
0
 
LVL 96

Expert Comment

by:Bob Learned
ID: 12182262
Aaah, the return :)  Very good!!!

Bob
0
 
LVL 18

Expert Comment

by:armoghan
ID: 12460726
split armoghan, 123654789987
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Suggested Solutions

Article by: Ivo
C# And Nullable Types Since 2.0 C# has Nullable(T) Generic Structure. The idea behind is to allow value type objects to have null values just like reference types have. This concerns scenarios where not all data sources have values (like a databa…
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
This Micro Tutorial will give you a basic overview how to record your screen with Microsoft Expression Encoder. This program is still free and open for the public to download. This will be demonstrated using Microsoft Expression Encoder 4.
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …

813 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

Need Help in Real-Time?

Connect with top rated Experts

8 Experts available now in Live!

Get 1:1 Help Now