Click here to Skip to main content
15,919,479 members
Home / Discussions / C#
   

C#

 
AnswerRe: Conversion of varchar datatype to a datetime resultant in an out renge value- Sql Server 2008 - Update Pin
#realJSOP7-Jul-11 3:08
professional#realJSOP7-Jul-11 3:08 
QuestionHow to create list of ALL file associations(friendly application names & executables) for file type Pin
JViljoen6-Jul-11 23:20
JViljoen6-Jul-11 23:20 
AnswerRe: How to create list of ALL file associations(friendly application names & executables) for file type Pin
Mario Majčica7-Jul-11 10:42
professionalMario Majčica7-Jul-11 10:42 
QuestionWindows Explorer like thumbnail selection in a list view Pin
9ine6-Jul-11 21:48
9ine6-Jul-11 21:48 
AnswerRe: Windows Explorer like thumbnail selection in a list view Pin
lukeer7-Jul-11 2:06
lukeer7-Jul-11 2:06 
AnswerRe: Windows Explorer like thumbnail selection in a list view Pin
9ine7-Jul-11 6:06
9ine7-Jul-11 6:06 
GeneralRe: Windows Explorer like thumbnail selection in a list view Pin
lukeer8-Jul-11 0:22
lukeer8-Jul-11 0:22 
QuestionFrom DataTable to multi-Line Chart Pin
Rminator6-Jul-11 20:49
Rminator6-Jul-11 20:49 
hey people,

i still have a problem about how to moove from a DataTable full with csv Value to a multi-line chart.
The fact is,in my DataTable,i have many value of censor(in °C,KWh,Mwh..)and i want to represent for each censor value a multi-line chart,with Date and time in X Axis,and with two Y axis the Legend and value of censor.

i joined a sample of csv to fell my DataTable

