Click here to Skip to main content
15,891,951 members
Home / Discussions / C#
   

C#

 
GeneralRe: C# and AccDB: Products with category in combo box. Pin
Dave Kreskowiak16-Feb-15 14:27
mveDave Kreskowiak16-Feb-15 14:27 
GeneralRe: C# and AccDB: Products with category in combo box. Pin
sdfsdfsdfewrew3feff16-Feb-15 15:56
sdfsdfsdfewrew3feff16-Feb-15 15:56 
GeneralRe: C# and AccDB: Products with category in combo box. Pin
Dave Kreskowiak16-Feb-15 16:11
mveDave Kreskowiak16-Feb-15 16:11 
Questionerror is coming while application is running and ask to continue the application Pin
Member 1142314612-Feb-15 4:41
Member 1142314612-Feb-15 4:41 
AnswerRe: error is coming while application is running and ask to continue the application Pin
Dave Kreskowiak12-Feb-15 5:10
mveDave Kreskowiak12-Feb-15 5:10 
AnswerRe: error is coming while application is running and ask to continue the application Pin
OriginalGriff12-Feb-15 5:26
mveOriginalGriff12-Feb-15 5:26 
AnswerRe: error is coming while application is running and ask to continue the application Pin
jschell12-Feb-15 11:15
jschell12-Feb-15 11:15 
Questionaltering a merge sort to compare strings from input box Pin
Member 1083623511-Feb-15 21:10
Member 1083623511-Feb-15 21:10 
I need to ALTER merge sort algorithm to get length of an array and enter strings then sort them alphabetically ... Im stuck on the sort...my code atm.... The code doesnt sort as I know that it isnt comparing the strings it works in the original form with numbers already hard coded as in ALL the things i have seen and i understand the int sorting but as i said earlier i want it to accept inputted strings and compare them alphabetically and am finding no guidance on how this is to be achieved apart from the compareTo method...so when this runs i get the strings inputed on the txtoutput UNSorted but cant seem to alter the mergeSort to sort the entered strings alphabetically

private void btnExecute_Click(object sender, EventArgs e)
{
int length = Int32.Parse(Microsoft.VisualBasic.Interaction.InputBox("Enter a Number for how many Names to Sort :"));

string[] nameArray = new string[length];
foreach (string n in nameArray)
{
string name = Microsoft.VisualBasic.Interaction.InputBox("Enter " + length + " Names to add to Array:");

length = length - 1;
txtOutput.Text += name + "\r\n";

}

txtOutput.Text += nameArray.Length + "Names Added to List Unsorted ";
txtOutput.Text += "Sorted List : " + "\r\n";
mergeSort(nameArray, 0, nameArray.Length - 1);
foreach (string i in nameArray)
{
txtOutput.Text += i +"\t";
}

public void mergeSort(string[] nameArray, int lower, int upper)
{
int middle;
if (upper == lower)
return;
else
{
middle = (lower + upper) / 2;
mergeSort(nameArray, lower, middle);
mergeSort(nameArray, middle + 1, upper);
Merge(nameArray, lower, middle + 1, upper);
}
}

public void Merge(string[] nameArray, int lower, int middle, int upper)
{
string[] temp = new string[nameArray.Length];
int lowEnd = middle - 1;
int low = lower;
int n = upper - lower + 1;
while ((lower <= lowEnd) && (middle <= upper))
{
if ((nameArray[lower]).CompareTo(nameArray[middle])<= 0)
{
temp[low] = nameArray[lower];
low++;
lower++;
}
else
{
temp[low] = nameArray[middle];
low++;
middle++;
}
}
while (lower &lt;= lowEnd)
{
temp[low] = nameArray[lower];
low++;
lower++;
}
while (middle &lt;= upper)
{
temp[low] = nameArray[middle];
low++;
middle++;
}
for (int i = 0; i &lt; n; i++)
{
nameArray[upper] = temp[upper];
upper--;
}
}

modified 12-Feb-15 6:50am.

AnswerRe: altering a merge sort to compare strings from input box Pin
Richard MacCutchan11-Feb-15 21:41
mveRichard MacCutchan11-Feb-15 21:41 
GeneralRe: altering a merge sort to compare strings from input box Pin
harold aptroot11-Feb-15 21:42
harold aptroot11-Feb-15 21:42 
AnswerRe: altering a merge sort to compare strings from input box Pin
Pete O'Hanlon11-Feb-15 21:47
mvePete O'Hanlon11-Feb-15 21:47 
AnswerRe: altering a merge sort to compare strings from input box Pin
OriginalGriff11-Feb-15 22:01
mveOriginalGriff11-Feb-15 22:01 
GeneralRe: altering a merge sort to compare strings from input box Pin
Member 1083623511-Feb-15 23:23
Member 1083623511-Feb-15 23:23 
GeneralRe: altering a merge sort to compare strings from input box Pin
OriginalGriff11-Feb-15 23:49
mveOriginalGriff11-Feb-15 23:49 
QuestionDeclare the type of cell of DevExpress GridView ? Pin
Member 245846711-Feb-15 20:15
Member 245846711-Feb-15 20:15 
AnswerRe: Declare the type of cell of DevExpress GridView ? Pin
Dave Kreskowiak12-Feb-15 2:44
mveDave Kreskowiak12-Feb-15 2:44 
GeneralRe: Declare the type of cell of DevExpress GridView ? Pin
Member 245846715-Feb-15 19:49
Member 245846715-Feb-15 19:49 
GeneralRe: Declare the type of cell of DevExpress GridView ? Pin
Dave Kreskowiak16-Feb-15 2:41
mveDave Kreskowiak16-Feb-15 2:41 
GeneralRe: Declare the type of cell of DevExpress GridView ? Pin
Member 245846716-Feb-15 16:53
Member 245846716-Feb-15 16:53 
GeneralRe: Declare the type of cell of DevExpress GridView ? Pin
Dave Kreskowiak16-Feb-15 17:56
mveDave Kreskowiak16-Feb-15 17:56 
QuestionAny examples on using libsodium-net , saving keypairs, encrypt/decrypt files? Pin
vizimuchi11-Feb-15 8:32
vizimuchi11-Feb-15 8:32 
AnswerRe: Any examples on using libsodium-net , saving keypairs, encrypt/decrypt files? Pin
Afzaal Ahmad Zeeshan11-Feb-15 9:23
professionalAfzaal Ahmad Zeeshan11-Feb-15 9:23 
GeneralRe: Any examples on using libsodium-net , saving keypairs, encrypt/decrypt files? Pin
vizimuchi11-Feb-15 16:01
vizimuchi11-Feb-15 16:01 
QuestionHow can I open a webpage in IE and fill in 1 or more text boxes in the page? Pin
turbosupramk311-Feb-15 2:14
turbosupramk311-Feb-15 2:14 
AnswerRe: How can I open a webpage in IE and fill in 1 or more text boxes in the page? Pin
turbosupramk311-Feb-15 6:31
turbosupramk311-Feb-15 6:31 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.