Professional Documents
Culture Documents
Programming
Introduction to C# .NET, Window form and IO
I. C# Programming language
• Basic syntax, data structure
• Scripting/trans-scripting language: JS/nodeJS (V8 Engine, browser), Ruby -> JVM Bytecode.
}
}
}
C# Window form
• Windows Forms (WinForms) is a free and open-
source graphical (GUI) class library included as a part
of Microsoft .NET, .NET Framework or Mono
Framework, embedded in Window Foundation Class
Library
• Became OSS in 2018:
https://github.com/dotnet/winforms
• A Windows Forms application is an
event-driven application supported by Microsoft's
.NET Framework. Window form application constantly
listens for events such as: key pressed, left-click, right
click, …
C# Window form layout
C# Window form – component controls
• Buttons
• Label
• RichTextBox
• Textbox
C# Window form – open a file
using (OpenFileDialog dlg = new OpenFileDialog())
{
dlg.FileName = "";
dlg.Filter = "*.jpeg|*.jpg|*.*|*.*";
if (dlg.ShowDialog() == System.Windows.Forms.DialogResult.OK)
{
_errormessage = "";
_filename = dlg.FileName;
_importMissing = System.Windows.Forms.MessageBox.Show(
}
}
References
• C# Winform Tutorial:
https://docs.microsoft.com/en-us/visualstudio/ide/create-csharp-winf
orm-visual-studio?view=vs-2022
Assignment Week #2
• C# Window form Calculator
• UI looks like the next figure
• Can peform +, -, x, / and % (mod)