diff --git a/MySQLStoredProcedureStudent/MySQLStoredProcedureStudent/StudentForm.cs b/MySQLStoredProcedureStudent/MySQLStoredProcedureStudent/StudentForm.cs
index 407ba58..954f5a1 100644
--- a/MySQLStoredProcedureStudent/MySQLStoredProcedureStudent/StudentForm.cs
+++ b/MySQLStoredProcedureStudent/MySQLStoredProcedureStudent/StudentForm.cs
@@ -9,7 +9,7 @@ namespace MySQLStoredProcedureStudent
public partial class StudentForm : Form
{
private Poststed poststedForm = null;
- private string _connectionString = "Server=localhost;Port=33060;User=root;Password=root123;Database=student2018;";
+ private string _connectionString = "Server=localhost;Port=3306;User=root;Password=root123;Database=student2018;";
private MySqlConnection _connection = null;
private int _studentId = 0;
diff --git a/ProveMai/OppgaveEn/App.config b/ProveMai/OppgaveEn/App.config
new file mode 100644
index 0000000..56efbc7
--- /dev/null
+++ b/ProveMai/OppgaveEn/App.config
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/ProveMai/OppgaveEn/MainForm.Designer.cs b/ProveMai/OppgaveEn/MainForm.Designer.cs
new file mode 100644
index 0000000..3b21079
--- /dev/null
+++ b/ProveMai/OppgaveEn/MainForm.Designer.cs
@@ -0,0 +1,142 @@
+namespace OppgaveEn
+{
+ partial class MainForm
+ {
+ ///
+ /// Required designer variable.
+ ///
+ private System.ComponentModel.IContainer components = null;
+
+ ///
+ /// Clean up any resources being used.
+ ///
+ /// true if managed resources should be disposed; otherwise, false.
+ protected override void Dispose(bool disposing)
+ {
+ if (disposing && (components != null))
+ {
+ components.Dispose();
+ }
+ base.Dispose(disposing);
+ }
+
+ #region Windows Form Designer generated code
+
+ ///
+ /// Required method for Designer support - do not modify
+ /// the contents of this method with the code editor.
+ ///
+ private void InitializeComponent()
+ {
+ this.lblR1 = new System.Windows.Forms.Label();
+ this.textBoxR1 = new System.Windows.Forms.TextBox();
+ this.buttonSirkel = new System.Windows.Forms.Button();
+ this.lblR2 = new System.Windows.Forms.Label();
+ this.textBoxR2 = new System.Windows.Forms.TextBox();
+ this.buttonEllipse = new System.Windows.Forms.Button();
+ this.labelAreal = new System.Windows.Forms.Label();
+ this.textBoxAreal = new System.Windows.Forms.TextBox();
+ this.SuspendLayout();
+ //
+ // lblR1
+ //
+ this.lblR1.AutoSize = true;
+ this.lblR1.Location = new System.Drawing.Point(12, 16);
+ this.lblR1.Name = "lblR1";
+ this.lblR1.Size = new System.Drawing.Size(24, 13);
+ this.lblR1.TabIndex = 0;
+ this.lblR1.Text = "R1:";
+ //
+ // textBoxR1
+ //
+ this.textBoxR1.Location = new System.Drawing.Point(42, 12);
+ this.textBoxR1.Name = "textBoxR1";
+ this.textBoxR1.Size = new System.Drawing.Size(100, 20);
+ this.textBoxR1.TabIndex = 1;
+ //
+ // buttonSirkel
+ //
+ this.buttonSirkel.Location = new System.Drawing.Point(366, 6);
+ this.buttonSirkel.Name = "buttonSirkel";
+ this.buttonSirkel.Size = new System.Drawing.Size(133, 23);
+ this.buttonSirkel.TabIndex = 2;
+ this.buttonSirkel.Text = "Beregn Sirkel-areal";
+ this.buttonSirkel.UseVisualStyleBackColor = true;
+ this.buttonSirkel.Click += new System.EventHandler(this.ButtonSirkel_Click);
+ //
+ // lblR2
+ //
+ this.lblR2.AutoSize = true;
+ this.lblR2.Location = new System.Drawing.Point(12, 41);
+ this.lblR2.Name = "lblR2";
+ this.lblR2.Size = new System.Drawing.Size(24, 13);
+ this.lblR2.TabIndex = 3;
+ this.lblR2.Text = "R2:";
+ //
+ // textBoxR2
+ //
+ this.textBoxR2.Location = new System.Drawing.Point(42, 38);
+ this.textBoxR2.Name = "textBoxR2";
+ this.textBoxR2.Size = new System.Drawing.Size(100, 20);
+ this.textBoxR2.TabIndex = 4;
+ //
+ // buttonEllipse
+ //
+ this.buttonEllipse.Location = new System.Drawing.Point(366, 36);
+ this.buttonEllipse.Name = "buttonEllipse";
+ this.buttonEllipse.Size = new System.Drawing.Size(133, 23);
+ this.buttonEllipse.TabIndex = 5;
+ this.buttonEllipse.Text = "Beregn Ellipse-areal";
+ this.buttonEllipse.UseVisualStyleBackColor = true;
+ this.buttonEllipse.Click += new System.EventHandler(this.ButtonEllipse_Click);
+ //
+ // labelAreal
+ //
+ this.labelAreal.AutoSize = true;
+ this.labelAreal.Location = new System.Drawing.Point(330, 87);
+ this.labelAreal.Name = "labelAreal";
+ this.labelAreal.Size = new System.Drawing.Size(63, 13);
+ this.labelAreal.TabIndex = 6;
+ this.labelAreal.Text = "Ellipseareal:";
+ //
+ // textBoxAreal
+ //
+ this.textBoxAreal.Location = new System.Drawing.Point(399, 84);
+ this.textBoxAreal.Name = "textBoxAreal";
+ this.textBoxAreal.ReadOnly = true;
+ this.textBoxAreal.Size = new System.Drawing.Size(100, 20);
+ this.textBoxAreal.TabIndex = 7;
+ //
+ // MainForm
+ //
+ this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
+ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+ this.ClientSize = new System.Drawing.Size(511, 116);
+ this.Controls.Add(this.textBoxAreal);
+ this.Controls.Add(this.labelAreal);
+ this.Controls.Add(this.buttonEllipse);
+ this.Controls.Add(this.textBoxR2);
+ this.Controls.Add(this.lblR2);
+ this.Controls.Add(this.buttonSirkel);
+ this.Controls.Add(this.textBoxR1);
+ this.Controls.Add(this.lblR1);
+ this.Name = "MainForm";
+ this.Text = "Beregning av ellipse og sirkelareal - Oppgave 1 - Alex Thomassen";
+ this.ResumeLayout(false);
+ this.PerformLayout();
+
+ }
+
+ #endregion
+
+ private System.Windows.Forms.Label lblR1;
+ private System.Windows.Forms.TextBox textBoxR1;
+ private System.Windows.Forms.Button buttonSirkel;
+ private System.Windows.Forms.Label lblR2;
+ private System.Windows.Forms.TextBox textBoxR2;
+ private System.Windows.Forms.Button buttonEllipse;
+ private System.Windows.Forms.Label labelAreal;
+ private System.Windows.Forms.TextBox textBoxAreal;
+ }
+}
+
diff --git a/ProveMai/OppgaveEn/MainForm.cs b/ProveMai/OppgaveEn/MainForm.cs
new file mode 100644
index 0000000..6f06a9f
--- /dev/null
+++ b/ProveMai/OppgaveEn/MainForm.cs
@@ -0,0 +1,100 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Data;
+using System.Drawing;
+using System.Globalization;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows.Forms;
+
+namespace OppgaveEn
+{
+ public partial class MainForm : Form
+ {
+ /**
+ * Oppgave 1: Variabler
+ */
+ private float r1;
+ private float r2;
+ private bool parsed = false;
+
+ public MainForm()
+ {
+ InitializeComponent();
+ }
+
+ /**
+ * Oppgave 1: Start
+ */
+ private void ReadRValues()
+ {
+ string r1Text = textBoxR1.Text;
+ string r2Text = textBoxR2.Text;
+
+ // Oversikt om r1 og r2 ble "parsed" som forventet.
+ parsed = false;
+
+ try
+ {
+ r1 = float.Parse(r1Text);
+ r2 = float.Parse(r2Text);
+ parsed = true;
+ }
+ catch (FormatException ex)
+ {
+ MessageBox.Show("Ugyldig tallverdi!");
+ SetAreal(null, null);
+ }
+ catch (Exception ex)
+ {
+ // Fallback i tilfelle det er andre feil som oppstår.
+ MessageBox.Show(ex.ToString());
+ }
+ }
+
+ private void SetAreal(string labelText, string result)
+ {
+ // Definer en standard tekstverdi for label.
+ if (labelText == null)
+ {
+ labelText = "Ellipseareal";
+ }
+ labelAreal.Text = labelText + ":";
+
+
+ if (result == null)
+ {
+ result = "";
+ }
+ textBoxAreal.Text = result;
+ }
+
+ private void ButtonSirkel_Click(object sender, EventArgs e)
+ {
+ ReadRValues();
+
+ if (parsed)
+ {
+ double result = Math.PI * (r1 * r1);
+ SetAreal("Sirkelareal", result.ToString());
+ }
+ }
+
+ private void ButtonEllipse_Click(object sender, EventArgs e)
+ {
+ ReadRValues();
+
+ if (parsed)
+ {
+ double result = Math.PI * r1 * r2;
+ SetAreal("Ellipseareal", result.ToString());
+ }
+ }
+
+ /**
+ * Oppgave 1: Slutt
+ */
+ }
+}
diff --git a/ProveMai/OppgaveEn/MainForm.resx b/ProveMai/OppgaveEn/MainForm.resx
new file mode 100644
index 0000000..1af7de1
--- /dev/null
+++ b/ProveMai/OppgaveEn/MainForm.resx
@@ -0,0 +1,120 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ text/microsoft-resx
+
+
+ 2.0
+
+
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
\ No newline at end of file
diff --git a/ProveMai/OppgaveEn/OppgaveEn.csproj b/ProveMai/OppgaveEn/OppgaveEn.csproj
new file mode 100644
index 0000000..a9a206e
--- /dev/null
+++ b/ProveMai/OppgaveEn/OppgaveEn.csproj
@@ -0,0 +1,84 @@
+
+
+
+
+ Debug
+ AnyCPU
+ {14B2ADE7-42FB-4BE6-A6D1-20FB628347A6}
+ WinExe
+ ProveMai
+ ProveMai
+ v4.7.2
+ 512
+ true
+ true
+
+
+ AnyCPU
+ true
+ full
+ false
+ bin\Debug\
+ DEBUG;TRACE
+ prompt
+ 4
+
+
+ AnyCPU
+ pdbonly
+ true
+ bin\Release\
+ TRACE
+ prompt
+ 4
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Form
+
+
+ MainForm.cs
+
+
+
+
+ MainForm.cs
+
+
+ ResXFileCodeGenerator
+ Resources.Designer.cs
+ Designer
+
+
+ True
+ Resources.resx
+ True
+
+
+ SettingsSingleFileGenerator
+ Settings.Designer.cs
+
+
+ True
+ Settings.settings
+ True
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/ProveMai/OppgaveEn/Program.cs b/ProveMai/OppgaveEn/Program.cs
new file mode 100644
index 0000000..90a5d12
--- /dev/null
+++ b/ProveMai/OppgaveEn/Program.cs
@@ -0,0 +1,22 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Threading.Tasks;
+using System.Windows.Forms;
+
+namespace OppgaveEn
+{
+ static class Program
+ {
+ ///
+ /// The main entry point for the application.
+ ///
+ [STAThread]
+ static void Main()
+ {
+ Application.EnableVisualStyles();
+ Application.SetCompatibleTextRenderingDefault(false);
+ Application.Run(new MainForm());
+ }
+ }
+}
diff --git a/ProveMai/OppgaveEn/Properties/AssemblyInfo.cs b/ProveMai/OppgaveEn/Properties/AssemblyInfo.cs
new file mode 100644
index 0000000..effe568
--- /dev/null
+++ b/ProveMai/OppgaveEn/Properties/AssemblyInfo.cs
@@ -0,0 +1,36 @@
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+// General Information about an assembly is controlled through the following
+// set of attributes. Change these attribute values to modify the information
+// associated with an assembly.
+[assembly: AssemblyTitle("ProveMai")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("")]
+[assembly: AssemblyProduct("ProveMai")]
+[assembly: AssemblyCopyright("Copyright © 2019")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+// Setting ComVisible to false makes the types in this assembly not visible
+// to COM components. If you need to access a type in this assembly from
+// COM, set the ComVisible attribute to true on that type.
+[assembly: ComVisible(false)]
+
+// The following GUID is for the ID of the typelib if this project is exposed to COM
+[assembly: Guid("14b2ade7-42fb-4be6-a6d1-20fb628347a6")]
+
+// Version information for an assembly consists of the following four values:
+//
+// Major Version
+// Minor Version
+// Build Number
+// Revision
+//
+// You can specify all the values or you can default the Build and Revision Numbers
+// by using the '*' as shown below:
+// [assembly: AssemblyVersion("1.0.*")]
+[assembly: AssemblyVersion("1.0.0.0")]
+[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/ProveMai/OppgaveEn/Properties/Resources.Designer.cs b/ProveMai/OppgaveEn/Properties/Resources.Designer.cs
new file mode 100644
index 0000000..b8a4e62
--- /dev/null
+++ b/ProveMai/OppgaveEn/Properties/Resources.Designer.cs
@@ -0,0 +1,63 @@
+//------------------------------------------------------------------------------
+//
+// This code was generated by a tool.
+// Runtime Version:4.0.30319.42000
+//
+// Changes to this file may cause incorrect behavior and will be lost if
+// the code is regenerated.
+//
+//------------------------------------------------------------------------------
+
+namespace OppgaveEn.Properties {
+ using System;
+
+
+ ///
+ /// A strongly-typed resource class, for looking up localized strings, etc.
+ ///
+ // This class was auto-generated by the StronglyTypedResourceBuilder
+ // class via a tool like ResGen or Visual Studio.
+ // To add or remove a member, edit your .ResX file then rerun ResGen
+ // with the /str option, or rebuild your VS project.
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "16.0.0.0")]
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
+ internal class Resources {
+
+ private static global::System.Resources.ResourceManager resourceMan;
+
+ private static global::System.Globalization.CultureInfo resourceCulture;
+
+ [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
+ internal Resources() {
+ }
+
+ ///
+ /// Returns the cached ResourceManager instance used by this class.
+ ///
+ [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
+ internal static global::System.Resources.ResourceManager ResourceManager {
+ get {
+ if (object.ReferenceEquals(resourceMan, null)) {
+ global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("ProveMai.Properties.Resources", typeof(Resources).Assembly);
+ resourceMan = temp;
+ }
+ return resourceMan;
+ }
+ }
+
+ ///
+ /// Overrides the current thread's CurrentUICulture property for all
+ /// resource lookups using this strongly typed resource class.
+ ///
+ [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
+ internal static global::System.Globalization.CultureInfo Culture {
+ get {
+ return resourceCulture;
+ }
+ set {
+ resourceCulture = value;
+ }
+ }
+ }
+}
diff --git a/ProveMai/OppgaveEn/Properties/Resources.resx b/ProveMai/OppgaveEn/Properties/Resources.resx
new file mode 100644
index 0000000..af7dbeb
--- /dev/null
+++ b/ProveMai/OppgaveEn/Properties/Resources.resx
@@ -0,0 +1,117 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ text/microsoft-resx
+
+
+ 2.0
+
+
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
\ No newline at end of file
diff --git a/ProveMai/OppgaveEn/Properties/Settings.Designer.cs b/ProveMai/OppgaveEn/Properties/Settings.Designer.cs
new file mode 100644
index 0000000..5708b74
--- /dev/null
+++ b/ProveMai/OppgaveEn/Properties/Settings.Designer.cs
@@ -0,0 +1,26 @@
+//------------------------------------------------------------------------------
+//
+// This code was generated by a tool.
+// Runtime Version:4.0.30319.42000
+//
+// Changes to this file may cause incorrect behavior and will be lost if
+// the code is regenerated.
+//
+//------------------------------------------------------------------------------
+
+namespace OppgaveEn.Properties {
+
+
+ [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "16.0.0.0")]
+ internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
+
+ private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
+
+ public static Settings Default {
+ get {
+ return defaultInstance;
+ }
+ }
+ }
+}
diff --git a/ProveMai/OppgaveEn/Properties/Settings.settings b/ProveMai/OppgaveEn/Properties/Settings.settings
new file mode 100644
index 0000000..3964565
--- /dev/null
+++ b/ProveMai/OppgaveEn/Properties/Settings.settings
@@ -0,0 +1,7 @@
+
+
+
+
+
+
+
diff --git a/ProveMai/OppgaveTo/App.config b/ProveMai/OppgaveTo/App.config
new file mode 100644
index 0000000..56efbc7
--- /dev/null
+++ b/ProveMai/OppgaveTo/App.config
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/ProveMai/OppgaveTo/MainForm.Designer.cs b/ProveMai/OppgaveTo/MainForm.Designer.cs
new file mode 100644
index 0000000..0defce3
--- /dev/null
+++ b/ProveMai/OppgaveTo/MainForm.Designer.cs
@@ -0,0 +1,130 @@
+namespace OppgaveTo
+{
+ partial class MainForm
+ {
+ ///
+ /// Required designer variable.
+ ///
+ private System.ComponentModel.IContainer components = null;
+
+ ///
+ /// Clean up any resources being used.
+ ///
+ /// true if managed resources should be disposed; otherwise, false.
+ protected override void Dispose(bool disposing)
+ {
+ if (disposing && (components != null))
+ {
+ components.Dispose();
+ }
+ base.Dispose(disposing);
+ }
+
+ #region Windows Form Designer generated code
+
+ ///
+ /// Required method for Designer support - do not modify
+ /// the contents of this method with the code editor.
+ ///
+ private void InitializeComponent()
+ {
+ this.label1 = new System.Windows.Forms.Label();
+ this.textBoxFodselsaar = new System.Windows.Forms.TextBox();
+ this.buttonVisAlderOgFarge = new System.Windows.Forms.Button();
+ this.lblAlder = new System.Windows.Forms.Label();
+ this.textBoxAlder = new System.Windows.Forms.TextBox();
+ this.textBoxFarge = new System.Windows.Forms.TextBox();
+ this.label2 = new System.Windows.Forms.Label();
+ this.SuspendLayout();
+ //
+ // label1
+ //
+ this.label1.AutoSize = true;
+ this.label1.Location = new System.Drawing.Point(13, 13);
+ this.label1.Name = "label1";
+ this.label1.Size = new System.Drawing.Size(76, 13);
+ this.label1.TabIndex = 0;
+ this.label1.Text = "Angi fødselsår:";
+ //
+ // textBoxFodselsaar
+ //
+ this.textBoxFodselsaar.Location = new System.Drawing.Point(95, 10);
+ this.textBoxFodselsaar.Name = "textBoxFodselsaar";
+ this.textBoxFodselsaar.Size = new System.Drawing.Size(100, 20);
+ this.textBoxFodselsaar.TabIndex = 1;
+ //
+ // buttonVisAlderOgFarge
+ //
+ this.buttonVisAlderOgFarge.Location = new System.Drawing.Point(16, 36);
+ this.buttonVisAlderOgFarge.Name = "buttonVisAlderOgFarge";
+ this.buttonVisAlderOgFarge.Size = new System.Drawing.Size(179, 23);
+ this.buttonVisAlderOgFarge.TabIndex = 2;
+ this.buttonVisAlderOgFarge.Text = "Vis alder og farge";
+ this.buttonVisAlderOgFarge.UseVisualStyleBackColor = true;
+ this.buttonVisAlderOgFarge.Click += new System.EventHandler(this.ButtonVisAlderOgFarge_Click);
+ //
+ // lblAlder
+ //
+ this.lblAlder.AutoSize = true;
+ this.lblAlder.Location = new System.Drawing.Point(313, 17);
+ this.lblAlder.Name = "lblAlder";
+ this.lblAlder.Size = new System.Drawing.Size(34, 13);
+ this.lblAlder.TabIndex = 3;
+ this.lblAlder.Text = "Alder:";
+ //
+ // textBoxAlder
+ //
+ this.textBoxAlder.Location = new System.Drawing.Point(354, 13);
+ this.textBoxAlder.Name = "textBoxAlder";
+ this.textBoxAlder.ReadOnly = true;
+ this.textBoxAlder.Size = new System.Drawing.Size(100, 20);
+ this.textBoxAlder.TabIndex = 4;
+ //
+ // textBoxFarge
+ //
+ this.textBoxFarge.Location = new System.Drawing.Point(354, 39);
+ this.textBoxFarge.Name = "textBoxFarge";
+ this.textBoxFarge.ReadOnly = true;
+ this.textBoxFarge.Size = new System.Drawing.Size(100, 20);
+ this.textBoxFarge.TabIndex = 6;
+ //
+ // label2
+ //
+ this.label2.AutoSize = true;
+ this.label2.Location = new System.Drawing.Point(313, 43);
+ this.label2.Name = "label2";
+ this.label2.Size = new System.Drawing.Size(37, 13);
+ this.label2.TabIndex = 5;
+ this.label2.Text = "Farge:";
+ //
+ // MainForm
+ //
+ this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
+ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+ this.ClientSize = new System.Drawing.Size(466, 174);
+ this.Controls.Add(this.textBoxFarge);
+ this.Controls.Add(this.label2);
+ this.Controls.Add(this.textBoxAlder);
+ this.Controls.Add(this.lblAlder);
+ this.Controls.Add(this.buttonVisAlderOgFarge);
+ this.Controls.Add(this.textBoxFodselsaar);
+ this.Controls.Add(this.label1);
+ this.Name = "MainForm";
+ this.Text = "Alder og farge - Oppgave 2 - Alex Thomassen";
+ this.ResumeLayout(false);
+ this.PerformLayout();
+
+ }
+
+ #endregion
+
+ private System.Windows.Forms.Label label1;
+ private System.Windows.Forms.TextBox textBoxFodselsaar;
+ private System.Windows.Forms.Button buttonVisAlderOgFarge;
+ private System.Windows.Forms.Label lblAlder;
+ private System.Windows.Forms.TextBox textBoxAlder;
+ private System.Windows.Forms.TextBox textBoxFarge;
+ private System.Windows.Forms.Label label2;
+ }
+}
+
diff --git a/ProveMai/OppgaveTo/MainForm.cs b/ProveMai/OppgaveTo/MainForm.cs
new file mode 100644
index 0000000..262a84a
--- /dev/null
+++ b/ProveMai/OppgaveTo/MainForm.cs
@@ -0,0 +1,74 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Data;
+using System.Drawing;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows.Forms;
+
+namespace OppgaveTo
+{
+ public partial class MainForm : Form
+ {
+ public MainForm()
+ {
+ InitializeComponent();
+ }
+
+ private int KalkulerAlder(int aarstall)
+ {
+ return Convert.ToInt32(DateTime.Now.Year) - aarstall;
+ }
+
+ private Color HentFarge(int alder)
+ {
+ // 17 år eller yngre
+ if (alder <= 17)
+ {
+ return Color.Red;
+ }
+
+ // Mellom 18-29 år
+ if (alder >= 18 && alder <= 29)
+ {
+ return Color.Yellow;
+ }
+
+ // Mellom 30-69 år
+ if (alder >= 30 && alder <= 69)
+ {
+ return Color.Green;
+ }
+
+ // "Alt annet", i dette tilfelle: 70 år og oppover
+ return Color.Blue;
+ }
+
+ private void ButtonVisAlderOgFarge_Click(object sender, EventArgs e)
+ {
+ string fAarText = textBoxFodselsaar.Text;
+ int fodselsaar;
+
+ try
+ {
+ fodselsaar = int.Parse(fAarText);
+ }
+ catch (FormatException ex)
+ {
+ MessageBox.Show("Fødselsår har ugyldig tallverdi!");
+ return;
+ }
+ catch (Exception ex)
+ {
+ MessageBox.Show($"En feil oppstod: {ex}");
+ return;
+ }
+
+ int alder = KalkulerAlder(fodselsaar);
+ textBoxAlder.Text = alder.ToString();
+ textBoxFarge.BackColor = HentFarge(alder);
+ }
+ }
+}
diff --git a/ProveMai/OppgaveTo/MainForm.resx b/ProveMai/OppgaveTo/MainForm.resx
new file mode 100644
index 0000000..1af7de1
--- /dev/null
+++ b/ProveMai/OppgaveTo/MainForm.resx
@@ -0,0 +1,120 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ text/microsoft-resx
+
+
+ 2.0
+
+
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
\ No newline at end of file
diff --git a/ProveMai/OppgaveTo/OppgaveTo.csproj b/ProveMai/OppgaveTo/OppgaveTo.csproj
new file mode 100644
index 0000000..a3e450d
--- /dev/null
+++ b/ProveMai/OppgaveTo/OppgaveTo.csproj
@@ -0,0 +1,83 @@
+
+
+
+
+ Debug
+ AnyCPU
+ {63F130CD-BADF-422C-A91B-88EF2A809113}
+ WinExe
+ OppgaveTo
+ OppgaveTo
+ v4.7.2
+ 512
+ true
+ true
+
+
+ AnyCPU
+ true
+ full
+ false
+ bin\Debug\
+ DEBUG;TRACE
+ prompt
+ 4
+
+
+ AnyCPU
+ pdbonly
+ true
+ bin\Release\
+ TRACE
+ prompt
+ 4
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Form
+
+
+ MainForm.cs
+
+
+
+
+ MainForm.cs
+
+
+ ResXFileCodeGenerator
+ Resources.Designer.cs
+ Designer
+
+
+ True
+ Resources.resx
+
+
+ SettingsSingleFileGenerator
+ Settings.Designer.cs
+
+
+ True
+ Settings.settings
+ True
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/ProveMai/OppgaveTo/Program.cs b/ProveMai/OppgaveTo/Program.cs
new file mode 100644
index 0000000..ef1d971
--- /dev/null
+++ b/ProveMai/OppgaveTo/Program.cs
@@ -0,0 +1,22 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Threading.Tasks;
+using System.Windows.Forms;
+
+namespace OppgaveTo
+{
+ static class Program
+ {
+ ///
+ /// The main entry point for the application.
+ ///
+ [STAThread]
+ static void Main()
+ {
+ Application.EnableVisualStyles();
+ Application.SetCompatibleTextRenderingDefault(false);
+ Application.Run(new MainForm());
+ }
+ }
+}
diff --git a/ProveMai/OppgaveTo/Properties/AssemblyInfo.cs b/ProveMai/OppgaveTo/Properties/AssemblyInfo.cs
new file mode 100644
index 0000000..a48f4c7
--- /dev/null
+++ b/ProveMai/OppgaveTo/Properties/AssemblyInfo.cs
@@ -0,0 +1,36 @@
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+// General Information about an assembly is controlled through the following
+// set of attributes. Change these attribute values to modify the information
+// associated with an assembly.
+[assembly: AssemblyTitle("OppgaveTo")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("")]
+[assembly: AssemblyProduct("OppgaveTo")]
+[assembly: AssemblyCopyright("Copyright © 2019")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+// Setting ComVisible to false makes the types in this assembly not visible
+// to COM components. If you need to access a type in this assembly from
+// COM, set the ComVisible attribute to true on that type.
+[assembly: ComVisible(false)]
+
+// The following GUID is for the ID of the typelib if this project is exposed to COM
+[assembly: Guid("63f130cd-badf-422c-a91b-88ef2a809113")]
+
+// Version information for an assembly consists of the following four values:
+//
+// Major Version
+// Minor Version
+// Build Number
+// Revision
+//
+// You can specify all the values or you can default the Build and Revision Numbers
+// by using the '*' as shown below:
+// [assembly: AssemblyVersion("1.0.*")]
+[assembly: AssemblyVersion("1.0.0.0")]
+[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/ProveMai/OppgaveTo/Properties/Resources.Designer.cs b/ProveMai/OppgaveTo/Properties/Resources.Designer.cs
new file mode 100644
index 0000000..892298a
--- /dev/null
+++ b/ProveMai/OppgaveTo/Properties/Resources.Designer.cs
@@ -0,0 +1,71 @@
+//------------------------------------------------------------------------------
+//
+// This code was generated by a tool.
+// Runtime Version:4.0.30319.42000
+//
+// Changes to this file may cause incorrect behavior and will be lost if
+// the code is regenerated.
+//
+//------------------------------------------------------------------------------
+
+namespace OppgaveTo.Properties
+{
+
+
+ ///
+ /// A strongly-typed resource class, for looking up localized strings, etc.
+ ///
+ // This class was auto-generated by the StronglyTypedResourceBuilder
+ // class via a tool like ResGen or Visual Studio.
+ // To add or remove a member, edit your .ResX file then rerun ResGen
+ // with the /str option, or rebuild your VS project.
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
+ internal class Resources
+ {
+
+ private static global::System.Resources.ResourceManager resourceMan;
+
+ private static global::System.Globalization.CultureInfo resourceCulture;
+
+ [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
+ internal Resources()
+ {
+ }
+
+ ///
+ /// Returns the cached ResourceManager instance used by this class.
+ ///
+ [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
+ internal static global::System.Resources.ResourceManager ResourceManager
+ {
+ get
+ {
+ if ((resourceMan == null))
+ {
+ global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("OppgaveTo.Properties.Resources", typeof(Resources).Assembly);
+ resourceMan = temp;
+ }
+ return resourceMan;
+ }
+ }
+
+ ///
+ /// Overrides the current thread's CurrentUICulture property for all
+ /// resource lookups using this strongly typed resource class.
+ ///
+ [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
+ internal static global::System.Globalization.CultureInfo Culture
+ {
+ get
+ {
+ return resourceCulture;
+ }
+ set
+ {
+ resourceCulture = value;
+ }
+ }
+ }
+}
diff --git a/ProveMai/OppgaveTo/Properties/Resources.resx b/ProveMai/OppgaveTo/Properties/Resources.resx
new file mode 100644
index 0000000..af7dbeb
--- /dev/null
+++ b/ProveMai/OppgaveTo/Properties/Resources.resx
@@ -0,0 +1,117 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ text/microsoft-resx
+
+
+ 2.0
+
+
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
\ No newline at end of file
diff --git a/ProveMai/OppgaveTo/Properties/Settings.Designer.cs b/ProveMai/OppgaveTo/Properties/Settings.Designer.cs
new file mode 100644
index 0000000..e1cc32c
--- /dev/null
+++ b/ProveMai/OppgaveTo/Properties/Settings.Designer.cs
@@ -0,0 +1,30 @@
+//------------------------------------------------------------------------------
+//
+// This code was generated by a tool.
+// Runtime Version:4.0.30319.42000
+//
+// Changes to this file may cause incorrect behavior and will be lost if
+// the code is regenerated.
+//
+//------------------------------------------------------------------------------
+
+namespace OppgaveTo.Properties
+{
+
+
+ [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")]
+ internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase
+ {
+
+ private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
+
+ public static Settings Default
+ {
+ get
+ {
+ return defaultInstance;
+ }
+ }
+ }
+}
diff --git a/ProveMai/OppgaveTo/Properties/Settings.settings b/ProveMai/OppgaveTo/Properties/Settings.settings
new file mode 100644
index 0000000..3964565
--- /dev/null
+++ b/ProveMai/OppgaveTo/Properties/Settings.settings
@@ -0,0 +1,7 @@
+
+
+
+
+
+
+
diff --git a/ProveMai/OppgaveTre/App.config b/ProveMai/OppgaveTre/App.config
new file mode 100644
index 0000000..56efbc7
--- /dev/null
+++ b/ProveMai/OppgaveTre/App.config
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/ProveMai/OppgaveTre/OppgaveTre.csproj b/ProveMai/OppgaveTre/OppgaveTre.csproj
new file mode 100644
index 0000000..42d7f73
--- /dev/null
+++ b/ProveMai/OppgaveTre/OppgaveTre.csproj
@@ -0,0 +1,53 @@
+
+
+
+
+ Debug
+ AnyCPU
+ {BB850093-63BF-415A-8ED5-4243EFEDDD2A}
+ Exe
+ OppgaveTre
+ OppgaveTre
+ v4.7.2
+ 512
+ true
+ true
+
+
+ AnyCPU
+ true
+ full
+ false
+ bin\Debug\
+ DEBUG;TRACE
+ prompt
+ 4
+
+
+ AnyCPU
+ pdbonly
+ true
+ bin\Release\
+ TRACE
+ prompt
+ 4
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/ProveMai/OppgaveTre/Program.cs b/ProveMai/OppgaveTre/Program.cs
new file mode 100644
index 0000000..691331e
--- /dev/null
+++ b/ProveMai/OppgaveTre/Program.cs
@@ -0,0 +1,40 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace OppgaveTre
+{
+ class Program
+ {
+ static void Main(string[] args)
+ {
+ int[] verdier = { 1000, 90, 255, 150, 14, 25, 2, 580, 380, 400 };
+ int midlertidig;
+
+ // Sortering - Bubblesort
+ for (int i = verdier.Length; i >= 1; i--)
+ {
+ for (int j = 0; j < i - 1; j++)
+ {
+ if (verdier[j] > verdier[j + 1])
+ {
+ midlertidig = verdier[j + 1];
+ verdier[j + 1] = verdier[j];
+ verdier[j] = midlertidig;
+ }
+ }
+ }
+
+ // Skriv ut sorterte verdier i array
+ Console.WriteLine("Sorterte verdier:");
+ for (int i = 0; i < verdier.Length; i++)
+ {
+ Console.WriteLine($"Index: {i} - Verdi: {verdier[i]}");
+ }
+
+ Console.ReadLine();
+ }
+ }
+}
diff --git a/ProveMai/OppgaveTre/Properties/AssemblyInfo.cs b/ProveMai/OppgaveTre/Properties/AssemblyInfo.cs
new file mode 100644
index 0000000..e4b8d86
--- /dev/null
+++ b/ProveMai/OppgaveTre/Properties/AssemblyInfo.cs
@@ -0,0 +1,36 @@
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+// General Information about an assembly is controlled through the following
+// set of attributes. Change these attribute values to modify the information
+// associated with an assembly.
+[assembly: AssemblyTitle("OppgaveTre")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("")]
+[assembly: AssemblyProduct("OppgaveTre")]
+[assembly: AssemblyCopyright("Copyright © 2019")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+// Setting ComVisible to false makes the types in this assembly not visible
+// to COM components. If you need to access a type in this assembly from
+// COM, set the ComVisible attribute to true on that type.
+[assembly: ComVisible(false)]
+
+// The following GUID is for the ID of the typelib if this project is exposed to COM
+[assembly: Guid("bb850093-63bf-415a-8ed5-4243efeddd2a")]
+
+// Version information for an assembly consists of the following four values:
+//
+// Major Version
+// Minor Version
+// Build Number
+// Revision
+//
+// You can specify all the values or you can default the Build and Revision Numbers
+// by using the '*' as shown below:
+// [assembly: AssemblyVersion("1.0.*")]
+[assembly: AssemblyVersion("1.0.0.0")]
+[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/ProveMai/ProveMai_AlexThomassen.sln b/ProveMai/ProveMai_AlexThomassen.sln
new file mode 100644
index 0000000..571762a
--- /dev/null
+++ b/ProveMai/ProveMai_AlexThomassen.sln
@@ -0,0 +1,37 @@
+
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio Version 16
+VisualStudioVersion = 16.0.28803.352
+MinimumVisualStudioVersion = 10.0.40219.1
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OppgaveEn", "OppgaveEn\OppgaveEn.csproj", "{14B2ADE7-42FB-4BE6-A6D1-20FB628347A6}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OppgaveTo", "OppgaveTo\OppgaveTo.csproj", "{63F130CD-BADF-422C-A91B-88EF2A809113}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OppgaveTre", "OppgaveTre\OppgaveTre.csproj", "{BB850093-63BF-415A-8ED5-4243EFEDDD2A}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Any CPU = Debug|Any CPU
+ Release|Any CPU = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {14B2ADE7-42FB-4BE6-A6D1-20FB628347A6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {14B2ADE7-42FB-4BE6-A6D1-20FB628347A6}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {14B2ADE7-42FB-4BE6-A6D1-20FB628347A6}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {14B2ADE7-42FB-4BE6-A6D1-20FB628347A6}.Release|Any CPU.Build.0 = Release|Any CPU
+ {63F130CD-BADF-422C-A91B-88EF2A809113}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {63F130CD-BADF-422C-A91B-88EF2A809113}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {63F130CD-BADF-422C-A91B-88EF2A809113}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {63F130CD-BADF-422C-A91B-88EF2A809113}.Release|Any CPU.Build.0 = Release|Any CPU
+ {BB850093-63BF-415A-8ED5-4243EFEDDD2A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {BB850093-63BF-415A-8ED5-4243EFEDDD2A}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {BB850093-63BF-415A-8ED5-4243EFEDDD2A}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {BB850093-63BF-415A-8ED5-4243EFEDDD2A}.Release|Any CPU.Build.0 = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+ GlobalSection(ExtensibilityGlobals) = postSolution
+ SolutionGuid = {6C036E91-A1D9-4780-B172-8BD0285FABA1}
+ EndGlobalSection
+EndGlobal
diff --git a/ProveMai/README_PLEASE.txt b/ProveMai/README_PLEASE.txt
new file mode 100644
index 0000000..37c2d8b
--- /dev/null
+++ b/ProveMai/README_PLEASE.txt
@@ -0,0 +1,6 @@
+Hei,
+
+Hver oppgave er lagt i tre forskjellige prosjekter, navngitt etter oppgave.
+Husk å velge riktig oppgave øverst (bør stå OppgaveEn/OppgaveTo/OppgaveTre til venstre for "Start"-knappen i Visual Studio) før du trykker på "Start"
+
+- Alex
\ No newline at end of file