I am new in list view .
I am using this code to display data from a text file in a list view,
int iRecords = 0;
int iDate = 0;
using (var sr = File.OpenText("C:\\test.txt"))
{
string line;
bool flag = true;
while ((line = sr.ReadLine()) != null)
{
string[] reader2 = line.Split(',');
string Date = reader2[0];
string rate = reader2[1];
string Sym = reader2[2];
double price = Convert.ToDouble(reader2[3]);
double Sell = Convert.ToDouble(reader2[4]);
double Buy = Convert.ToDouble(reader2[5]);
ListViewItem lItem = listView1.Items.Insert(iRecords, Date.ToString());
//lItem.SubItems.Add(Date.ToString());
lItem.UseItemStyleForSubItems = false;
lItem.SubItems.Add(rate .ToString());
lItem.SubItems.Add(Sym .ToString());
lItem.SubItems.Add(Sell.ToString(), Color.White, Color.Red, lItem.Font);
lItem.SubItems.Add(Buy .ToString()(), Color.Green, Color.Red, lItem.Font);
iRecords++;
}
}
In this code ,it is displaying the date from a text file
For example
- Apple – 5 Min,9532,Buy,20100104,90500,5225,5232,5210,5219.7,469950,0
- Apple – 5 Min,9532,Sell,20100104,91000,5221.25,5225.9,5215,5221.7,387650,0
the first three arrays are same , they are * Apple – 5 Min,9532
I want to display the first line as it is ,
and the second line from sell, i want to hide the first three arrays in the second line
and later for Mange the same
- Mango – 5 Min,9532,Buy,20100104,90500,5225
- Mango – 5 Min,9532,Sell,20100104,91000,5221.25
I wanto to display something like this in a listview
-
Mango – 5 Min,9532,Buy,20100104,90500,5225
Sell,20100104,91000,5221.25
Thanks In Advance.
Try This..
Set the width of the column/s you want to hide to 0.
Example:
lstVItem.Columns[0].Width = 0;