CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5
  1. #1
    Join Date
    Oct 2012
    Posts
    7

    Cool insert value to listview from calculations

    Hello guys, I'm beginner of C# here.. I already make my project for my research study in data mining....The problem comes when I need to put the value into listview from my calculation...Its outputs that I get is 123456 in horizontal...which is supposely the output is 123456 in vertical..so, its means, the listview have 6 rows where first row = 1, second row = 2, and so on...i give the picture so you guys can get clear what i mean...

    from this picture, i build two element which is richtextbox and listview....from my calculation, i get 123456 in vertical at richtextbox....but i get 123456 in horizontal at listview....my question is, how to make my listview get the same pattern result as richtextbox...it is possible??

    thank you for spending ur time read my problem
    Attached Images Attached Images  

  2. #2
    Join Date
    Oct 2012
    Posts
    7

    Re: insert value to listview from calculations

    this is supposely be ....


    Name:  h.jpg
Views: 675
Size:  90.6 KB

  3. #3
    Join Date
    Oct 2012
    Posts
    7

    Re: insert value to listview from calculations

    the picture below, i get by hardcoded the file.txt


    FileStream fileStreams = null;
    StreamReader streamReaders = null;
    DialogResult results = new DialogResult(); //Dialog result sets the openfile dialog result
    results = openFileDialog1.ShowDialog();
    string lines = "";

    if (results == DialogResult.OK) // Test result.
    {

    files = openFileDialog1.FileName; // file 123456 in vertical
    fileStreams = new FileStream(files, FileMode.Open);
    streamReaders = new StreamReader(fileStreams);
    while (!streamReaders.EndOfStream)
    {
    lines = streamReaders.ReadLine();
    ListViewItem lvis = new ListViewItem(lines);
    lv_SingleElement.Items.Add(lvis);
    }
    }

  4. #4
    Join Date
    Oct 2012
    Posts
    7

    Re: insert value to listview from calculations

    this is a calculation to find item support from transactions


    string output1 = "";
    string output = "";
    ListViewItem u = new ListViewItem();
    string lines = File.ReadAllText(@"C:\Users\ACER\Desktop\Apriori Demo\UCI dataset\testt.txt"); file Transactions
    string list = "";
    list = lines.Replace("\r\n", " ");
    output += list;
    string[] c = output.Split(' ');
    List<String> cc = new List<String>(c);
    cc.Sort();
    var fr = cc.GroupBy(n => n).Select(n => new { Value = n.Key });

    foreach (var f in fr)
    {
    string text2 = (string.Format("{0} ", f.Value));
    output1 += text2 + "\n";
    }

  5. #5
    Join Date
    Oct 2012
    Posts
    7

    Re: insert value to listview from calculations

    this is a calculation to find item support from transactions


    string output1 = "";
    string output = "";
    ListViewItem u = new ListViewItem();
    string lines = File.ReadAllText(@"C:\Users\ACER\Desktop\Apriori Demo\UCI dataset\testt.txt"); file Transactions
    string list = "";
    list = lines.Replace("\r\n", " ");
    output += list;
    string[] c = output.Split(' ');
    List<String> cc = new List<String>(c);
    cc.Sort();
    var fr = cc.GroupBy(n => n).Select(n => new { Value = n.Key });

    foreach (var f in fr)
    {
    string text2 = (string.Format("{0} ", f.Value));
    output1 += text2 + "\n";
    }

    return output1;

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured