Click here to Skip to main content
14,739,281 members
Home » Discussions » C#
   

C#

 
QuestionLooking for a book on C# forms Pin
Brian_TheLion25-Aug-20 22:21
MemberBrian_TheLion25-Aug-20 22:21 
AnswerRe: Looking for a book on C# forms Pin
Richard MacCutchan25-Aug-20 22:23
mveRichard MacCutchan25-Aug-20 22:23 
GeneralRe: Looking for a book on C# forms Pin
Brian_TheLion25-Aug-20 22:35
MemberBrian_TheLion25-Aug-20 22:35 
GeneralRe: Looking for a book on C# forms Pin
Richard MacCutchan25-Aug-20 23:25
mveRichard MacCutchan25-Aug-20 23:25 
AnswerRe: Looking for a book on C# forms Pin
OriginalGriff25-Aug-20 22:37
mveOriginalGriff25-Aug-20 22:37 
GeneralRe: Looking for a book on C# forms Pin
trønderen26-Aug-20 2:11
Membertrønderen26-Aug-20 2:11 
GeneralRe: Looking for a book on C# forms Pin
OriginalGriff26-Aug-20 2:16
mveOriginalGriff26-Aug-20 2:16 
GeneralRe: Looking for a book on C# forms Pin
trønderen26-Aug-20 6:00
Membertrønderen26-Aug-20 6:00 
Any development environment do things for you. When I went from Pascal to C, ages ago, I was puzzled by the compiler automatically doing the linking for me. It throws in all sorts of library functions as well. In principle, there is little difference to modern IDEs.

I made a minimal GUI Hello World - not quite a one-liner, but not that far away:
using System.Windows;

namespace Hello {

  public partial class MainWindow : Window {
    public MainWindow() {
      InitializeComponent();
    }

    public void Terminate(object sender, RoutedEventArgs evtArg) {
      Application.Current.Shutdown();
    }
  }
}
Note that all I had to write myself was
public void Terminate(object sender, RoutedEventArgs evtArg) {
  Application.Current.Shutdown();
}
- the rest was generated for me. Then comes the GUI elements:
<Window x:Class="Hello.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        mc:Ignorable="d"
        Title="Hello" Height="100" Width="120">
  <StackPanel HorizontalAlignment="Left">
    <TextBlock x:Name="textBlock" Text="Hello World"/>
    <Button x:Name="button" Content="OK" Click="Terminate"/>
  </StackPanel>
</Window>
- again, a of it lot generated. All I had to write myself was:
<StackPanel HorizontalAlignment="Left">
  <TextBlock x:Name="textBlock" Text="Hello World"/>
  <Button x:Name="button" Content="OK" Click="Terminate"/>
</StackPanel>
(I did modify the generated window size and title as well, but those are cosmetics and not required for Hello World functionality).

So I had to write seven lines (when also counting the one with nothing but a closing brace) to create a GUI Hello World. It sure is more than
#include <iostream>

int main() {
    std::cout << "Hello World!";
    return 0;
}
But then, hitting F5 is far easier than invoking the C++ compiler from a CLI.

My experience is that to make novices/students fascinated and eager to learn, you must help them to rapidly build something that has a resemblance to what they are used to see on the screen. At least 19 out of 20 have never ever realated to a CLI interface, but 20 out of 20 have seen windows, buttons, text fields etc. Console output does not give them a feeling of having taken the first step into making something "real". A GUI label and a clickable button, much more so.
AnswerRe: Looking for a book on C# forms Pin
trønderen26-Aug-20 1:38
Membertrønderen26-Aug-20 1:38 
AnswerRe: Looking for a book on C# forms Pin
CHill6026-Aug-20 2:24
mveCHill6026-Aug-20 2:24 
AnswerRe: Looking for a book on C# forms Pin
Ron Nicholson26-Aug-20 3:24
professionalRon Nicholson26-Aug-20 3:24 
AnswerRe: Looking for a book on C# forms Pin
Gerry Schmitz26-Aug-20 8:16
mveGerry Schmitz26-Aug-20 8:16 
QuestionTrying to get my block program working Pin
Brian_TheLion23-Aug-20 17:56
MemberBrian_TheLion23-Aug-20 17:56 
AnswerRe: Trying to get my block program working Pin
Gerry Schmitz23-Aug-20 18:18
mveGerry Schmitz23-Aug-20 18:18 
QuestionHow to calculate in c# the possibility of this game Pin
Exoskeletor22-Aug-20 22:43
MemberExoskeletor22-Aug-20 22:43 
AnswerRe: How to calculate in c# the possibility of this game Pin
OriginalGriff22-Aug-20 22:47
mveOriginalGriff22-Aug-20 22:47 
GeneralRe: How to calculate in c# the possibility of this game Pin
Exoskeletor22-Aug-20 22:51
MemberExoskeletor22-Aug-20 22:51 
GeneralRe: How to calculate in c# the possibility of this game Pin
OriginalGriff22-Aug-20 23:01
mveOriginalGriff22-Aug-20 23:01 
GeneralRe: How to calculate in c# the possibility of this game Pin
Exoskeletor22-Aug-20 23:04
MemberExoskeletor22-Aug-20 23:04 
GeneralRe: How to calculate in c# the possibility of this game Pin
OriginalGriff22-Aug-20 23:13
mveOriginalGriff22-Aug-20 23:13 
GeneralRe: How to calculate in c# the possibility of this game Pin
Exoskeletor22-Aug-20 23:31
MemberExoskeletor22-Aug-20 23:31 
GeneralRe: How to calculate in c# the possibility of this game Pin
Exoskeletor22-Aug-20 23:32
MemberExoskeletor22-Aug-20 23:32 
GeneralRe: How to calculate in c# the possibility of this game Pin
OriginalGriff22-Aug-20 23:33
mveOriginalGriff22-Aug-20 23:33 
GeneralRe: How to calculate in c# the possibility of this game Pin
Exoskeletor22-Aug-20 23:37
MemberExoskeletor22-Aug-20 23:37 
GeneralRe: How to calculate in c# the possibility of this game Pin
OriginalGriff22-Aug-20 23:43
mveOriginalGriff22-Aug-20 23:43 

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.