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. System.Windows.Forms Issue

System.Windows.Forms Issue

Scheduled Pinned Locked Moved C#
helpoop
9 Posts 5 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.
  • J Offline
    J Offline
    jkadjthegamegadhguaet
    wrote on last edited by
    #1

    Hello, sometimes in programming it without a console application is assembly the compile top it up all the over off the hello world first written sorry for one time the two sentences over top but the problem was encapsulation the "hello world" as is in very standard and common prototype first one to have it: Using Microsoft.VisualBasic; //very unnatural, not natural english using System.Windows.Forms; void MAIN() { Console.WriteLine("Hello World"); //works System.Windows.Forms.WriteLine("Hello World"); //doesn't work }; Explain in your own words how encapsulation would solve this problem.

    OriginalGriffO B 2 Replies Last reply
    0
    • J jkadjthegamegadhguaet

      Hello, sometimes in programming it without a console application is assembly the compile top it up all the over off the hello world first written sorry for one time the two sentences over top but the problem was encapsulation the "hello world" as is in very standard and common prototype first one to have it: Using Microsoft.VisualBasic; //very unnatural, not natural english using System.Windows.Forms; void MAIN() { Console.WriteLine("Hello World"); //works System.Windows.Forms.WriteLine("Hello World"); //doesn't work }; Explain in your own words how encapsulation would solve this problem.

      OriginalGriffO Offline
      OriginalGriffO Offline
      OriginalGriff
      wrote on last edited by
      #2

      Um...the question itself doesn't make a lot of sense - or indeed any - but the code you show also makes no sense either. There is no Forms.WriteLine method, because you can't write directly on a form, and particularly there is no static WriteLine method because unlike a console there can be many Forms in an application. And encapsulation won't solve that. A console app is a special type of application which has a very limited user interface: character input and output only. There is one input stream (the keyboard) and one output stream (the console). And there is some clever software behind the scenes which ensures that the output stream is displayed as readable text. Forms applications aren't like that - they have a much richer user interface made of of Controls like buttons, labels, textboxes, and so on, and there are a number of input methods: keyboard and mouse for starters, but each Control handles it's own input and output. Some may display text (Label and TextBox for example) others may show images without text (a PictureBox perhaps). You can't just "write a line" to a form, you have to decide which control to show it on, and tell it what to display. So I think you need to go back to your course notes, or your book, and read that chapter again - you don't seem to have grasped that the two application types are very, very different and you can't treat them in the same way!

      Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...

      "I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
      "Common sense is so rare these days, it should be classified as a super power" - Random T-shirt

      1 Reply Last reply
      0
      • J jkadjthegamegadhguaet

        Hello, sometimes in programming it without a console application is assembly the compile top it up all the over off the hello world first written sorry for one time the two sentences over top but the problem was encapsulation the "hello world" as is in very standard and common prototype first one to have it: Using Microsoft.VisualBasic; //very unnatural, not natural english using System.Windows.Forms; void MAIN() { Console.WriteLine("Hello World"); //works System.Windows.Forms.WriteLine("Hello World"); //doesn't work }; Explain in your own words how encapsulation would solve this problem.

        B Offline
        B Offline
        BillWoodruff
        wrote on last edited by
        #3

        Now, take a deep breath: what you are about to hear is not an insult. Everyone here was a beginner ... once. Your question suggests, to me, that you are very new to programming, and pretty confused about what a Windows Form Application is. A Console Application and a Windows Forms Application are totally different. Yes, a Console is a "window," and it's the only run-time surface/canvas/window the user can interact with. It has a built-in processing loop read-evaluate-print triggered by your hitting the Enter key. A Windows Form Application has (typically, by default) a Main Window, and the programmer can create as many other Windows (Forms) as they wish. Closing the Main Window will close all the other open Forms. Each Form, when it has focus, gets connected to the Windows message-pump that sends it keystrokes, mouse-actions, etc. Which Control on a given Form "receives" these messages will vary depending on the Control, and the context. Sometimes people get confused because in a Windows Forms Application, you can cause text output to be written to the 'Output window in Visual Studio by using code like this: Console.WriteLine("current value: {0}", currentValue); There's a good free book, "DotNet Zero" by Charles Petzold you can download here: [^]. Once you have gotten an initial mastery of the Console Application, I suggest you get a book on Windows Forms; I think the (older, but still good) books by Jesse Liberty and Matthew McDonald are excellent. cheers, Bill

        «There is a spectrum, from "clearly desirable behaviour," to "possibly dodgy behavior that still makes some sense," to "clearly undesirable behavior." We try to make the latter into warnings or, better, errors. But stuff that is in the middle category you don’t want to restrict unless there is a clear way to work around it.» Eric Lippert, May 14, 2008

        J C 2 Replies Last reply
        0
        • B BillWoodruff

          Now, take a deep breath: what you are about to hear is not an insult. Everyone here was a beginner ... once. Your question suggests, to me, that you are very new to programming, and pretty confused about what a Windows Form Application is. A Console Application and a Windows Forms Application are totally different. Yes, a Console is a "window," and it's the only run-time surface/canvas/window the user can interact with. It has a built-in processing loop read-evaluate-print triggered by your hitting the Enter key. A Windows Form Application has (typically, by default) a Main Window, and the programmer can create as many other Windows (Forms) as they wish. Closing the Main Window will close all the other open Forms. Each Form, when it has focus, gets connected to the Windows message-pump that sends it keystrokes, mouse-actions, etc. Which Control on a given Form "receives" these messages will vary depending on the Control, and the context. Sometimes people get confused because in a Windows Forms Application, you can cause text output to be written to the 'Output window in Visual Studio by using code like this: Console.WriteLine("current value: {0}", currentValue); There's a good free book, "DotNet Zero" by Charles Petzold you can download here: [^]. Once you have gotten an initial mastery of the Console Application, I suggest you get a book on Windows Forms; I think the (older, but still good) books by Jesse Liberty and Matthew McDonald are excellent. cheers, Bill

          «There is a spectrum, from "clearly desirable behaviour," to "possibly dodgy behavior that still makes some sense," to "clearly undesirable behavior." We try to make the latter into warnings or, better, errors. But stuff that is in the middle category you don’t want to restrict unless there is a clear way to work around it.» Eric Lippert, May 14, 2008

          J Offline
          J Offline
          jkadjthegamegadhguaet
          wrote on last edited by
          #4

          So you cannot use the same "words" to write both a console and forms app.. Not only are you forced into the new language C#, but sub languages as well

          L 2 Replies Last reply
          0
          • B BillWoodruff

            Now, take a deep breath: what you are about to hear is not an insult. Everyone here was a beginner ... once. Your question suggests, to me, that you are very new to programming, and pretty confused about what a Windows Form Application is. A Console Application and a Windows Forms Application are totally different. Yes, a Console is a "window," and it's the only run-time surface/canvas/window the user can interact with. It has a built-in processing loop read-evaluate-print triggered by your hitting the Enter key. A Windows Form Application has (typically, by default) a Main Window, and the programmer can create as many other Windows (Forms) as they wish. Closing the Main Window will close all the other open Forms. Each Form, when it has focus, gets connected to the Windows message-pump that sends it keystrokes, mouse-actions, etc. Which Control on a given Form "receives" these messages will vary depending on the Control, and the context. Sometimes people get confused because in a Windows Forms Application, you can cause text output to be written to the 'Output window in Visual Studio by using code like this: Console.WriteLine("current value: {0}", currentValue); There's a good free book, "DotNet Zero" by Charles Petzold you can download here: [^]. Once you have gotten an initial mastery of the Console Application, I suggest you get a book on Windows Forms; I think the (older, but still good) books by Jesse Liberty and Matthew McDonald are excellent. cheers, Bill

            «There is a spectrum, from "clearly desirable behaviour," to "possibly dodgy behavior that still makes some sense," to "clearly undesirable behavior." We try to make the latter into warnings or, better, errors. But stuff that is in the middle category you don’t want to restrict unless there is a clear way to work around it.» Eric Lippert, May 14, 2008

            C Offline
            C Offline
            CHill60
            wrote on last edited by
            #5

            Sounds like ORT might be back

            L 1 Reply Last reply
            0
            • J jkadjthegamegadhguaet

              So you cannot use the same "words" to write both a console and forms app.. Not only are you forced into the new language C#, but sub languages as well

              L Offline
              L Offline
              Lost User
              wrote on last edited by
              #6

              Why would you want to? The two application types are totally different and always have been. Before .NET (C#, VB.NET etc.) there was pure Windows, which was still different from console apps.

              1 Reply Last reply
              0
              • C CHill60

                Sounds like ORT might be back

                L Offline
                L Offline
                Lost User
                wrote on last edited by
                #7

                You may well be correct.

                OriginalGriffO 1 Reply Last reply
                0
                • L Lost User

                  You may well be correct.

                  OriginalGriffO Offline
                  OriginalGriffO Offline
                  OriginalGriff
                  wrote on last edited by
                  #8

                  The use of English in the later posts would point at ORT...he has a certain "style". Hopefully, this time he will refrain from the shrooms or whatever (or not post when using them) :sigh:

                  Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...

                  "I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
                  "Common sense is so rare these days, it should be classified as a super power" - Random T-shirt

                  1 Reply Last reply
                  0
                  • J jkadjthegamegadhguaet

                    So you cannot use the same "words" to write both a console and forms app.. Not only are you forced into the new language C#, but sub languages as well

                    L Offline
                    L Offline
                    Lost User
                    wrote on last edited by
                    #9

                    Yes, you can. A windows app is a console-app. It will write in both applications to the same destionation; stdout. Anything else?

                    Bastard Programmer from Hell :suss: If you can't read my code, try converting it here[^][](X-Clacks-Overhead: GNU Terry Pratchett)

                    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