SlideShare ist ein Scribd-Unternehmen logo
1 von 32
Downloaden Sie, um offline zu lesen
using Ben3A_B;
using System;
using System.Collections;
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;
//Ben Fulker this is project 3A and 3B
//Originally it was just about data structures, but now it’s the main interface
//of my final project. There are 7 tabs the first is the the exception button.
//This button has picture found on www.google.com and it was resized and raised. All of
//my still photos were edited with www.picresize.com. I took this project and
//added references from my other projects and they were consumed into this
//project. I have many forms and many buttons with animations throughout the
//project and took a boring GUI interface and made it into an exciting GUI.
//All animations were done with http://ezgif.com/resize. Look to the GUI for
//examples. This project covers everything but the webpage and window service as
//required for the project.
//It is all about data structures and exceptions
// and stepping into and out of breakpoints
namespace Ben3A_B //namespace is used in referencing a form EX.= Ben3A_B.Form1
{
public partial class Form1 : Form
{
public Form1() //form1 inherits from the base class form
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
textBox1.Text = "Button was clicked!";
//Change(); // this line would cause unhandled exception
try
{
changeText();
}
catch (Exception)
{
textBox1.Text = "Find This Code In button1_Click Event!!";
//this would catch divide by 0 in changeText as long
//as call is in a try since catch in changeText doesn't
//catch the DivideByZeroException
}
//insert break point by right clicking mouse on line you want
}
public void changeText()
{
textBox1.Text = "In changeText1!";
textBox1.Text = "Break Points Annoy me";
int a, b, c;
a = 5;
b = 0;
try
{
c = a / b;
//program flows to nearest catch up the call stack
}
catch (IndexOutOfRangeException)
{
textBox1.Text = "Catch in changeText!";
}
}
private void dataStructure_Click(Object sender, EventArgs e)
{
int[] EmployeeId = new int[5] { 9933, 1909, 9823, 7890, 3394 };
string[] EmployeeName = new string[5] {" - Matt Smith - - ",
" - Joanne Thomas- ", " - Robert Blake- - ",
" - Ben Fulker- - - ", " - Tom Dickens- - "};
string[] Identification = new string[5] { " - ID # ", "ID # ",
" ID # ", " - ID # ", "ID # " };
string[] Title = new string[5] { " Name: ", " Name: ", " Name: ",
" Name: ", " Name: " };
PrintValues(EmployeeId, EmployeeName, Identification, Title);
}
private void PrintValues(IEnumerable employId, IEnumerable names,
IEnumerable id, IEnumerable title)
{
//listBox1.Items.Clear();
// we cast it as an array in or der to for it to the data from the
// array at the begining
int[] EmployeeId = employId.Cast<int>().ToArray();
string[] EmployeeName = names.Cast<string>().ToArray();
string[] Identification = id.Cast<string>().ToArray();
string[] Title = title.Cast<string>().ToArray();
for (int i = 0; i < 5; i++)
listBox1.Items.Add(Title[i] + " - " + EmployeeName[i] + " " +
Identification[i] + " " + EmployeeId[i]);
}
private void Queue_Click(object sender, EventArgs e)
{
// Creates and initializes a new Queue.
Queue myQ = new Queue();
myQ.Enqueue(" I am (dequeued)");
myQ.Enqueue("This is also (dequeued)");
myQ.Enqueue(" Ben is ");
myQ.Enqueue(" a fox ");
// all the message boxes below show the process of is being done
// at that time Displays the Queue.
MessageBox.Show("Queue values:" + myQ);
// Removes an element from the Queue.
MessageBox.Show("(Dequeue)t{0}" + myQ.Dequeue());
// Displays the Queue.
MessageBox.Show("Queue values:" + myQ);
// Removes another element from the Queue.
MessageBox.Show("(Dequeue)t{0}" + myQ.Dequeue());
// Displays the Queue.
MessageBox.Show("Queue values:" + myQ);
// Views the first element in the Queue but does not remove it.
MessageBox.Show("(Peek) t{0}" + myQ.Peek());
// Displays the Queue.
MessageBox.Show("Queue values:" + myQ);
PrintValues(myQ);
}
// this print values populates listbox 2 after it the process
// is shown with message boxes of how or what each commmand
// above indicates
public void PrintValues(IEnumerable myCollection)
{
foreach (Object obj in myCollection)
listBox2.Items.Add(obj.ToString());
}
//This print values below is an extra one I created to
//populate list box 3, but I have it done another way
// in the myStack button event so I could show differnt
// ways of populating the list and I don't want to comment
// this out incase I ever change it
public void PrintValuesStack(IEnumerable myCollection)
{
foreach (Object obj in myCollection)
listBox3.Items.Add(obj.ToString());
}
// this populates my listButton event code to DS ListBox
//Tab into listButtonBox4.
public void PrintValuesList(IEnumerable myCollection)
{
foreach (Object obj in myCollection)
listButtonBox4.Items.Add(obj.ToString());
}
public void PrintValuesLink(IEnumerable myCollection)
{
foreach (Object obj in myCollection)
listButtonBox5.Items.Add(obj.ToString());
}
private void stackButton_Click(object sender, EventArgs e)
{
// new instance of a stack and de
Stack myStack = new Stack();
bool aBoolean = true;
char aCharacter = '#';
int anInteger = 1;
string aString = " Ben ";
string bString = " is ";
//create objects to store in the stack //use method Push to add items to stack
myStack.Push(aBoolean);
myStack.Peek();
myStack.Push(anInteger);
myStack.Peek();
myStack.Push(aCharacter);
myStack.Peek();
myStack.Push(bString);
myStack.Push(aString);
myStack.Peek();
bool myBoolean = true;
//remove items from stack
try
{
int count = 0;
while (myBoolean)
{
if (myStack.Count >= count)
{
object removedObject = myStack.Pop();
//populates listBox3 with removed objects and say it
// was popped
listBox3.Items.Add(removedObject + " popped");
//PrintValuesStack(myStack);
// this PrintValues is another way of poputlating
// I created a whole new PrintValueStack in order
// populate list 3 so if I un comment
// PrintValuesStack(myStack) above it will
// populate the list 2 times
count++;
}
else myBoolean = false;
} // end while
} // end try
catch (EmptyListException emptyListException)
{
//if exception occurs, write stack trace
MessageBox.Show(emptyListException.StackTrace);
}
PrintValuesStack(myStack);
}
private void listButton_Click(object sender, EventArgs e)
{
// Create a list of strings.
//Creates an instance of a string list Variable
var ben = new List<string>();
ben.Add(" Professor Vanselow ");
ben.Add(" Is A");
ben.Add(" Great ");
ben.Add(" Professor ");
// Iterate through the list.
foreach (var benjamin in ben)
{
MessageBox.Show(benjamin + " ");
//this message boxs runs through the process
// So someone learning like me it shows us what is
// happening as it goes through the list
}
PrintValuesList(ben);
// this just outputs or populates the associated listButtonBox4
// it show you the final result of the code
// Output: chinook coho pink sockey
}
private void linkedListButton_Click(object sender, EventArgs e)
//this is an event handler
{
LinkedList<int> alist = new LinkedList<int>();
//this is creation of an instance of a list in a linkedlist
//These are all the commands or for what we want the
//list to do
alist.AddFirst(10); // Contents: ->10
alist.AddLast(15); // Contents: ->10->15
alist.AddLast(3); // Contents: ->10->15->3
alist.AddLast(99); // Contents: ->10->15->3->99
alist.AddBefore(alist.Last, 25); // Contents: ->10->15->3->25->99
//this line
foreach (int linklist in alist)
{
MessageBox.Show(linklist + " ");
//This message box show the user what step the code is
//iterating through its not needed, but useful for a
// beginier
}
PrintValuesLink(alist);
//listButtonBox5.Items.Add(alist);
}
private void project1InitButton_Click(object sender, EventArgs e)
{
//Form1 proj1 = new Form1();
//proj1.RefToForm1 = this;
//this.Visible = false;
Form frm1 = new Ben_1B.Form1();
frm1.Show();
//this brings up project 1B's form and allows the user to acess its GUI
}
private void proj1BInitButton_Click(object sender, EventArgs e)
{
Form frm1 = new Ben_1A.Form2();
frm1.Show();
//this brings up project 1A's form and allows the user to acess its GUI
}
private void button2_Click(object sender, EventArgs e)
{
Hide();
// this is a button click to close the program
}
private void dataBaseButton3_Click(object sender, EventArgs e)
{
Form frm1 = new WindowsFormsApplication1.Main();
frm1.Show();
}
private void OOPbutton3_Click(object sender, EventArgs e)
{
Form frm1 = new Ben_Project_2A.form1();
frm1.Show();
}
private void button3_Click(object sender, EventArgs e)
{
Form frm1 = new Ben3A_B.Form2();
frm1.Show();
}
}
}
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 Ben_1A
{
//Benjamin Fulker
//Project 1A
// this project was for the GUI interface with many different lines
// of code that had labels, or text boxes that are filled with data
// when you click the established button
public partial class Form2 : Form
{
public Form2()
{
InitializeComponent();
}
private void showInteger_Click(object sender, EventArgs e)
//the line above is an event handler it generates automatically
//generated by double clicking the button
//private is an access modifier can only call this file within
//this file
//edit - advanced - format document will fix indentation
{
int a = 5; //OK click the show int a is assigned a value
//this next line is an example of a basic algorithm declared inside
//of an int variable type and it's answer becomes the actual
//assigned value of the declared variable and it's put in place
//of all instances of the int = b.
int b = a + 2; //Then for int b it take int = a and adds 2 **
// Error. Operator '+' cannot be applied to operands of type 'int'
//and 'bool'.
//int c = a + test;
demoOutput.Text = b.ToString(); // this calls the int b only
// the the named demoOutput because '+' can be called as a string
//even though it was instantained as an int type
//also in this text box I have an initial set text value of
//My 1A Demo Program and when I call int = b as b = "" it changes
//the initial set text value to the called value from declared variable
//assigned as a string with the value of "7" not 7 because it is now an
//assigned string value "" and not an int value
}
private void DataDefinition_Click(object sender, EventArgs e)
{
string Data = "A data type determines what value a variable can" +
"contain/hold and what operations can be performed by an" +
"instance of that variable";
DatatextBox.Text = Data.ToString(); //this is the command that
//calls the string variable called Data to the text box named
//DatatextBox DataDefinitioin button when clicked activates and
//initiates the method so the string variable Data = "" and makes
//it visible in the in the DatatextBox
}
private void garbageCollectionDefinition_Click(object sender, EventArgs e)
{
string Garbage = "A process for automatic recovery of a" +
"heap in memory";
GarbagetextBox.Text = Garbage.ToString();
//garbageCollectionDefintion button it activates the variable
//Garbage = "" and makes it's contents visible in the in Text box
//titled GarbagetextBox
}
private void stackDefinition_Click(object sender, EventArgs e)
{
string Stack = "A region of reserved memory in which programs store" +
"status data such as a procedures and function calls and " +
" the functions's location or index address, " +
"passed parameters, and sometimes local variables.";
StacktextBox.Text = Stack.ToString();
// stackDefinition button activates the string variable Stack = ""
//and it calls the string to the text box titled StacktextBox
}
private void heapDefinition_Click(object sender, EventArgs e)
{
string Heap = "is a portion of memeory for running programs to" +
"allocate temporary memory for the purpose of storing data" +
"in the form of structures whose existence" +
"or size cannot be determined until the program is running";
HeaptextBox.Text = Heap.ToString();
// heapDefinition button calls the string variable Heap = "" to
// the Heaptextbox in the GUI
}
private void algorithmDefintion_Click(object sender, EventArgs e)
{
string Algorithm = "A finite sequence of steps for solving logical" +
"or mathematical problem or performing a task.";
AlgorithmtextBox.Text = Algorithm.ToString();
// algorithmDefinition button initiates the string variable
//Algorithm = "" and calls the algoritim defintion to the text box
//titled AlgorithmtextBox
}
private void ParseInteger_Click(object sender, EventArgs e)
{
int Double = 7;
{
Double value = (Double * Double);
DoublertextBox.Text = value.ToString();
// most of the lines of code below were pulled from w3shools
//and copied So I chould have a local reference of how this is
//done for later with out having open the site later to have an
//example System.Console.WriteLine(array1[x].ToString());
//x++;
/* NOT
bool result = true;
if (!result)
{
Console.WriteLine("The condition is true (result is false).");
}
else
{
Console.WriteLine("The condition is false (result is true).");
}
// Short-circuit AND
int m = 9;
int n = 7;
int p = 5;
if (m >= n && m >= p)
{
Console.WriteLine("Nothing is larger than m.");
}
// AND and NOT
if (m >= n && !(p > m))
{
Console.WriteLine("Nothing is larger than m.");
}
// Short-circuit OR
if (m > n || m > p)
{
Console.WriteLine("m isn't the smallest.");
}
// NOT and OR
m = 4;
if (!(m >= n || m >= p))
{
Console.WriteLine("Now m is the smallest.");
}
// Output:
// The condition is false (result is true).
// Nothing is larger than m.
// Nothing is larger than m.
// m isn't the smallest.
// Now m is the smallest. */
}
// private void ParseInteger_DoubleClick(object sender, EventArgs e);
// int caseSwitch = 1;
// switch (caseSwitch)
// {
// case 1:
// Console.WriteLine("Case 1");
// break;
// case 2:
// Console.WriteLine("Case 2");
// break;
// default:
// Console.WriteLine("Default case");
// break; /*
}
private void iterateDefinition_Click(object sender, EventArgs e)
{
string Iterate = "To execute one statements or a block of statements" +
"repeatedely. its what make a loop go around one loop is one iteration";
IterationtextBox.Text = Iterate.ToString();
// example
// for(int i = 0; i < 10; i++)
// Console.WriteLine("it iterates or repeats this line 10 times")
// there
}
private void recursionDefinition_Click(object sender, EventArgs e)
{
string Recursion = "Is the ability of a routine to call itself.";
RecursiontextBox.Text = Recursion.ToString();
// the purpose of a recursion is for it to call itself and factor
// out a portion until it get as close to the base case as possible
// base case is base of something like in math (2n, 2n-1) etc.
// on Proj portion 2
}
private void exceptionsDefinition_Click(object sender, EventArgs e)
{
string Exception = "a problem or change in conditions that causes" +
"the microprocessor to stop what it is doing and handle the" +
"situation in a separate routine.";
exceptionTextBox.Text = Exception.ToString();
//This is an Exception which programming language for an Error
// if done right you try a decision statement or loop or if or for
// statement then you use a catch which hopefully catches your
//exception and show a error message and you have a choice how
//that messages is shown to the user. In C# it has 21 library
// functions for exceptions plus you can really type what ever
//message for the error you are catching that you want.
}
private void button1_Click(object sender, EventArgs e)
{
Hide(); //This button hides this form and takes us back to my
//main project titled Form and project Ben3A-3B
}
}
}
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 Ben_1B
{
// Ben Fulker
//This is part of my final project its reference was imported to my
//final project
// Project 1B
// This Project was to create GUI interface with a loop, recursion and
// division. Every Instance has more than one method or option
// of coding I left one active so the GUI will run and the commented out
// I have one in each active and the other commented out, They are all
//worked without bugs and were tested. There is a for loop that was converted
//from a while loop. An dandy recursion example with a mean Algorithm it calls
//itself and over and over until the final answer is 79
// in this project I also made some examples of try, catch, throw in terms of
// exception handling
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void ShowLoop_Click_1(object sender, EventArgs e)
{
//for (int x = 0; x < 3; x++)
// listOutput.Items.Add(x);
for (int num = 1; num < 20; num++)
listOutput.Items.Add(num);
// I chose l because loops
//this for loop was changed from a while loop.
//The condition (num < 20), the iteration is num++, the int and
// counteris (num =1)
//int n = 5;
//while (++n < 6);
//listOutput.Items.Add(n);
//Console.WriteLine("Current value of n is {0}", n);
}
private void Recursionbutton_Click(object sender, EventArgs e)
{
int result2 = negative(-3);
RecursiontextBox.Text = "The Final Answer is " + result2;
//int result = identity(10);
//RecursiontextBox.Text = "The Final Answer is " + result;
}
public int negative(int num) // negative = identity
{
if(num >= 20)
return -5;
else
return negative(num + 4) + 2 * num; // here is where
// the identity = negative calls itself and then calculates the
// the rest algorithm
// I have 2 recursion options in here I chose the more difficult
// of the 2 for my working example
//public int identity(int num)
//if(num < 1)
//return 10;
//else
//return num + identity(num - 2);
}
private void Divide_Click(object sender, EventArgs e)
{
int num1 = 0;
try
{
num1 = Int32.Parse(txtNum1.Text); //this lets you put a number
// in the text box titled txtNum1
//this if statement and messagebox lets you know you know
// if there is an error in num1 box
}
catch (Exception) // this catches errors like not entering
//a number in the box
{
MessageBox.Show("Error"); //This brings up a Messagebox
// says error for num1 text box
//throw;
}
int num2;
if (Int32.TryParse(txtNum2.Text, out num2) == false) //this lets
// you put a number in the text box titled txtNum2
//this if statement and messagebox lets you know you know
// if there is an error in num2 box
{
MessageBox.Show("Num 2 Error"); //This brings up a Messagebox
// says error for num2 text box
return;
}
double result = 0;
// type try then tab tab to create code block for try and catch
try
{
result = num1 / num2; //try do divide entered numbers
}
catch (Exception) //exception if you Num2 box is 0
// you can't divide by 0 it would be undefined.
{
MessageBox.Show("Cant divide by 0");
return;
//I added this exception so it would catch divided by 0 error
//throw;
}
try
{
result = Convert.ToDouble(num1) / num2; // this line allows
// decimal answers other wise it would just say 0 if it was an
//answer less than 1 now it gives a decimal answer.
label1.Text = result.ToString();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
// The second argument to Show appears
// at the top of the messagebox.
// Paramater variable ex is an exception object.
// The Throw part of a try catch throw block allows you to
//continue on manually with the errors
}
}
private void button1_Click(object sender, EventArgs e)
{
Hide();
//this hides form 1B and brings you back to Ben3A-3B
}
// label text erased and I changed border style to fixed 3d; and
//Auto-size dimension changed from true to false so label is visible
}
}
final project for C#
final project for C#
final project for C#
final project for C#
final project for C#
final project for C#
final project for C#
final project for C#
final project for C#
final project for C#
final project for C#
final project for C#
final project for C#
final project for C#
final project for C#
final project for C#

Weitere ähnliche Inhalte

Was ist angesagt?

Parra maxi IF THEN ELSE
Parra maxi IF THEN ELSEParra maxi IF THEN ELSE
Parra maxi IF THEN ELSE
gabo2200
 
Christian rodriguez then else
Christian rodriguez then   elseChristian rodriguez then   else
Christian rodriguez then else
gabo2200
 
Federico landinez docx
Federico landinez docxFederico landinez docx
Federico landinez docx
gabo2200
 
Guevara rene if then., else
Guevara rene  if then., elseGuevara rene  if then., else
Guevara rene if then., else
gabo2200
 
Federico landinez docx
Federico landinez docxFederico landinez docx
Federico landinez docx
gabo2200
 
Noguera jesus
Noguera jesusNoguera jesus
Noguera jesus
gabo2200
 

Was ist angesagt? (19)

Parra maxi IF THEN ELSE
Parra maxi IF THEN ELSEParra maxi IF THEN ELSE
Parra maxi IF THEN ELSE
 
Java File
Java FileJava File
Java File
 
culadora cientifica en java
culadora cientifica en javaculadora cientifica en java
culadora cientifica en java
 
Christian rodriguez then else
Christian rodriguez then   elseChristian rodriguez then   else
Christian rodriguez then else
 
Federico landinez docx
Federico landinez docxFederico landinez docx
Federico landinez docx
 
Guevara rene if then., else
Guevara rene  if then., elseGuevara rene  if then., else
Guevara rene if then., else
 
Federico landinez docx
Federico landinez docxFederico landinez docx
Federico landinez docx
 
Noguera jesus
Noguera jesusNoguera jesus
Noguera jesus
 
C# Starter L07-Objects Cloning
C# Starter L07-Objects CloningC# Starter L07-Objects Cloning
C# Starter L07-Objects Cloning
 
Ete programs
Ete programsEte programs
Ete programs
 
Borrar
BorrarBorrar
Borrar
 
Posfix
PosfixPosfix
Posfix
 
Entity Framework Core: tips and tricks
Entity Framework Core: tips and tricksEntity Framework Core: tips and tricks
Entity Framework Core: tips and tricks
 
.net progrmming part4
.net progrmming part4.net progrmming part4
.net progrmming part4
 
Ejercicio sql server vs visual .net
Ejercicio sql server vs visual .netEjercicio sql server vs visual .net
Ejercicio sql server vs visual .net
 
Windows Phone Launchers and Choosers
Windows Phone Launchers and ChoosersWindows Phone Launchers and Choosers
Windows Phone Launchers and Choosers
 
Swift 함수 커링 사용하기
Swift 함수 커링 사용하기Swift 함수 커링 사용하기
Swift 함수 커링 사용하기
 
C program to insert a node in doubly linked list
C program to insert a node in doubly linked listC program to insert a node in doubly linked list
C program to insert a node in doubly linked list
 
beyond tellerrand: Mobile Apps with JavaScript – There's More Than Web
beyond tellerrand: Mobile Apps with JavaScript – There's More Than Webbeyond tellerrand: Mobile Apps with JavaScript – There's More Than Web
beyond tellerrand: Mobile Apps with JavaScript – There's More Than Web
 

Andere mochten auch

Report of Previous Project by Yifan Guo
Report of Previous Project by Yifan GuoReport of Previous Project by Yifan Guo
Report of Previous Project by Yifan Guo
Yifan Guo
 
AUTOMATIZACION DEL CALCULO DE DIAGRAMA DE INTERACCION PARA EL DISEÑO EN FLEXO...
AUTOMATIZACION DEL CALCULO DE DIAGRAMA DE INTERACCION PARA EL DISEÑO EN FLEXO...AUTOMATIZACION DEL CALCULO DE DIAGRAMA DE INTERACCION PARA EL DISEÑO EN FLEXO...
AUTOMATIZACION DEL CALCULO DE DIAGRAMA DE INTERACCION PARA EL DISEÑO EN FLEXO...
Fritz Ccamsaya Huillca
 

Andere mochten auch (17)

What Heck Is Mobile Marketing? For Hospitality & Tourism
What Heck Is Mobile Marketing? For Hospitality & TourismWhat Heck Is Mobile Marketing? For Hospitality & Tourism
What Heck Is Mobile Marketing? For Hospitality & Tourism
 
Synopsis gennemgang
Synopsis gennemgangSynopsis gennemgang
Synopsis gennemgang
 
Report of Previous Project by Yifan Guo
Report of Previous Project by Yifan GuoReport of Previous Project by Yifan Guo
Report of Previous Project by Yifan Guo
 
Los cristianos
Los cristianosLos cristianos
Los cristianos
 
Презентация к занятию "Космическое путешествие"
Презентация к занятию "Космическое путешествие"Презентация к занятию "Космическое путешествие"
Презентация к занятию "Космическое путешествие"
 
Tarea
TareaTarea
Tarea
 
Edad media
Edad mediaEdad media
Edad media
 
National Publishing Company (Repaired)
National Publishing Company (Repaired)National Publishing Company (Repaired)
National Publishing Company (Repaired)
 
National publishing company
National publishing companyNational publishing company
National publishing company
 
Los Flujos Migratorios
Los Flujos Migratorios Los Flujos Migratorios
Los Flujos Migratorios
 
безопасный детский сад
безопасный детский садбезопасный детский сад
безопасный детский сад
 
Проект "Птичье молоко"
Проект "Птичье молоко"Проект "Птичье молоко"
Проект "Птичье молоко"
 
La variable ambiental urbana
La variable ambiental urbanaLa variable ambiental urbana
La variable ambiental urbana
 
Unit2 communication
Unit2 communicationUnit2 communication
Unit2 communication
 
UNDERSTANDING THE TECHNOLOGY OF THE DARAKI-CHATTAN CUPULES: THE CUPULE REPLIC...
UNDERSTANDING THE TECHNOLOGY OF THE DARAKI-CHATTAN CUPULES: THE CUPULE REPLIC...UNDERSTANDING THE TECHNOLOGY OF THE DARAKI-CHATTAN CUPULES: THE CUPULE REPLIC...
UNDERSTANDING THE TECHNOLOGY OF THE DARAKI-CHATTAN CUPULES: THE CUPULE REPLIC...
 
Maratones de lectura - guía primaria.
Maratones de lectura - guía primaria.Maratones de lectura - guía primaria.
Maratones de lectura - guía primaria.
 
AUTOMATIZACION DEL CALCULO DE DIAGRAMA DE INTERACCION PARA EL DISEÑO EN FLEXO...
AUTOMATIZACION DEL CALCULO DE DIAGRAMA DE INTERACCION PARA EL DISEÑO EN FLEXO...AUTOMATIZACION DEL CALCULO DE DIAGRAMA DE INTERACCION PARA EL DISEÑO EN FLEXO...
AUTOMATIZACION DEL CALCULO DE DIAGRAMA DE INTERACCION PARA EL DISEÑO EN FLEXO...
 

Ähnlich wie final project for C#

Write a program that mimics the operations of several vending machin.pdf
Write a program that mimics the operations of several vending machin.pdfWrite a program that mimics the operations of several vending machin.pdf
Write a program that mimics the operations of several vending machin.pdf
eyebolloptics
 
Use the following data set that compares age to average years lef.docx
Use the following data set that compares age to average years lef.docxUse the following data set that compares age to average years lef.docx
Use the following data set that compares age to average years lef.docx
dickonsondorris
 
Needs to be solved with Visual C# from the book Starting oout .pdf
Needs to be solved with Visual C# from the book Starting oout .pdfNeeds to be solved with Visual C# from the book Starting oout .pdf
Needs to be solved with Visual C# from the book Starting oout .pdf
foottraders
 
Assignment is Page 349-350 #4 and #5 Use the Linked Lis.pdf
Assignment is Page 349-350 #4 and #5 Use the Linked Lis.pdfAssignment is Page 349-350 #4 and #5 Use the Linked Lis.pdf
Assignment is Page 349-350 #4 and #5 Use the Linked Lis.pdf
formicreation
 
Form1.csusing System; using System.Collections.Generic; using .pdf
Form1.csusing System; using System.Collections.Generic; using .pdfForm1.csusing System; using System.Collections.Generic; using .pdf
Form1.csusing System; using System.Collections.Generic; using .pdf
apleather
 
Working with Layout Managers. Notes 1. In part 2, note that the Gam.pdf
Working with Layout Managers. Notes 1. In part 2, note that the Gam.pdfWorking with Layout Managers. Notes 1. In part 2, note that the Gam.pdf
Working with Layout Managers. Notes 1. In part 2, note that the Gam.pdf
udit652068
 
File LinkedList.java Defines a doubly-l.pdf
File LinkedList.java Defines a doubly-l.pdfFile LinkedList.java Defines a doubly-l.pdf
File LinkedList.java Defines a doubly-l.pdf
Conint29
 
Java ProgrammingImplement an auction application with the followin.pdf
Java ProgrammingImplement an auction application with the followin.pdfJava ProgrammingImplement an auction application with the followin.pdf
Java ProgrammingImplement an auction application with the followin.pdf
atulkapoor33
 
C# Program. Create a Windows application that has the functionality .pdf
C# Program. Create a Windows application that has the functionality .pdfC# Program. Create a Windows application that has the functionality .pdf
C# Program. Create a Windows application that has the functionality .pdf
fathimalinks
 

Ähnlich wie final project for C# (20)

C# labprograms
C# labprogramsC# labprograms
C# labprograms
 
Write a program that mimics the operations of several vending machin.pdf
Write a program that mimics the operations of several vending machin.pdfWrite a program that mimics the operations of several vending machin.pdf
Write a program that mimics the operations of several vending machin.pdf
 
Use the following data set that compares age to average years lef.docx
Use the following data set that compares age to average years lef.docxUse the following data set that compares age to average years lef.docx
Use the following data set that compares age to average years lef.docx
 
My Portfolio
My PortfolioMy Portfolio
My Portfolio
 
Needs to be solved with Visual C# from the book Starting oout .pdf
Needs to be solved with Visual C# from the book Starting oout .pdfNeeds to be solved with Visual C# from the book Starting oout .pdf
Needs to be solved with Visual C# from the book Starting oout .pdf
 
Assignment is Page 349-350 #4 and #5 Use the Linked Lis.pdf
Assignment is Page 349-350 #4 and #5 Use the Linked Lis.pdfAssignment is Page 349-350 #4 and #5 Use the Linked Lis.pdf
Assignment is Page 349-350 #4 and #5 Use the Linked Lis.pdf
 
PROGRAMMING USING C#.NET SARASWATHI RAMALINGAM
PROGRAMMING USING C#.NET SARASWATHI RAMALINGAMPROGRAMMING USING C#.NET SARASWATHI RAMALINGAM
PROGRAMMING USING C#.NET SARASWATHI RAMALINGAM
 
03 Geographic scripting in uDig - halfway between user and developer
03 Geographic scripting in uDig - halfway between user and developer03 Geographic scripting in uDig - halfway between user and developer
03 Geographic scripting in uDig - halfway between user and developer
 
Windows Forms For Beginners Part 5
Windows Forms For Beginners Part 5Windows Forms For Beginners Part 5
Windows Forms For Beginners Part 5
 
The Ring programming language version 1.3 book - Part 83 of 88
The Ring programming language version 1.3 book - Part 83 of 88The Ring programming language version 1.3 book - Part 83 of 88
The Ring programming language version 1.3 book - Part 83 of 88
 
Form1.csusing System; using System.Collections.Generic; using .pdf
Form1.csusing System; using System.Collections.Generic; using .pdfForm1.csusing System; using System.Collections.Generic; using .pdf
Form1.csusing System; using System.Collections.Generic; using .pdf
 
Membuat aplikasi penjualan buku sederhana
Membuat aplikasi penjualan buku sederhanaMembuat aplikasi penjualan buku sederhana
Membuat aplikasi penjualan buku sederhana
 
Java scriptfunction
Java scriptfunctionJava scriptfunction
Java scriptfunction
 
Working with Layout Managers. Notes 1. In part 2, note that the Gam.pdf
Working with Layout Managers. Notes 1. In part 2, note that the Gam.pdfWorking with Layout Managers. Notes 1. In part 2, note that the Gam.pdf
Working with Layout Managers. Notes 1. In part 2, note that the Gam.pdf
 
Tutorial 6.docx
Tutorial 6.docxTutorial 6.docx
Tutorial 6.docx
 
