Click here to Skip to main content
15,881,809 members
Home / Discussions / C#
   

C#

 
GeneralRe: C# Pin
Richard Andrew x6426-Aug-20 11:28
professionalRichard Andrew x6426-Aug-20 11:28 
AnswerRe: C# Pin
Gerry Schmitz27-Aug-20 3:54
mveGerry Schmitz27-Aug-20 3:54 
AnswerRe: C# Pin
Exoskeletor2-Sep-20 0:48
Exoskeletor2-Sep-20 0:48 
QuestionLooking for a book on C# forms Pin
Brian_TheLion25-Aug-20 21:21
Brian_TheLion25-Aug-20 21:21 
AnswerRe: Looking for a book on C# forms Pin
Richard MacCutchan25-Aug-20 21:23
mveRichard MacCutchan25-Aug-20 21:23 
GeneralRe: Looking for a book on C# forms Pin
Brian_TheLion25-Aug-20 21:35
Brian_TheLion25-Aug-20 21:35 
GeneralRe: Looking for a book on C# forms Pin
Richard MacCutchan25-Aug-20 22:25
mveRichard MacCutchan25-Aug-20 22:25 
AnswerRe: Looking for a book on C# forms Pin
OriginalGriff25-Aug-20 21:37
mveOriginalGriff25-Aug-20 21:37 
Brian_TheLion wrote:
a lot of them are aimed at console programming

No, most "beginner" books start with the console because it's really easy to get immediate feedback for beginners - they don't have to worry about the complexities involved in setting up a website, or creating a form and getting input and output controls onto it; the beginner can focus on learning the real basics of development.

They move to websites, WinForms, WPF, later when the learner is familiar with variables, flow control, collections, and so forth.

Think about it: which is easier for a beginner to create:
C#
using System;

namespace HelloWorld
    {
    class Program
        {
        static void Main(string[] args)
            {
            Console.WriteLine("Hello World!");
            }
        }
    }
Or
C#
using System;
using System.Windows.Forms;

namespace HelloWorldForms
    {
    /// <summary>
    /// Main form for application
    /// </summary>
    public partial class FrmMain : Form
        {
        #region Constants
        #endregion

        #region Fields
        #region Internal
        #endregion

        #region Property bases
        #endregion
        #endregion

        #region Properties
        #endregion

        #region Regular Expressions
        #endregion

        #region Enums
        #endregion

        #region Constructors
        /// <summary>
        /// Default constructor
        /// </summary>
        public FrmMain() => InitializeComponent();
        #endregion

        #region Events
        #region Event Constructors
        #endregion

        #region Event Handlers
        #region Form
        /// <summary>
        /// Restore size and location (if the user doesn't
        /// override it)
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void FrmMain_Load(object sender, EventArgs e)
            {
            if ((ModifierKeys & Keys.Shift) == 0)
                {
                this.LoadLocation();
                }
            }
        /// <summary>
        /// Save the size and location (if the used doesn't
        /// override it)
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void FrmMain_FormClosing(object sender, FormClosingEventArgs e)
            {
            if ((ModifierKeys & Keys.Shift) == 0)
                {
                this.SaveLocation();
                }
            }
        /// <summary>
        /// Called once when form displayed for first time
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void FrmMain_Shown(object sender, EventArgs e)
            {
            }
        #endregion
        /// <summary>
        /// He pressed the button!
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void butPressMe_Click(object sender, EventArgs e)
            {
            labBanner.Text = "Hello World!";
            }
        #endregion
        #endregion

        #region Threads
        #endregion

        #region Public Methods
        #endregion

        #region Overrides
        #endregion

        #region Private Methods
        #endregion
        }
    }
Together with:
C#
namespace HelloWorldForms
    {
    partial class FrmMain
        {
        /// <summary>
        /// Required designer variable.
        /// </summary>
        private System.ComponentModel.IContainer components = null;

        /// <summary>
        /// Clean up any resources being used.
        /// </summary>
        /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
        protected override void Dispose(bool disposing)
            {
            if (disposing && (components != null))
                {
                components.Dispose();
                }
            base.Dispose(disposing);
            }

        #region Windows Form Designer generated code

        /// <summary>
        /// Required method for Designer support - do not modify
        /// the contents of this method with the code editor.
        /// </summary>
        private void InitializeComponent()
            {
            this.labBanner = new System.Windows.Forms.Label();
            this.butPressMe = new System.Windows.Forms.Button();
            this.SuspendLayout();
            // 
            // labBanner
            // 
            this.labBanner.Location = new System.Drawing.Point(13, 113);
            this.labBanner.Name = "labBanner";
            this.labBanner.Size = new System.Drawing.Size(259, 23);
            this.labBanner.TabIndex = 0;
            this.labBanner.Text = "Press the button!";
            this.labBanner.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
            // 
            // butPressMe
            // 
            this.butPressMe.Location = new System.Drawing.Point(12, 158);
            this.butPressMe.Name = "butPressMe";
            this.butPressMe.Size = new System.Drawing.Size(260, 23);
            this.butPressMe.TabIndex = 1;
            this.butPressMe.Text = "Press here!";
            this.butPressMe.UseVisualStyleBackColor = true;
            this.butPressMe.Click += new System.EventHandler(this.butPressMe_Click);
            // 
            // FrmMain
            // 
            this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
            this.ClientSize = new System.Drawing.Size(284, 261);
            this.Controls.Add(this.butPressMe);
            this.Controls.Add(this.labBanner);
            this.Name = "FrmMain";
            this.Text = "One off jobs";
            this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.FrmMain_FormClosing);
            this.Load += new System.EventHandler(this.FrmMain_Load);
            this.Shown += new System.EventHandler(this.FrmMain_Shown);
            this.ResumeLayout(false);

            }

        #endregion
        private System.Windows.Forms.Label labBanner;
        private System.Windows.Forms.Button butPressMe;
        }
    }

"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
AntiTwitter: @DalekDave is now a follower!

GeneralRe: Looking for a book on C# forms Pin
trønderen26-Aug-20 1:11
trønderen26-Aug-20 1:11 
GeneralRe: Looking for a book on C# forms Pin
OriginalGriff26-Aug-20 1:16
mveOriginalGriff26-Aug-20 1:16 
GeneralRe: Looking for a book on C# forms Pin
trønderen26-Aug-20 5:00
trønderen26-Aug-20 5:00 
AnswerRe: Looking for a book on C# forms Pin
trønderen26-Aug-20 0:38
trønderen26-Aug-20 0:38 
AnswerRe: Looking for a book on C# forms Pin
CHill6026-Aug-20 1:24
mveCHill6026-Aug-20 1:24 
AnswerRe: Looking for a book on C# forms Pin
Ron Nicholson26-Aug-20 2:24
professionalRon Nicholson26-Aug-20 2:24 
AnswerRe: Looking for a book on C# forms Pin
Gerry Schmitz26-Aug-20 7:16
mveGerry Schmitz26-Aug-20 7:16 
QuestionTrying to get my block program working Pin
Brian_TheLion23-Aug-20 16:56
Brian_TheLion23-Aug-20 16:56 
AnswerRe: Trying to get my block program working Pin
Gerry Schmitz23-Aug-20 17:18
mveGerry Schmitz23-Aug-20 17:18 
QuestionHow to calculate in c# the possibility of this game Pin
Exoskeletor22-Aug-20 21:43
Exoskeletor22-Aug-20 21:43 
AnswerRe: How to calculate in c# the possibility of this game Pin
OriginalGriff22-Aug-20 21:47
mveOriginalGriff22-Aug-20 21:47 
GeneralRe: How to calculate in c# the possibility of this game Pin
Exoskeletor22-Aug-20 21:51
Exoskeletor22-Aug-20 21:51 
GeneralRe: How to calculate in c# the possibility of this game Pin
OriginalGriff22-Aug-20 22:01
mveOriginalGriff22-Aug-20 22:01 
GeneralRe: How to calculate in c# the possibility of this game Pin
Exoskeletor22-Aug-20 22:04
Exoskeletor22-Aug-20 22:04 
GeneralRe: How to calculate in c# the possibility of this game Pin
OriginalGriff22-Aug-20 22:13
mveOriginalGriff22-Aug-20 22:13 
GeneralRe: How to calculate in c# the possibility of this game Pin
Exoskeletor22-Aug-20 22:31
Exoskeletor22-Aug-20 22:31 
GeneralRe: How to calculate in c# the possibility of this game Pin
Exoskeletor22-Aug-20 22:32
Exoskeletor22-Aug-20 22:32 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.