[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now

x
?
Solved

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

Posted on 2004-09-29
7
Medium Priority
?
1,116 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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

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…
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
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
Suggested Courses

650 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