the following escape sequences cause [] in listview. Is there any way to fix it?
Form1.cs :
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
namespace newLineInListView
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
StringBuilder sb = new StringBuilder();
sb.Append("\r");
sb.Append("1");
sb.Append("\n");
sb.Append("2");
sb.Append("\a");
sb.Append("3");
sb.Append("\b");
sb.Append("4");
sb.Append("\f");
sb.Append("5");
sb.Append("\t");
sb.Append("6");
sb.Append("\v");
sb.Append("7");
ListViewItem lvi = new ListViewItem(sb.ToString());
listView1.Items.Add(lvi);
}
}
}
Form1.Designer.cs :
namespace newLineInListView
{
partial class Form1
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.listView1 = new System.Windows.Forms.ListView();
this.columnHeader1 = new System.Windows.Forms.ColumnHeader();
this.SuspendLayout();
//
// listView1
//
this.listView1.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
this.columnHeader1});
this.listView1.Location = new System.Drawing.Point(71, 25);
this.listView1.Name = "listView1";
this.listView1.Size = new System.Drawing.Size(250, 145);
this.listView1.TabIndex = 0;
this.listView1.UseCompatibleStateImageBehavior = false;
this.listView1.View = System.Windows.Forms.View.Details;
//
// Form1
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(409, 289);
this.Controls.Add(this.listView1);
this.Name = "Form1";
this.Text = "Form1";
this.Load += new System.EventHandler(this.Form1_Load);
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.ListView listView1;
private System.Windows.Forms.ColumnHeader columnHeader1;
}
}
Getting te same.
But why does someone wants to display \a in a ListVIEW?
\a is the alert or bell character, I believe it is ASCII 7 so it is below ASCII 32(the space) and is as such non printable. Same as opening excel.exe in Word. Looks like rubbish because of the non printables.
I'm not even sure you can use some of those escape sequences in a listView, such as \n, can you? I don't think listview sorts things like textboxes, richtextboxes, etc... It's sorts by rows or columns so I don't even think a line return would work; or am I completely off on that?
Since the listview doesn't accept some of the linefeed commands, etc.., it shows the command as a special character. I'm guessing some of the characters differ in ALT codes between XP and Vista. Thus, the special character being displayed in Vista (or win7 in my case) would be read and displayed as a "[, ]" in XP.
they are some seperators showing some hierarchical relation between strings. i can not remove them. but anyway i think this is a known issue, i am not alone and i am going to mark this thread as solved by contributing to y'all's solved threads.
By the way i have a question for native english speakers : which one is correct
1) change its name as to be blah blah
2) change its name to be as blah blah
By the way i have a question for native english speakers : which one is correct
1) change its name as to be blah blah
2) change its name to be as blah blah
By the way i have a question for native english speakers : which one is correct
1) change its name as to be blah blah
2) change its name to be as blah blah
Come on guys, sometimes you want to make a sentence sound more dramatic or drastic. if you were to put as somewhere there, how would you insert it? I want that to sound more important than a simple name change.