Click here to Skip to main content
15,886,661 members
Home / Discussions / C#
   

C#

 
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 
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 
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:
C#
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
C#
public void Terminate(object sender, RoutedEventArgs evtArg) {
  Application.Current.Shutdown();
}
- the rest was generated for me. Then comes the GUI elements:
C#
<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:
C#
<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
C++
#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 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 
GeneralRe: How to calculate in c# the possibility of this game Pin
OriginalGriff22-Aug-20 22:33
mveOriginalGriff22-Aug-20 22:33 
GeneralRe: How to calculate in c# the possibility of this game Pin
Exoskeletor22-Aug-20 22:37
Exoskeletor22-Aug-20 22:37 
GeneralRe: How to calculate in c# the possibility of this game Pin
OriginalGriff22-Aug-20 22:43
mveOriginalGriff22-Aug-20 22: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.