?
Solved

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

Posted on 2004-09-29
7
Medium Priority
?
1,094 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
7 Comments
 
LVL 10

Accepted Solution

by:
123654789987 earned 500 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 500 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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Extention Methods in C# 3.0 by Ivo Stoykov C# 3.0 offers extension methods. They allow extending existing classes without changing the class's source code or relying on inheritance. These are static methods invoked as instance method. This…
This article aims to explain the working of CircularLogArchiver. This tool was designed to solve the buildup of log file in cases where systems do not support circular logging or where circular logging is not enabled
In this video we outline the Physical Segments view of NetCrunch network monitor. By following this brief how-to video, you will be able to learn how NetCrunch visualizes your network, how granular is the information collected, as well as where to f…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…
Suggested Courses
Course of the Month12 days, 18 hours left to enroll

777 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