Creating a Whatsapp Clone - Part IV.pdf
Creating a Whatsapp Clone - Part IV.pdfCreating a Whatsapp Clone - Part IV.pdf
Creating a Whatsapp Clone - Part IV.pdf
 
Pedoman Pembuatan Sebuah Aplikasi
Pedoman Pembuatan Sebuah AplikasiPedoman Pembuatan Sebuah Aplikasi
Pedoman Pembuatan Sebuah Aplikasi
 
File LinkedList.java Defines a doubly-l.pdf
File LinkedList.java Defines a doubly-l.pdfFile LinkedList.java Defines a doubly-l.pdf
File LinkedList.java Defines a doubly-l.pdf
 
Java ProgrammingImplement an auction application with the followin.pdf
Java ProgrammingImplement an auction application with the followin.pdfJava ProgrammingImplement an auction application with the followin.pdf
Java ProgrammingImplement an auction application with the followin.pdf
 
C# Program. Create a Windows application that has the functionality .pdf
C# Program. Create a Windows application that has the functionality .pdfC# Program. Create a Windows application that has the functionality .pdf
C# Program. Create a Windows application that has the functionality .pdf
 

final project for C#

  • 1. using Ben3A_B; using System; using System.Collections; 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; //Ben Fulker this is project 3A and 3B //Originally it was just about data structures, but now it’s the main interface //of my final project. There are 7 tabs the first is the the exception button. //This button has picture found on www.google.com and it was resized and raised. All of //my still photos were edited with www.picresize.com. I took this project and //added references from my other projects and they were consumed into this //project. I have many forms and many buttons with animations throughout the //project and took a boring GUI interface and made it into an exciting GUI. //All animations were done with http://ezgif.com/resize. Look to the GUI for //examples. This project covers everything but the webpage and window service as //required for the project. //It is all about data structures and exceptions // and stepping into and out of breakpoints namespace Ben3A_B //namespace is used in referencing a form EX.= Ben3A_B.Form1 { public partial class Form1 : Form { public Form1() //form1 inherits from the base class form { InitializeComponent(); } private void button1_Click(object sender, EventArgs e) { textBox1.Text = "Button was clicked!"; //Change(); // this line would cause unhandled exception try { changeText(); } catch (Exception) { textBox1.Text = "Find This Code In button1_Click Event!!"; //this would catch divide by 0 in changeText as long //as call is in a try since catch in changeText doesn't //catch the DivideByZeroException } //insert break point by right clicking mouse on line you want } public void changeText() { textBox1.Text = "In changeText1!"; textBox1.Text = "Break Points Annoy me"; int a, b, c; a = 5; b = 0; try { c = a / b; //program flows to nearest catch up the call stack } catch (IndexOutOfRangeException) {
  • 2. textBox1.Text = "Catch in changeText!"; } } private void dataStructure_Click(Object sender, EventArgs e) { int[] EmployeeId = new int[5] { 9933, 1909, 9823, 7890, 3394 }; string[] EmployeeName = new string[5] {" - Matt Smith - - ", " - Joanne Thomas- ", " - Robert Blake- - ", " - Ben Fulker- - - ", " - Tom Dickens- - "}; string[] Identification = new string[5] { " - ID # ", "ID # ", " ID # ", " - ID # ", "ID # " }; string[] Title = new string[5] { " Name: ", " Name: ", " Name: ", " Name: ", " Name: " }; PrintValues(EmployeeId, EmployeeName, Identification, Title); } private void PrintValues(IEnumerable employId, IEnumerable names, IEnumerable id, IEnumerable title) { //listBox1.Items.Clear(); // we cast it as an array in or der to for it to the data from the // array at the begining int[] EmployeeId = employId.Cast<int>().ToArray(); string[] EmployeeName = names.Cast<string>().ToArray(); string[] Identification = id.Cast<string>().ToArray(); string[] Title = title.Cast<string>().ToArray(); for (int i = 0; i < 5; i++) listBox1.Items.Add(Title[i] + " - " + EmployeeName[i] + " " + Identification[i] + " " + EmployeeId[i]); } private void Queue_Click(object sender, EventArgs e) { // Creates and initializes a new Queue. Queue myQ = new Queue(); myQ.Enqueue(" I am (dequeued)"); myQ.Enqueue("This is also (dequeued)"); myQ.Enqueue(" Ben is "); myQ.Enqueue(" a fox "); // all the message boxes below show the process of is being done // at that time Displays the Queue. MessageBox.Show("Queue values:" + myQ); // Removes an element from the Queue. MessageBox.Show("(Dequeue)t{0}" + myQ.Dequeue()); // Displays the Queue. MessageBox.Show("Queue values:" + myQ); // Removes another element from the Queue. MessageBox.Show("(Dequeue)t{0}" + myQ.Dequeue()); // Displays the Queue. MessageBox.Show("Queue values:" + myQ); // Views the first element in the Queue but does not remove it. MessageBox.Show("(Peek) t{0}" + myQ.Peek()); // Displays the Queue. MessageBox.Show("Queue values:" + myQ); PrintValues(myQ); } // this print values populates listbox 2 after it the process // is shown with message boxes of how or what each commmand // above indicates public void PrintValues(IEnumerable myCollection) { foreach (Object obj in myCollection) listBox2.Items.Add(obj.ToString()); } //This print values below is an extra one I created to //populate list box 3, but I have it done another way // in the myStack button event so I could show differnt
  • 3. // ways of populating the list and I don't want to comment // this out incase I ever change it public void PrintValuesStack(IEnumerable myCollection) { foreach (Object obj in myCollection) listBox3.Items.Add(obj.ToString()); } // this populates my listButton event code to DS ListBox //Tab into listButtonBox4. public void PrintValuesList(IEnumerable myCollection) { foreach (Object obj in myCollection) listButtonBox4.Items.Add(obj.ToString()); } public void PrintValuesLink(IEnumerable myCollection) { foreach (Object obj in myCollection) listButtonBox5.Items.Add(obj.ToString()); } private void stackButton_Click(object sender, EventArgs e) { // new instance of a stack and de Stack myStack = new Stack(); bool aBoolean = true; char aCharacter = '#'; int anInteger = 1; string aString = " Ben "; string bString = " is "; //create objects to store in the stack //use method Push to add items to stack myStack.Push(aBoolean); myStack.Peek(); myStack.Push(anInteger); myStack.Peek(); myStack.Push(aCharacter); myStack.Peek(); myStack.Push(bString); myStack.Push(aString); myStack.Peek(); bool myBoolean = true; //remove items from stack try { int count = 0; while (myBoolean) { if (myStack.Count >= count) { object removedObject = myStack.Pop(); //populates listBox3 with removed objects and say it // was popped listBox3.Items.Add(removedObject + " popped"); //PrintValuesStack(myStack); // this PrintValues is another way of poputlating // I created a whole new PrintValueStack in order // populate list 3 so if I un comment // PrintValuesStack(myStack) above it will // populate the list 2 times count++; } else myBoolean = false; } // end while } // end try catch (EmptyListException emptyListException) { //if exception occurs, write stack trace
  • 4. MessageBox.Show(emptyListException.StackTrace); } PrintValuesStack(myStack); } private void listButton_Click(object sender, EventArgs e) { // Create a list of strings. //Creates an instance of a string list Variable var ben = new List<string>(); ben.Add(" Professor Vanselow "); ben.Add(" Is A"); ben.Add(" Great "); ben.Add(" Professor "); // Iterate through the list. foreach (var benjamin in ben) { MessageBox.Show(benjamin + " "); //this message boxs runs through the process // So someone learning like me it shows us what is // happening as it goes through the list } PrintValuesList(ben); // this just outputs or populates the associated listButtonBox4 // it show you the final result of the code // Output: chinook coho pink sockey } private void linkedListButton_Click(object sender, EventArgs e) //this is an event handler { LinkedList<int> alist = new LinkedList<int>(); //this is creation of an instance of a list in a linkedlist //These are all the commands or for what we want the //list to do alist.AddFirst(10); // Contents: ->10 alist.AddLast(15); // Contents: ->10->15 alist.AddLast(3); // Contents: ->10->15->3 alist.AddLast(99); // Contents: ->10->15->3->99 alist.AddBefore(alist.Last, 25); // Contents: ->10->15->3->25->99 //this line foreach (int linklist in alist) { MessageBox.Show(linklist + " "); //This message box show the user what step the code is //iterating through its not needed, but useful for a // beginier } PrintValuesLink(alist); //listButtonBox5.Items.Add(alist); } private void project1InitButton_Click(object sender, EventArgs e) { //Form1 proj1 = new Form1(); //proj1.RefToForm1 = this; //this.Visible = false; Form frm1 = new Ben_1B.Form1(); frm1.Show(); //this brings up project 1B's form and allows the user to acess its GUI } private void proj1BInitButton_Click(object sender, EventArgs e) { Form frm1 = new Ben_1A.Form2(); frm1.Show(); //this brings up project 1A's form and allows the user to acess its GUI
  • 5. } private void button2_Click(object sender, EventArgs e) { Hide(); // this is a button click to close the program } private void dataBaseButton3_Click(object sender, EventArgs e) { Form frm1 = new WindowsFormsApplication1.Main(); frm1.Show(); } private void OOPbutton3_Click(object sender, EventArgs e) { Form frm1 = new Ben_Project_2A.form1(); frm1.Show(); } private void button3_Click(object sender, EventArgs e) { Form frm1 = new Ben3A_B.Form2(); frm1.Show(); } } }
  • 6.
  • 7.
  • 8.
  • 9. 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 Ben_1A { //Benjamin Fulker //Project 1A // this project was for the GUI interface with many different lines // of code that had labels, or text boxes that are filled with data // when you click the established button public partial class Form2 : Form { public Form2() { InitializeComponent(); } private void showInteger_Click(object sender, EventArgs e) //the line above is an event handler it generates automatically //generated by double clicking the button //private is an access modifier can only call this file within //this file //edit - advanced - format document will fix indentation { int a = 5; //OK click the show int a is assigned a value //this next line is an example of a basic algorithm declared inside //of an int variable type and it's answer becomes the actual
  • 10. //assigned value of the declared variable and it's put in place //of all instances of the int = b. int b = a + 2; //Then for int b it take int = a and adds 2 ** // Error. Operator '+' cannot be applied to operands of type 'int' //and 'bool'. //int c = a + test; demoOutput.Text = b.ToString(); // this calls the int b only // the the named demoOutput because '+' can be called as a string //even though it was instantained as an int type //also in this text box I have an initial set text value of //My 1A Demo Program and when I call int = b as b = "" it changes //the initial set text value to the called value from declared variable //assigned as a string with the value of "7" not 7 because it is now an //assigned string value "" and not an int value } private void DataDefinition_Click(object sender, EventArgs e) { string Data = "A data type determines what value a variable can" + "contain/hold and what operations can be performed by an" + "instance of that variable"; DatatextBox.Text = Data.ToString(); //this is the command that //calls the string variable called Data to the text box named //DatatextBox DataDefinitioin button when clicked activates and //initiates the method so the string variable Data = "" and makes //it visible in the in the DatatextBox } private void garbageCollectionDefinition_Click(object sender, EventArgs e) { string Garbage = "A process for automatic recovery of a" + "heap in memory"; GarbagetextBox.Text = Garbage.ToString(); //garbageCollectionDefintion button it activates the variable //Garbage = "" and makes it's contents visible in the in Text box //titled GarbagetextBox } private void stackDefinition_Click(object sender, EventArgs e) { string Stack = "A region of reserved memory in which programs store" + "status data such as a procedures and function calls and " + " the functions's location or index address, " + "passed parameters, and sometimes local variables."; StacktextBox.Text = Stack.ToString(); // stackDefinition button activates the string variable Stack = "" //and it calls the string to the text box titled StacktextBox } private void heapDefinition_Click(object sender, EventArgs e) { string Heap = "is a portion of memeory for running programs to" + "allocate temporary memory for the purpose of storing data" + "in the form of structures whose existence" + "or size cannot be determined until the program is running"; HeaptextBox.Text = Heap.ToString(); // heapDefinition button calls the string variable Heap = "" to // the Heaptextbox in the GUI } private void algorithmDefintion_Click(object sender, EventArgs e) { string Algorithm = "A finite sequence of steps for solving logical" + "or mathematical problem or performing a task."; AlgorithmtextBox.Text = Algorithm.ToString(); // algorithmDefinition button initiates the string variable //Algorithm = "" and calls the algoritim defintion to the text box //titled AlgorithmtextBox }
  • 11. private void ParseInteger_Click(object sender, EventArgs e) { int Double = 7; { Double value = (Double * Double); DoublertextBox.Text = value.ToString(); // most of the lines of code below were pulled from w3shools //and copied So I chould have a local reference of how this is //done for later with out having open the site later to have an //example System.Console.WriteLine(array1[x].ToString()); //x++; /* NOT bool result = true; if (!result) { Console.WriteLine("The condition is true (result is false)."); } else { Console.WriteLine("The condition is false (result is true)."); } // Short-circuit AND int m = 9; int n = 7; int p = 5; if (m >= n && m >= p) { Console.WriteLine("Nothing is larger than m."); } // AND and NOT if (m >= n && !(p > m)) { Console.WriteLine("Nothing is larger than m."); } // Short-circuit OR if (m > n || m > p) { Console.WriteLine("m isn't the smallest."); } // NOT and OR m = 4; if (!(m >= n || m >= p)) { Console.WriteLine("Now m is the smallest."); } // Output: // The condition is false (result is true). // Nothing is larger than m. // Nothing is larger than m. // m isn't the smallest. // Now m is the smallest. */ } // private void ParseInteger_DoubleClick(object sender, EventArgs e); // int caseSwitch = 1; // switch (caseSwitch) // { // case 1: // Console.WriteLine("Case 1"); // break; // case 2:
  • 12. // Console.WriteLine("Case 2"); // break; // default: // Console.WriteLine("Default case"); // break; /* } private void iterateDefinition_Click(object sender, EventArgs e) { string Iterate = "To execute one statements or a block of statements" + "repeatedely. its what make a loop go around one loop is one iteration"; IterationtextBox.Text = Iterate.ToString(); // example // for(int i = 0; i < 10; i++) // Console.WriteLine("it iterates or repeats this line 10 times") // there } private void recursionDefinition_Click(object sender, EventArgs e) { string Recursion = "Is the ability of a routine to call itself."; RecursiontextBox.Text = Recursion.ToString(); // the purpose of a recursion is for it to call itself and factor // out a portion until it get as close to the base case as possible // base case is base of something like in math (2n, 2n-1) etc. // on Proj portion 2 } private void exceptionsDefinition_Click(object sender, EventArgs e) { string Exception = "a problem or change in conditions that causes" + "the microprocessor to stop what it is doing and handle the" + "situation in a separate routine."; exceptionTextBox.Text = Exception.ToString(); //This is an Exception which programming language for an Error // if done right you try a decision statement or loop or if or for // statement then you use a catch which hopefully catches your //exception and show a error message and you have a choice how //that messages is shown to the user. In C# it has 21 library // functions for exceptions plus you can really type what ever //message for the error you are catching that you want. } private void button1_Click(object sender, EventArgs e) { Hide(); //This button hides this form and takes us back to my //main project titled Form and project Ben3A-3B } } }
  • 13.
  • 14. 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 Ben_1B { // Ben Fulker //This is part of my final project its reference was imported to my //final project // Project 1B // This Project was to create GUI interface with a loop, recursion and // division. Every Instance has more than one method or option // of coding I left one active so the GUI will run and the commented out // I have one in each active and the other commented out, They are all //worked without bugs and were tested. There is a for loop that was converted //from a while loop. An dandy recursion example with a mean Algorithm it calls //itself and over and over until the final answer is 79 // in this project I also made some examples of try, catch, throw in terms of // exception handling public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void ShowLoop_Click_1(object sender, EventArgs e) { //for (int x = 0; x < 3; x++) // listOutput.Items.Add(x); for (int num = 1; num < 20; num++) listOutput.Items.Add(num); // I chose l because loops
  • 15. //this for loop was changed from a while loop. //The condition (num < 20), the iteration is num++, the int and // counteris (num =1) //int n = 5; //while (++n < 6); //listOutput.Items.Add(n); //Console.WriteLine("Current value of n is {0}", n); } private void Recursionbutton_Click(object sender, EventArgs e) { int result2 = negative(-3); RecursiontextBox.Text = "The Final Answer is " + result2; //int result = identity(10); //RecursiontextBox.Text = "The Final Answer is " + result; } public int negative(int num) // negative = identity { if(num >= 20) return -5; else return negative(num + 4) + 2 * num; // here is where // the identity = negative calls itself and then calculates the // the rest algorithm // I have 2 recursion options in here I chose the more difficult // of the 2 for my working example //public int identity(int num) //if(num < 1) //return 10; //else //return num + identity(num - 2); } private void Divide_Click(object sender, EventArgs e) { int num1 = 0; try { num1 = Int32.Parse(txtNum1.Text); //this lets you put a number // in the text box titled txtNum1 //this if statement and messagebox lets you know you know // if there is an error in num1 box } catch (Exception) // this catches errors like not entering //a number in the box { MessageBox.Show("Error"); //This brings up a Messagebox // says error for num1 text box //throw; } int num2; if (Int32.TryParse(txtNum2.Text, out num2) == false) //this lets // you put a number in the text box titled txtNum2 //this if statement and messagebox lets you know you know // if there is an error in num2 box { MessageBox.Show("Num 2 Error"); //This brings up a Messagebox // says error for num2 text box return; } double result = 0; // type try then tab tab to create code block for try and catch try { result = num1 / num2; //try do divide entered numbers }
  • 16. catch (Exception) //exception if you Num2 box is 0 // you can't divide by 0 it would be undefined. { MessageBox.Show("Cant divide by 0"); return; //I added this exception so it would catch divided by 0 error //throw; } try { result = Convert.ToDouble(num1) / num2; // this line allows // decimal answers other wise it would just say 0 if it was an //answer less than 1 now it gives a decimal answer. label1.Text = result.ToString(); } catch (Exception ex) { MessageBox.Show(ex.Message); // The second argument to Show appears // at the top of the messagebox. // Paramater variable ex is an exception object. // The Throw part of a try catch throw block allows you to //continue on manually with the errors } } private void button1_Click(object sender, EventArgs e) { Hide(); //this hides form 1B and brings you back to Ben3A-3B } // label text erased and I changed border style to fixed 3d; and //Auto-size dimension changed from true to false so label is visible } }