that is the part of my code

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.IO;
using Microsoft.VisualBasic;
using System.Globalization;
using System.Drawing.Drawing2D;
using ZedGraph;
using System.Linq;
using System.Windows.Forms.Integration;
      public DataTable BuildDataTable(string fileFullPath, char  seperator)
        {
            
            const int EOF = -1;
            DataTable myTable = new DataTable("MyTable");
            DataRow myRow;
            StreamReader myReader = new StreamReader(fileFullPath);
            string Set_Data = myReader.ReadLine();

            int Set_len = Set_Data.Length;
            try
            {
                myReader = new StreamReader(fileFullPath);
            }
            catch (Exception ex)
            {
                MessageBox.Show("Fout bij openen bestand: " + ex.Message);
                return new DataTable("Empty");
            }
            try
            // Open file and read first line to determine how many fields there are.            
            {
                string[] fieldValues = new string[Set_len];//myReader.ReadLine().Split(new Char[] { seperator, '\t' }); 
                //skip title               
                // Title = fieldValues[2];               
                //string [] Get_val  = myReader.ReadLine().Split(new Char[] { seperator, '\t' });

                //fieldValues = myReader.ReadLine().Split(new Char[] { seperator, '\t' });
                fieldValues = myReader.ReadLine().Split(new Char[] { seperator, '\t',  });

                // Adding the first line of data to data table (columnnames)                
                // Create data columns accordingly                
                for (int i = 0; i < fieldValues.Length; i++)
                {
                    //if (i==0) myTable.Columns.Add(new DataColumn("Code"));                   

                    //if (i==1) myTable.Columns.Add(new DataColumn("Datum"));                  
                    myTable.Columns.Add(new DataColumn(fieldValues[i].ToString().Trim()));
                }
                //Now reading the rest of the data to data table               
                while (myReader.Peek() != EOF)
                {
                    fieldValues = myReader.ReadLine().Split(new Char[] { seperator, '\t' });
                   
                    myRow = myTable.NewRow();
                    for (int i = 0; i < fieldValues.Length; i++)
                    {

                        myRow[i] = fieldValues[i].ToString().Trim();



                    }
                    myTable.Rows.Add(myRow);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Error building datatable: " + ex.Message);
                return new DataTable("Empty");
            }
            finally
            {
                if (myReader != null)
                {
                    myReader.Close();
                }
            }
            myTable.AcceptChanges();
            if (myReader != null)
            {
                myReader.Close();
            }
            dataGridView1.DataSource = myTable;           
              return myTable;
}
 public void Proces_File() 
        {
            char[] Separator = { ';', ':' };
            String Choose_File;
            DataTable DT;
            OpenFD.InitialDirectory = "Y:\\";
            OpenFD.Filter = "txt files(*.txt)|*.txt|All Files(*.*)|*.*";
            OpenFD.FilterIndex = 2;
            OpenFD.RestoreDirectory = true;
            if (OpenFD.ShowDialog() != DialogResult.Cancel) 
            {
                Choose_File = OpenFD.FileName;
                richTextBox1.LoadFile(Choose_File, RichTextBoxStreamType.PlainText);
                DT = BuildDataTable(OpenFD.FileName, ';');
                this.dataGridView1.DataSource = DT;
            
            
            }
  private void button3_Click(object sender, EventArgs e)
        {

            Proces_File();

        }

thx in advance
AnswerRe: From DataTable to multi-Line Chart Pin
BobJanova6-Jul-11 22:34
BobJanova6-Jul-11 22:34 
GeneralRe: From DataTable to multi-Line Chart Pin
Rminator6-Jul-11 22:39
Rminator6-Jul-11 22:39 
GeneralRe: From DataTable to multi-Line Chart Pin
BobJanova7-Jul-11 4:31
BobJanova7-Jul-11 4:31 
GeneralRe: From DataTable to multi-Line Chart Pin
Rminator7-Jul-11 4:59
Rminator7-Jul-11 4:59 
GeneralRe: From DataTable to multi-Line Chart Pin
Rminator14-Jul-11 20:26
Rminator14-Jul-11 20:26 
QuestionWindows Name Pin
M Riaz Bashir6-Jul-11 19:47
M Riaz Bashir6-Jul-11 19:47 
AnswerRe: Windows Name PinPopular
Wayne Gaylard6-Jul-11 20:42
professionalWayne Gaylard6-Jul-11 20:42 
GeneralRe: Windows Name Pin
M Riaz Bashir6-Jul-11 20:43
M Riaz Bashir6-Jul-11 20:43 
QuestionWhy is the Insert done once while there are 13 Records Pin
Vimalsoft(Pty) Ltd6-Jul-11 8:20
professionalVimalsoft(Pty) Ltd6-Jul-11 8:20 
AnswerRe: Why is the Insert done once while there are 13 Records Pin
#realJSOP6-Jul-11 8:44
professional#realJSOP6-Jul-11 8:44 
GeneralRe: Why is the Insert done once while there are 13 Records Pin
Vimalsoft(Pty) Ltd6-Jul-11 9:14
professionalVimalsoft(Pty) Ltd6-Jul-11 9:14 
AnswerRe: Why is the Insert done once while there are 13 Records Pin
GenJerDan6-Jul-11 9:19
GenJerDan6-Jul-11 9:19 
GeneralRe: Why is the Insert done once while there are 13 Records Pin
Vimalsoft(Pty) Ltd6-Jul-11 9:41
professionalVimalsoft(Pty) Ltd6-Jul-11 9:41 
AnswerRe: Why is the Insert done once while there are 13 Records Pin
PIEBALDconsult6-Jul-11 14:19
mvePIEBALDconsult6-Jul-11 14:19 
Questionhow to display the output from LM35 on pc in C# Pin
aeman6-Jul-11 4:47
aeman6-Jul-11 4:47 
AnswerRe: how to display the output from LM35 on pc in C# Pin
Alan N6-Jul-11 7:33
Alan N6-Jul-11 7:33 
GeneralRe: how to display the output from LM35 on pc in C# Pin
aeman6-Jul-11 22:14
aeman6-Jul-11 22:14 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.