Click here to Skip to main content
15,846,145 members
Home / Discussions / C#
   

C#

 
GeneralRe: C# and AccDB: Products with category in combo box. Pin
Dave Kreskowiak16-Feb-15 15:27
mveDave Kreskowiak16-Feb-15 15:27 
GeneralRe: C# and AccDB: Products with category in combo box. Pin
sdfsdfsdfewrew3feff16-Feb-15 16:56
sdfsdfsdfewrew3feff16-Feb-15 16:56 
GeneralRe: C# and AccDB: Products with category in combo box. Pin
Dave Kreskowiak16-Feb-15 17:11
mveDave Kreskowiak16-Feb-15 17:11 
Questionerror is coming while application is running and ask to continue the application Pin
Member 1142314612-Feb-15 5:41
Member 1142314612-Feb-15 5:41 
AnswerRe: error is coming while application is running and ask to continue the application Pin
Dave Kreskowiak12-Feb-15 6:10
mveDave Kreskowiak12-Feb-15 6:10 
AnswerRe: error is coming while application is running and ask to continue the application Pin
OriginalGriff12-Feb-15 6:26
mveOriginalGriff12-Feb-15 6:26 
AnswerRe: error is coming while application is running and ask to continue the application Pin
jschell12-Feb-15 12:15
jschell12-Feb-15 12:15 
Questionaltering a merge sort to compare strings from input box Pin
Member 1083623511-Feb-15 22:10
Member 1083623511-Feb-15 22: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 22:41
mveRichard MacCutchan11-Feb-15 22:41 
GeneralRe: altering a merge sort to compare strings from input box Pin
harold aptroot11-Feb-15 22:42
harold aptroot11-Feb-15 22:42 
AnswerRe: altering a merge sort to compare strings from input box Pin
Pete O'Hanlon11-Feb-15 22:47
subeditorPete O'Hanlon11-Feb-15 22:47 
AnswerRe: altering a merge sort to compare strings from input box Pin
OriginalGriff11-Feb-15 23:01
mveOriginalGriff11-Feb-15 23:01 
GeneralRe: altering a merge sort to compare strings from input box Pin
Member 1083623512-Feb-15 0:23
Member 1083623512-Feb-15 0:23 
GeneralRe: altering a merge sort to compare strings from input box Pin
OriginalGriff12-Feb-15 0:49
mveOriginalGriff12-Feb-15 0:49 
QuestionDeclare the type of cell of DevExpress GridView ? Pin
Member 245846711-Feb-15 21:15
Member 245846711-Feb-15 21:15 
AnswerRe: Declare the type of cell of DevExpress GridView ? Pin
Dave Kreskowiak12-Feb-15 3:44
mveDave Kreskowiak12-Feb-15 3:44 
GeneralRe: Declare the type of cell of DevExpress GridView ? Pin
Member 245846715-Feb-15 20:49
Member 245846715-Feb-15 20:49 
GeneralRe: Declare the type of cell of DevExpress GridView ? Pin
Dave Kreskowiak16-Feb-15 3:41
mveDave Kreskowiak16-Feb-15 3:41 
GeneralRe: Declare the type of cell of DevExpress GridView ? Pin
Member 245846716-Feb-15 17:53
Member 245846716-Feb-15 17:53 
GeneralRe: Declare the type of cell of DevExpress GridView ? Pin
Dave Kreskowiak16-Feb-15 18:56
mveDave Kreskowiak16-Feb-15 18:56 
QuestionAny examples on using libsodium-net , saving keypairs, encrypt/decrypt files? Pin
vizimuchi11-Feb-15 9:32
vizimuchi11-Feb-15 9:32 
AnswerRe: Any examples on using libsodium-net , saving keypairs, encrypt/decrypt files? Pin
Afzaal Ahmad Zeeshan11-Feb-15 10:23
professionalAfzaal Ahmad Zeeshan11-Feb-15 10:23 
GeneralRe: Any examples on using libsodium-net , saving keypairs, encrypt/decrypt files? Pin
vizimuchi11-Feb-15 17:01
vizimuchi11-Feb-15 17:01 
QuestionHow can I open a webpage in IE and fill in 1 or more text boxes in the page? Pin
turbosupramk311-Feb-15 3:14
turbosupramk311-Feb-15 3: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 7:31
turbosupramk311-Feb-15 7: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.