So I have a form. I want it to be an input form. So that a footballer can write how many goals he did in one season and then get sorted in a list after.
So the output should look something like this after a few footballers(four of them) have written their stats for the season:
Name Persnr District Number of goals
Footballer-Ian 4503038990 Greenic 17
1 footballer has reached level 3: 10-20 goals
Name Persnr District Number of goals
Footballer-Jan 3505038990 Wardengreen 27
1 footballer has reached level 3: 20-30 goals
And the two other footballers etc....
It does not look like this now. It looks like the attached file output below. I like how the form looks but I want it to output the right stuff also. And it should appear in that black box that normally happens when you run C-sharp I guess.
The existing code looks like this:
So the output should look something like this after a few footballers(four of them) have written their stats for the season:
Name Persnr District Number of goals
Footballer-Ian 4503038990 Greenic 17
1 footballer has reached level 3: 10-20 goals
Name Persnr District Number of goals
Footballer-Jan 3505038990 Wardengreen 27
1 footballer has reached level 3: 20-30 goals
And the two other footballers etc....
It does not look like this now. It looks like the attached file output below. I like how the form looks but I want it to output the right stuff also. And it should appear in that black box that normally happens when you run C-sharp I guess.
The existing code looks like this:
C#:
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 Bubble_sort_Form
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
//Kallar på funktionen.
run();
}
private void label1_Click(object sender, EventArgs e)
{
}
//Write all the functions in here----start
//funktions deklaration
void bubbleSort(ref int[] arr)
{
int n = arr.Length;
for (int i = 0; i < n - 1; i++)
for (int j = 0; j < n - i - 1; j++)
if (arr[j] > arr[j + 1])
{
// swap temp and arr[i]
int temp = arr[j];
arr[j] = arr[j + 1];
arr[j + 1] = temp;
}
}
/* Prints the array */
void printArray(int[] arr)
{
int n = arr.Length;
for (int i = 0; i < n; ++i)
{
label1.Text = label1.Text + arr[i] + Environment.NewLine;
}
}
// Driver method
void run()
{
int[] arr = { 0 - 50, 50 - 99, 100 - 199 };
bubbleSort(ref arr);
printArray(arr);
}
private void textBox2_TextChanged(object sender, EventArgs e)
{
}
//Write all the functions in here?----end
}
}
Attachments
Last edited: