我怎麼能更改字符外殼在我的列表視圖爲大寫?當我在組合框中選擇大寫時,listview中的項目應該是大寫。我希望有人能幫助我。提前致謝。大寫項目
private void Form1_Load(object sender, EventArgs e)
{
showlv("SELECT a.customer_name, a.address, b.product_name, b.price FROM tbl_customer AS a INNER JOIN tbl_transaction AS b WHERE a.customer_code = b.customer_code", lvcust);
}
private void showlv(string sql, ListView lv)
{
try
{
lvcust.View = View.Details;
lvcust.FullRowSelect = true;
lvcust.GridLines = true;
conn.Open();
MySqlDataAdapter sda = new MySqlDataAdapter(sql, conn);
DataTable dt = new DataTable();
sda.Fill(dt);
conn.Close();
for (int i = 0; i < dt.Rows.Count; i++)
{
DataRow dr = dt.Rows[i];
ListViewItem lvitem = new ListViewItem(dr["customer_name"].ToString());
lvitem.SubItems.Add(dr["address"].ToString());
lvitem.SubItems.Add(dr["product_name"].ToString());
lvitem.SubItems.Add(dr["price"].ToString());
lvcust.Items.Add(lvitem);
}
string[] column = new string[4] { "Customer Name", "Address", "Product Name", "Price" };
for (int x = 0; x < column.Length ; x++)
{
lvcust.Columns.Add(column[x]);
}
}
catch (Exception er)
{
MessageBox.Show(er.Message);
}
}
private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
{
if (comboBox1.SelectedItem.Equals("Ascend"))
{
lvcust.Sorting = SortOrder.Ascending;
}
else if (comboBox1.SelectedItem.Equals("Descend"))
{
lvcust.Sorting = SortOrder.Descending;
}
else if (comboBox1.SelectedItem.Equals("Uppercase"))
{
//code to uppercase items in listview
}
}
String.ToUpper() –
你能請張貼整個代碼怎麼我是在這個新的語言。 – Jay
更容易,如果您發佈的代碼,你有什麼到目前爲止 –