Hi I keep getting an error message on my GUI when I am transferring my console p
ID: 3647854 • Letter: H
Question
HiI keep getting an error message on my GUI when I am transferring my console program to it. It is about to drive me nuts. I wanted to get user input for the numbers but went with a static array and still no luck.
Error message: Error 1 Type 'BubbleSorterGUI.bubbleSort' already defines a member called 'Dispose' with the same parameter types c:usersocdobbsdocumentsisual studio 2010ProjectsBubbleSorterGUIBubbleSorterGUIForm1.cs 18 33 BubbleSorterGUI
Code:using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace BubbleSorterGUI
{
public partial class bubbleSort : Form
{
public bubbleSort()
{
InitializeComponent();
}
protected override void Dispose(bool disposing);
private void Form1_Load(object sender, EventArgs e)
{
if (Disposing)
{
if (components != null)
{
components.Dispose();
}
}
base.Dispose(Disposing);
}
private void button1_Click(object sender, EventArgs e)
{
int[] ar = { 22, 6, 4, -7, 13, 12, 89, 68, 37, 44, -15 };
lblResult.Text = "items in original order ";
for (int i = 0; i < ar.Length; i++)
lblResult.Text += " " + ar[i];
BubbleSort(ar);
lblResult.Text += " items in ascending order ";
for (int i = 0; i < ar.Length; i++)
lblResult.Text += " " + ar[i];
}
public void BubbleSort( int[] ar )
{
for ( int pass = 1; pass < ar.Length; pass++ )
for ( int i = 0; i < ar.Length - 1; i++ )
if ( ar[ i ] > ar[ i + 1 ] )
Swap( ar, i );
}
public void Swap( int[] ar, int first )
{
int hold;
hold = ar[ first ];
ar[ first ] = ar[ first + 1 ];
ar[ first + 1 ] = hold;
}
}
}
Explanation / Answer
U r missing some brackets check that