[Øvingsoppgave 3] Kommentarer osv.

This commit is contained in:
Alex Thomassen 2019-03-07 08:30:09 +01:00
parent acc3dc5a86
commit c59b7c2290
Signed by: Alex
GPG Key ID: 10BD786B5F6FF5DE
2 changed files with 25 additions and 3 deletions

View File

@ -70,6 +70,7 @@
this.lblExceptionValueOne = new System.Windows.Forms.Label();
this.lblExceptionArrayValues = new System.Windows.Forms.Label();
this.txtExceptionArrayValues = new System.Windows.Forms.TextBox();
this.resetArrayException = new System.Windows.Forms.Button();
this.SuspendLayout();
//
// txtExVat
@ -418,7 +419,7 @@
//
this.lblExceptionArrayValues.AutoSize = true;
this.lblExceptionArrayValues.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.lblExceptionArrayValues.Location = new System.Drawing.Point(13, 384);
this.lblExceptionArrayValues.Location = new System.Drawing.Point(13, 407);
this.lblExceptionArrayValues.Name = "lblExceptionArrayValues";
this.lblExceptionArrayValues.Size = new System.Drawing.Size(85, 13);
this.lblExceptionArrayValues.TabIndex = 39;
@ -426,16 +427,27 @@
//
// txtExceptionArrayValues
//
this.txtExceptionArrayValues.Location = new System.Drawing.Point(105, 384);
this.txtExceptionArrayValues.Location = new System.Drawing.Point(105, 407);
this.txtExceptionArrayValues.Name = "txtExceptionArrayValues";
this.txtExceptionArrayValues.Size = new System.Drawing.Size(517, 20);
this.txtExceptionArrayValues.TabIndex = 40;
//
// resetArrayException
//
this.resetArrayException.Location = new System.Drawing.Point(16, 370);
this.resetArrayException.Name = "resetArrayException";
this.resetArrayException.Size = new System.Drawing.Size(75, 23);
this.resetArrayException.TabIndex = 41;
this.resetArrayException.Text = "Reset array";
this.resetArrayException.UseVisualStyleBackColor = true;
this.resetArrayException.Click += new System.EventHandler(this.resetArrayException_Click);
//
// OvingsOppgave
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(800, 450);
this.Controls.Add(this.resetArrayException);
this.Controls.Add(this.txtExceptionArrayValues);
this.Controls.Add(this.lblExceptionArrayValues);
this.Controls.Add(this.txtExceptionValueOne);
@ -531,6 +543,7 @@
private System.Windows.Forms.Label lblExceptionValueOne;
private System.Windows.Forms.Label lblExceptionArrayValues;
private System.Windows.Forms.TextBox txtExceptionArrayValues;
private System.Windows.Forms.Button resetArrayException;
}
}

View File

@ -99,10 +99,14 @@ namespace OvingsOppgaveTre
}
}
// Definer array utenfor metoden slik at den ikke overskrives
// hver gang man trykker på knappen.
private byte[] byteArray = new byte[6] { 0, 0, 0, 0, 0, 0 };
private void btnExceptionToArray_Click(object sender, EventArgs e)
{
byte[] byteArray = new byte[6] {0, 0, 0, 0, 0, 0};
// Tekstboks: "Inndeksnummer"
var indexText = txtExceptionIndexNum.Text;
// Tekstbox: "Oppgi tall som skal legges i array"
var arrayValueText = txtExceptionValueOne.Text;
try
@ -132,5 +136,10 @@ namespace OvingsOppgaveTre
MessageBox.Show("Test utført.");
}
}
private void resetArrayException_Click(object sender, EventArgs e)
{
byteArray = new byte[6] {0, 0, 0, 0, 0, 0};
}
}
}