Click here to Skip to main content
15,890,438 members
Home / Discussions / C#
   

C#

 
GeneralRe: SendMessage Pin
Richard MacCutchan7-Jul-16 20:39
mveRichard MacCutchan7-Jul-16 20:39 
GeneralRe: SendMessage Pin
sunsher10-Jul-16 12:53
sunsher10-Jul-16 12:53 
GeneralRe: SendMessage Pin
Richard MacCutchan10-Jul-16 22:42
mveRichard MacCutchan10-Jul-16 22:42 
GeneralRe: SendMessage Pin
sunsher11-Jul-16 13:41
sunsher11-Jul-16 13:41 
QuestionStack and Heap Pin
Member 111616257-Jul-16 17:13
Member 111616257-Jul-16 17:13 
AnswerRe: Stack and Heap Pin
Richard MacCutchan7-Jul-16 20:14
mveRichard MacCutchan7-Jul-16 20:14 
AnswerRe: Stack and Heap Pin
OriginalGriff7-Jul-16 20:42
mveOriginalGriff7-Jul-16 20:42 
QuestionStringbuilder printing "System.Collections.Generic.List" instead of the string item in the list, why? Pin
Member 122479807-Jul-16 3:56
Member 122479807-Jul-16 3:56 
Hello!^^ Im currently trying to take all parametres from an object(they are all strings) and pass onto a single string.
To do this i create 3 lists, the first is where all my objects are added, the second is one i use to add all the parametres from a single object from the first list. The second list only hold the parametres of 1 object at a time. When it has all the parametres of the single object it passes them on to my third and final list(and then clears itself) which is the list i want printed with my stringbuilder. If the objects in my first list only contain 1 string, it works just fine, but when the objects has several parametre values the stringbuilder result of the third list returns this : "System.Collections.Generic.Listxxx" instead of the string item in the list, why?

Here is some of the code:

C#
// First. All table items get thrown inhere for easier breaking up of their data                                                                                  // Line number:    // Product:     Price:     Start-date:     End-date:     Where:     Note:     Tipped-by:
      private List<aTableRow> allTableRows = new List<aTableRow>();

      // Second. Used to store the data for only a single table row at a time
      private List<string> singleTableRowValues = new List<string>();

      // Third. Final list with all the sorted strings of all table rows
      private List<string> finalList = new List<string>();


C#
public void SetTableContent()
{
    StringBuilder builder = new StringBuilder();

    // Take all objects from the list allTableRows individually and place all the items values in its own list, making it possible to string all the single items datavalues together with a stringbuilder.
    foreach (var tableRow in allTableRows)
    {
        singleTableRowValues.Add(tableRow.Product.ToString());
        singleTableRowValues.Add(tableRow.Price.ToString());
        singleTableRowValues.Add(tableRow.StartDate.ToString());
        singleTableRowValues.Add(tableRow.EndDate.ToString());
        singleTableRowValues.Add(tableRow.Where.ToString());
        singleTableRowValues.Add(tableRow.Note.ToString());
        singleTableRowValues.Add(tableRow.TippedBy.ToString());

        builder.Append(singleTableRowValues).Append(" - ");

        tableContent = builder.ToString();

        finalList.Add(tableContent);

        // Cleans up the converter list and table content so they are ready to convert next item.
        singleTableRowValues.Clear();
        tableContent = "";
    }

    foreach (var preparedItem in finalList)
    {
        builder.Append(singleTableRowValues).Append(" - ");

        allTableContent = builder.ToString();
    }
}

AnswerRe: Stringbuilder printing "System.Collections.Generic.List" instead of the string item in the list, why? Pin
Eddy Vluggen7-Jul-16 4:03
professionalEddy Vluggen7-Jul-16 4:03 
AnswerRe: Stringbuilder printing "System.Collections.Generic.List" instead of the string item in the list, why? Pin
Matt T Heffron7-Jul-16 7:35
professionalMatt T Heffron7-Jul-16 7:35 
QuestionHow to convert .docx file to .html with image and equation Pin
Member 44636384-Jul-16 5:32
Member 44636384-Jul-16 5:32 
AnswerRe: How to convert .docx file to .html with image and equation Pin
Eddy Vluggen4-Jul-16 6:27
professionalEddy Vluggen4-Jul-16 6:27 
AnswerRe: How to convert .docx file to .html with image and equation Pin
Kimberly Weldon5-Jul-16 1:13
Kimberly Weldon5-Jul-16 1:13 
AnswerRe: How to convert .docx file to .html with image and equation Pin
koolprasad20036-Jul-16 18:21
professionalkoolprasad20036-Jul-16 18:21 
Questionsimulate Alt+Shift in all objects of project C# Pin
hahaie3-Jul-16 22:22
hahaie3-Jul-16 22:22 
AnswerRe: simulate Alt+Shift in all objects of project C# Pin
OriginalGriff3-Jul-16 22:50
mveOriginalGriff3-Jul-16 22:50 
Questionhow to sum time in grid view footer c# Pin
Member 125037693-Jul-16 20:06
Member 125037693-Jul-16 20:06 
QuestionRe: how to sum time in grid view footer c# Pin
Richard MacCutchan3-Jul-16 22:05
mveRichard MacCutchan3-Jul-16 22:05 
AnswerRe: how to sum time in grid view footer c# Pin
Member 125037693-Jul-16 23:11
Member 125037693-Jul-16 23:11 
GeneralRe: how to sum time in grid view footer c# Pin
Richard MacCutchan3-Jul-16 23:20
mveRichard MacCutchan3-Jul-16 23:20 
QuestionC# - New to programming! Stuck! Can someone help explain this code? Pin
Member 126152642-Jul-16 4:21
Member 126152642-Jul-16 4:21 
AnswerRe: C# - New to programming! Stuck! Can someone help explain this code? Pin
Dave Kreskowiak2-Jul-16 5:15
mveDave Kreskowiak2-Jul-16 5:15 
AnswerRe: C# - New to programming! Stuck! Can someone help explain this code? Pin
Richard MacCutchan2-Jul-16 5:17
mveRichard MacCutchan2-Jul-16 5:17 
AnswerRe: C# - New to programming! Stuck! Can someone help explain this code? Pin
BillWoodruff3-Jul-16 1:55
professionalBillWoodruff3-Jul-16 1:55 
AnswerRe: C# - New to programming! Stuck! Can someone help explain this code? Pin
koolprasad20036-Jul-16 18:38
professionalkoolprasad20036-Jul-16 18:38 

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.