Solved

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

Posted on 2004-09-29
7
957 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

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

Introduction This article series is supposed to shed some light on the use of IDisposable and objects that inherit from it. In essence, a more apt title for this article would be: using (IDisposable) {}. I’m just not sure how many people would ge…
Summary: Persistence is the capability of an application to store the state of objects and recover it when necessary. This article compares the two common types of serialization in aspects of data access, readability, and runtime cost. A ready-to…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

708 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

13 Experts available now in Live!

Get 1:1 Help Now