Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. C# Sucks!

C# Sucks!

Scheduled Pinned Locked Moved C#
csharpc++visual-studiojsontutorial
5 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    Stober
    wrote on last edited by
    #1

    [rant]I've only been at it for about an hour and already don't like it! I'm a long c++ programmer, MFC -- MS-Windows. All I want is a form with an edit box where you can type in a filename and a button that will let you browse for the filename. In C++ I would simply use VC++ 6.0 to create an MFC project, create and initialize an object of type OPENFILENAME, then call the win32 api function. Simple. Without knowing better, using Visual Studio .NET 2003 I created a windows C# project, made the form like I wanted (that was pretty intuitive) then clicked the button on the form to get the event handler. There, everything goes to hell in a handbag. The compiler knows nothing about OPENFILENAME structure. So I downloaded the sample C# tutorial project from codeproject. I can't believe the kind of hell C# programmers have to go through just to do one simple call to a Win32 api function.:( Its enough to make me throw in the towel and use C++ instead.[/rant] Isn't there an easier way to accomplish this? -- modified at 17:34 Friday 23rd September, 2005

    A M 2 Replies Last reply
    0
    • S Stober

      [rant]I've only been at it for about an hour and already don't like it! I'm a long c++ programmer, MFC -- MS-Windows. All I want is a form with an edit box where you can type in a filename and a button that will let you browse for the filename. In C++ I would simply use VC++ 6.0 to create an MFC project, create and initialize an object of type OPENFILENAME, then call the win32 api function. Simple. Without knowing better, using Visual Studio .NET 2003 I created a windows C# project, made the form like I wanted (that was pretty intuitive) then clicked the button on the form to get the event handler. There, everything goes to hell in a handbag. The compiler knows nothing about OPENFILENAME structure. So I downloaded the sample C# tutorial project from codeproject. I can't believe the kind of hell C# programmers have to go through just to do one simple call to a Win32 api function.:( Its enough to make me throw in the towel and use C++ instead.[/rant] Isn't there an easier way to accomplish this? -- modified at 17:34 Friday 23rd September, 2005

      A Offline
      A Offline
      Anonymous
      wrote on last edited by
      #2

      There most certainly is an easier way to do it and it's approximately 1700 times faster. If you ask nicely, I might even tell you about it

      S 1 Reply Last reply
      0
      • A Anonymous

        There most certainly is an easier way to do it and it's approximately 1700 times faster. If you ask nicely, I might even tell you about it

        S Offline
        S Offline
        Stober
        wrote on last edited by
        #3

        Pretty-please :laugh: I suppose I probably should buy a book about C#.:->

        L 1 Reply Last reply
        0
        • S Stober

          [rant]I've only been at it for about an hour and already don't like it! I'm a long c++ programmer, MFC -- MS-Windows. All I want is a form with an edit box where you can type in a filename and a button that will let you browse for the filename. In C++ I would simply use VC++ 6.0 to create an MFC project, create and initialize an object of type OPENFILENAME, then call the win32 api function. Simple. Without knowing better, using Visual Studio .NET 2003 I created a windows C# project, made the form like I wanted (that was pretty intuitive) then clicked the button on the form to get the event handler. There, everything goes to hell in a handbag. The compiler knows nothing about OPENFILENAME structure. So I downloaded the sample C# tutorial project from codeproject. I can't believe the kind of hell C# programmers have to go through just to do one simple call to a Win32 api function.:( Its enough to make me throw in the towel and use C++ instead.[/rant] Isn't there an easier way to accomplish this? -- modified at 17:34 Friday 23rd September, 2005

          M Offline
          M Offline
          Mohamad Al Husseiny
          wrote on last edited by
          #4

          To Browse for files use OpenFileDialog you will find it in the toolbox after that ypu can write some thing like

          openFileDialog1.InitialDirectory = "c:\\" ;
          openFileDialog1.Filter = "CSharp files (*.cs)|*.cs" ;
          if (openFileDialog1.ShowDialog() == DialogResult.OK)
              {
                 // do your work here
                 //OpenFileDialog have properties and method that    wil let yo work with file like get file name,opern it..etc
          
              }
          For More info look at OpenFileDialog Class[^]
          

          If you really missed Windows API Function that you did not find counterpart in .Net You can use it By using P/Invoke which let you call function in traditional dll look for Using P/Invoke to Access Win32 APIs[^] MCAD

          1 Reply Last reply
          0
          • S Stober

            Pretty-please :laugh: I suppose I probably should buy a book about C#.:->

            L Offline
            L Offline
            Luis Alonso Ramos
            wrote on last edited by
            #5

            See the other reply. You won't learn about a new language and framework in an hour. Believe me, from experience, C#/.NET is ten times faster/easier to use than the corresponding Win32 API (with or without MFC) in 99% of the cases. You'll just have to search for the appropiate classes to do your job. One thing .NET is a thousand times better is that it has been designed from the ground up, so all the classess are very consistent with each other, whether you are developing a Windows or a web app. Take your time to learn this new technology, and I'll bet anything you won't want to go back! :-> -- LuisR


            Luis Alonso Ramos Intelectix - Chihuahua, Mexico Not much here: My CP Blog!

            The amount of sleep the average person needs is five more minutes. -- Vikram A Punathambekar, Aug. 11, 2005

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups