Solved

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

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Performance  Html.BeginForm vs jQuery 3 50
Different Delete Messages 7 37
Entity Framework 7 32
Close form "before" open 3 25
Article by: Najam
Having new technologies does not mean they will completely replace old components.  Recently I had to create WCF that will be called by VB6 component.  Here I will describe what steps one should follow while doing so, please feel free to post any qu…
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!
Windows 10 is mostly good. However the one thing that annoys me is how many clicks you have to do to dial a VPN connection. You have to go to settings from the start menu, (2 clicks), Network and Internet (1 click), Click VPN (another click) then fi…
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).

920 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

17 Experts available now in Live!

Get 1:1 Help Now