Windows Forms - List Dialog String Builder adds a new line

I searched for about half an hour through Google to answer my question, but no one seems to have posted any solutions. I am working on a Windows Forms Application and has ListDialogBoxone that does not seem to accept any of the methods that I tried to display on a new line when I add display elements withStringBuilder

Code snippet:

public string VehicleInfo()

    // StringBuilder and List of Vehicles
    StringBuilder sb = new StringBuilder();
    List<Vehicle> _vehicles = new List<Vehicle>(Vehicle v1, Vehicle v2, and so on...);

    foreach (Vehicle v in _vehicles)
    {
        sb.Append(v.VIN);
        sb.Append(v.Make);
        sb.Append(v.Model);
        sb.Append(v.Year);
        sb.Append(v.Color);
        sb.Append(v.License);

        // Here is what I have tried
        sb.Append("\n");
        sb.Append("\\n");
        sb.Append("\r\n"); // Edit (I've tried this as well)
        sb.AppendLine();
        sb.AppendLine(Environment.NewLine);
    }
    return sb.ToString();
}

And then I add display items to the list dialog

ListDialog ld = new ListDialog();

ld.AddDisplayItems(Owner.ToString()); // The Owner to list Vehicles for
ld.AddDisplayItems(Owner.VehicleInfo()); // The list of vehicles the owner has

ld.ShowDialog();

, , . , , .

, StringBuilder Vehicle , , .

/ !

+4
1

.

 foreach (Vehicle v in _vehicles)
    {
        sb.Append(_vehicle.VIN);

v _vehiclele? , _vehicle, StringBuilder.

// Here is what I have tried
sb.Append("\n");

, AppendLine :

sb.AppendLine(_vehicle.VIN);

, AppendLine() - :

 sb.Append(_vehicle.VIN);
 sb.Append(_vehicle.Make);
 sb.Append(_vehicle.Model);
 sb.AppendLine();    

, "123456FordEscort", , ?

:

ListDialog ld = new ListDialog();

ListDialog?

0

All Articles