CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 7 of 7
  1. #1
    Join Date
    May 2013
    Posts
    5

    c# code not executing

    Hello People!

    I have been having a very hard time trying to run a piece of code that I downloaded. I thought it would be best to take a screenshot of it so people can help.

    Name:  charles.jpg
Views: 4972
Size:  96.0 KB

    Can someone please tell me how I can overcome this problem and get it running please.

  2. #2
    Join Date
    Oct 2006
    Location
    Sweden
    Posts
    3,654

    Re: c# code not executing

    Just follow the instructions given in the dialog i.e. add an executable to the project.
    Debugging is twice as hard as writing the code in the first place.
    Therefore, if you write the code as cleverly as possible, you are, by
    definition, not smart enough to debug it.
    - Brian W. Kernighan

    To enhance your chance's of getting an answer be sure to read
    http://www.codeguru.com/forum/announ...nouncementid=6
    and http://www.codeguru.com/forum/showthread.php?t=366302 before posting

    Refresh your memory on formatting tags here
    http://www.codeguru.com/forum/misc.php?do=bbcode

    Get your free MS compiler here
    https://visualstudio.microsoft.com/vs

  3. #3
    Join Date
    May 2013
    Posts
    5

    Re: c# code not executing

    Quote Originally Posted by S_M_A View Post
    Just follow the instructions given in the dialog i.e. add an executable to the project.
    Hi SMA. I'm a beginner in c# but I want to see this code in action. How do I add an executable to the project?
    Again sorry this is very trivial for you.

  4. #4
    Join Date
    Oct 2006
    Location
    Sweden
    Posts
    3,654

    Re: c# code not executing

    Right-click on your solution (in the solution explorer), select add new project and make that project be an exe project (console or form). From the new project call/use what's public in your class library.

    Edit: Oh! Now I see that you have a main in your code so your project is probably just set up wrong. Select properties instead and in Application change the project type to console.
    Last edited by S_M_A; May 26th, 2013 at 03:42 PM.
    Debugging is twice as hard as writing the code in the first place.
    Therefore, if you write the code as cleverly as possible, you are, by
    definition, not smart enough to debug it.
    - Brian W. Kernighan

    To enhance your chance's of getting an answer be sure to read
    http://www.codeguru.com/forum/announ...nouncementid=6
    and http://www.codeguru.com/forum/showthread.php?t=366302 before posting

    Refresh your memory on formatting tags here
    http://www.codeguru.com/forum/misc.php?do=bbcode

    Get your free MS compiler here
    https://visualstudio.microsoft.com/vs

  5. #5
    Join Date
    May 2013
    Posts
    5

    Re: c# code not executing

    Quote Originally Posted by S_M_A View Post
    Right-click on your solution (in the solution explorer), select add new project and make that project be an exe project (console or form). From the new project call/use what's public in your class library.
    Hi. I clicked on 'Start as new project' but this comes up when I execute it:

    'GATest.vshost.exe' (Managed (v2.0.50727)): Loaded 'C:\Windows\assembly\GAC_64\mscorlib\2.0.0.0__b77a5c561934e089\mscorlib.dll'
    'GATest.vshost.exe' (Managed (v2.0.50727)): Loaded 'C:\Windows\assembly\GAC_MSIL\Microsoft.VisualStudio.HostingProcess.Utilities\11.0.0.0__b03f5f7f11d50a3a\Microsoft.VisualStudio.HostingProcess.Utilities.dll'
    'GATest.vshost.exe' (Managed (v2.0.50727)): Loaded 'C:\Windows\assembly\GAC_MSIL\System.Windows.Forms\2.0.0.0__b77a5c561934e089\System.Windows.Forms.dll'
    'GATest.vshost.exe' (Managed (v2.0.50727)): Loaded 'C:\Windows\assembly\GAC_MSIL\System\2.0.0.0__b77a5c561934e089\System.dll'
    'GATest.vshost.exe' (Managed (v2.0.50727)): Loaded 'C:\Windows\assembly\GAC_MSIL\System.Drawing\2.0.0.0__b03f5f7f11d50a3a\System.Drawing.dll'
    'GATest.vshost.exe' (Managed (v2.0.50727)): Loaded 'C:\Windows\assembly\GAC_MSIL\Microsoft.VisualStudio.HostingProcess.Utilities.Sync\11.0.0.0__b03f5f7f11d50a3a\Microsoft.VisualStudio.HostingProcess.Utilities.Sync.dll'
    'GATest.vshost.exe' (Managed (v2.0.50727)): Loaded 'C:\Windows\assembly\GAC_MSIL\Microsoft.VisualStudio.Debugger.Runtime\11.0.0.0__b03f5f7f11d50a3a\Microsoft.VisualStudio.Debugger.Runtime.dll'
    'GATest.vshost.exe' (Managed (v2.0.50727)): Loaded 'C:\Users\Imran\Desktop\btl_GA2\GATest\bin\Debug\GATest.vshost.exe'
    'GATest.vshost.exe' (Managed (v2.0.50727)): Loaded 'C:\Windows\assembly\GAC_64\System.Data\2.0.0.0__b77a5c561934e089\System.Data.dll'
    'GATest.vshost.exe' (Managed (v2.0.50727)): Loaded 'C:\Windows\assembly\GAC_MSIL\System.Xml\2.0.0.0__b77a5c561934e089\System.Xml.dll'
    The thread 'vshost.NotifyLoad' (0x2fa8) has exited with code 0 (0x0).
    The thread 'vshost.LoadReference' (0x2a28) has exited with code 0 (0x0).
    'GATest.vshost.exe' (Managed (v2.0.50727)): Loaded 'C:\Users\Imran\Desktop\btl_GA2\GATest\bin\Debug\GATest.exe', Symbols loaded.
    'GATest.vshost.exe' (Managed (v2.0.50727)): Loaded 'C:\Users\Imran\Desktop\btl_GA2\GATest\bin\Debug\GeneticAlgorithm.dll', Symbols loaded.
    The thread 'vshost.RunParkingWindow' (0x2a70) has exited with code 0 (0x0).
    The thread '<No Name>' (0x27ec) has exited with code 0 (0x0).
    The program '[9592] GATest.vshost.exe: Managed (v2.0.50727)' has exited with code 0 (0x0).
    The program '[9592] GATest.vshost.exe: Program Trace' has exited with code 0 (0x0).

  6. #6
    Join Date
    May 2013
    Posts
    5

    Re: c# code not executing

    Thank you very much sma - it worked!

  7. #7
    Join Date
    Oct 2006
    Location
    Sweden
    Posts
    3,654

    Re: c# code not executing

    That output isn't anything to be worried about. It's just informing you what other code that is loaded when you execute your application.
    Debugging is twice as hard as writing the code in the first place.
    Therefore, if you write the code as cleverly as possible, you are, by
    definition, not smart enough to debug it.
    - Brian W. Kernighan

    To enhance your chance's of getting an answer be sure to read
    http://www.codeguru.com/forum/announ...nouncementid=6
    and http://www.codeguru.com/forum/showthread.php?t=366302 before posting

    Refresh your memory on formatting tags here
    http://www.codeguru.com/forum/misc.php?do=bbcode

    Get your free MS compiler here
    https://visualstudio.microsoft.com/vs

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured