Mitja Bonca 557 Nearly a Posting Maven

This should do the trick:

public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void numericUpDown1_ValueChanged(object sender, EventArgs e)
        {
            DisablingButton();
        }

        private void numericUpDown2_ValueChanged(object sender, EventArgs e)
        {
            DisablingButton();
        }

        private void DisablingButton()
        {
            decimal value1 = numericUpDown1.Value;
            decimal value2 = numericUpDown2.Value;
            if (value1 > 0 && value2 > 0)
                button1.Enabled = false;
            else
                button1.Enabled = true;
        }
    }

Hope it helps,
Mitja

Mitja Bonca 557 Nearly a Posting Maven

Have you ever worked with retrieving data from dataBase, using sqlCOnnection?
What you have to do is:

Ok I have done a simple example of how to use parameters - pass them between methods and populate contols with them.

private void button1_Click(object sender, EventArgs e)
        {
            string item = this.textBox1.Text;
            if (item.Length > 0)
            {
                this.listBox1.Items.Clear();
                DataTable table = GetDataFromDB(item);
                foreach (DataRow dr in table.Rows)
                    this.listBox1.Items.Add(dr[0].ToString());
            }
        }

        private static string dbSqlConn = ConfigurationManager.ConnectionStrings["sqlConnectionString"].ConnectionString;
        //"sqlConnectionString" is a name of your connection string
        private void GetDataFromDB(string item)
        {
            using (DataTable table = new DataTable("ListOfCities"))
            {
                using (SqlConnection sqlConn = new SqlConnection())
                {
                    string sqlQuery = @"SELECT City FROM Cities WERE Country = @country";
                    using (SqlCommand cmd = new SqlCommand(sqlQuery, sqlConn))
                    {
                        using (SqlDataAdapter da = new SqlDataAdapter(cmd))
                            da.Fill(table);
                    }
                }
                return table;
            }
        }

name of the connection string you find in the file app.Config. If oyu have no clue refer HERE.

Hope this helps a bit... just keep it slow.
Mitja

Mitja Bonca 557 Nearly a Posting Maven

There is a better option:
Allow users to enter a full telephone number, without brackets and dashes. The number like 6303452532 - all together. If the number have to be a type of long. Then you do the checking if the value is really a long. If its not user has to repair the number. If its OK, with confirming (pressing enter or button, or whatever), value changes to your type, like you have in example.
Thats the simpliest solution,and you wont bother users with entering brackets ans stuff. Here`s the code:

private void CheckingValue()
        {     
            
            long value = 0;
            int row = this.dataGridView1.CurrentCell.RowIndex;
            int column = this.dataGridView1.CurrentCell.ColumnIndex; //or column is always the same you only specify it bellow:
            string str = this.dataGridView1[column, row].Value.ToString(); //[0, row].Value.ToString(); - 0 represents the 1st column
            bool bChecking = long.TryParse(str, out value);
            if (bChecking)
            {
                str = String.Format("{0:(###) ###-####}", value);
                //insert new value into the cell!
                this.dataGridView1[column, row].Value = str;
            }
            else
                MessageBox.Show("Tel. number is not correct. Please re-enter it.");
        }
Mitja Bonca 557 Nearly a Posting Maven

What did you have before in the "jobsPendingToolStripMenuItem" value? I was even surprised to see this value (actually is not a value, but some control) in your query string.

So, this quiery compares to a boolean value from your dgv`s selected row or what? If so, you can get the boolean value from selected row and pass it in the sqlCommand parameter to the query, like:

foreach    (DataGridViewRow row in dataGridView1.Rows)
            {
                object value = row.Cells["checkBox"].Value;
                if (value != null && (Boolean)value == true)
                {
                    //this row has a tick, so you can count it in!
                }
            }

But I am not sure what you intend to do. You want for all "checked" rows to do what?

Mitja Bonca 557 Nearly a Posting Maven

What is the problem? Do you get any error message?

Mitja Bonca 557 Nearly a Posting Maven

I did an example code for you. I hope it helps:

public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
            string[] array = new string[] { "one", "two", "three", "four", "five", "six" };
            checkedListBox1.Items.AddRange(array);
            label1.Text = "No checkBoxes checked...";
        }

        private void ShowResults(int[] array)
        {
            label1.Text = "Results of the checkBoxes selection:\n\n";
            for (int i = 0; i < array.Length; i++)
            {
                if (array[i] == 1)
                    label1.Text += "checkBox " + (i + 1).ToString() + " is checked" + Environment.NewLine;
                else
                    label1.Text += "checkedBox " + (i + 1).ToString() + " is NOT checked" + Environment.NewLine;
            }
        }
        int[] ticks = new int[6]; 
        private void checkedListBox1_ItemCheck(object sender, ItemCheckEventArgs e)
        {                   
            int index = e.Index;
            for (int i = 0; i < ticks.Length; i++)
            {
                if (i == index)
                {
                    if (e.NewValue == CheckState.Checked)
                        ticks[index] = 1;
                    else
                        ticks[index] = 0;
                }
            }
            ShowResults(ticks);
        }
    }
Mitja Bonca 557 Nearly a Posting Maven

As said....
one more thing, the parameter you want to pass to the sql query its not good to use in the query it self. Its better to "attach" it to the sqlCommand,m like this:

try
            {
                //Opening the sql connection and using custom sql statements
                SqlConnection conn = new SqlConnection("Data Source=DEWALD-PC;Initial Catalog=LogbookDatabase;Persist Security Info=True;User ID=sa;Password=123");
                String query = String.Format("SELECT * FROM " + currentYearLbl.Text + " WHERE Pending = @myPending");
                SqlCommand cmd = new SqlCommand(query, conn);
                cmd.Parameters.Add("@myPendings", SqlDbType.VarChar, 50).Value = jobsPendingToolStripMenuItem;
                SqlDataAdapter dap = new SqlDataAdapter(cmd);
                DataTable dt = new DataTable();
                dap.Fill(dt);
                dataGridView1.DataSource = dt;
            }
            catch (Exception err)
            {
                MessageBox.Show("Unable update datagridview" + err);
            }
kvprajapati commented: parameter is good practice. +11
Mitja Bonca 557 Nearly a Posting Maven

I hope this will do it:

private void CountGrades(/*parameter is here*/)
        {
            //put your ownn list of grades
            //you can pass them in the parameter from somewhere else!
            int[] array = new int[] { 3, 4, 5, 2, 2, 5, 4, 1, 2 }; 
            string strGrades = null;
            int all = array.Length;
            int total = 0;
            for (int i = 0; i < array.Length; i++)
            {
                total += array[i];
                strGrades += array[i].ToString() + Environment.NewLine;
            }
            int average = total / all;
            MessageBox.Show("Of the grades:\n" + strGrades + "the average is: " + total.ToString());
        }
Mitja Bonca 557 Nearly a Posting Maven

Check it out here: http://stackoverflow.com/questions/1596530/multi-dimensional-arraylist-or-list-in-c

With arrayList:

ArrayList MainArray = new ArrayList();

        MainArray.Add(new ArrayList());
        MainArray.Add(new ArrayList());
        MainArray.Add(new ArrayList());

        (MainArray[1] as ArrayList).Add("Hello");

        Response.Write((MainArray[1] as ArrayList)[0].ToString());
Mitja Bonca 557 Nearly a Posting Maven

Ok, I put an example which I used ones - I had to seperate the lines of code.

Mitja Bonca 557 Nearly a Posting Maven

1st of all, you have to add a new namespace (using System.Net;)
Now I will show you a simple example of how to get the website`s text:

List<string> list = new List<string>();
        private void GetAllText()
        {
            WebRequest request = WebRequest.Create("http://www.daniweb.com");
            WebResponse response = request.GetResponse();
            using (StreamReader sr = new StreamReader(response.GetResponseStream()))
            {
                while (!sr.EndOfStream)
                    list.Add(sr.ReadLine()); //line by line it writes into a list<T>.
            }
            ShowingText();
        }
Mitja Bonca 557 Nearly a Posting Maven

Why you dont clear it before drawing it?
Just look of a method Clear();
btw, which chart do you use?

Mitja Bonca 557 Nearly a Posting Maven

I`m glad it does.
btw, please mark the thread as salved, if you got the answer on your question.
thx
Mitja

Mitja Bonca 557 Nearly a Posting Maven

This will do (use key up event)

private void button1_KeyUp(object sender, KeyEventArgs e)
        {
            if (e.KeyCode == Keys.Enter)
            {
                this.Close();
            }
        }
Mitja Bonca 557 Nearly a Posting Maven

try to change Return with Enter

if (e.KeyChar == (char)Keys.Enter) this.Close();
Mitja Bonca 557 Nearly a Posting Maven

Come around every time you will encounter the problem. I was in the same position as you 2 years ago. :)

btw: if you get what you have wanted, please mark the thread as salved, so every one who is looking for a similar issue can get the answer.
And one more thing: Ask one thing at ones, if there is another bothering you, pleaser start another thread.

best regards,
Mitja

james6754 commented: Thanks +1
Mitja Bonca 557 Nearly a Posting Maven

1st, what is in the References (Solution explorer), you can use as namespaces. If the namespace (like you wanted to use MessageBox) does not exist in the References, it cannot be used at all.
So 1st is the References (if there is no, you can simlpy add one) and 2nd is to add it into the projct on the top of it as namespase, and as you have figured it out by user self, simply that you dont need to write the whole path of the contols every time.

Mitja Bonca 557 Nearly a Posting Maven

tables with _Address are not even needed. Unless if you specificly dont need them. But I would inclued them into the main tables (like address of the doctors, you can easily include in Doctors table).

One thing you can seperate is Patient. YOu dont need to seperate 2 types of them, but the main information about patient and details, like:

Patients: id, gender, name, lastname, birthday, telephones ...
P.Details: all other info which will be fulfiled afterwards when client is in hospital (and later on).

And you can include one more table, thats Billing! Finances are very important part here.

ddanbe commented: Very good effort for all your posts in this thread :) +8
Mitja Bonca 557 Nearly a Posting Maven

Do you have this namespace in the References (Solution explorer tab)?
Otherwise you can try with writing the full path:

System.Windows.Forms.MessageBox.Show("buuu");
Mitja Bonca 557 Nearly a Posting Maven
Mitja Bonca 557 Nearly a Posting Maven

Take a look at this e-r model.
What do you think? I has everything you need - you only have to adapt to your needs.

Mitja Bonca 557 Nearly a Posting Maven

And you think you will do a monopoly (board) in the console? Wouldn`t be better to have the game in windows (windows application)?
and btw, I have to clue what exactly are you trying to achine. please provide us more information.

bye,
Mitja

Mitja Bonca 557 Nearly a Posting Maven

The connection string you are using is not correct. Take a look at here for your type of connection, but it should look something like that:

connectionString="Data Source=.\SQLEXPRESS;AttachDbFilename=C:\SampleFolder\MyProject\MyDataBase2.mdf;Integrated Security=True;Connect Timeout=30;User Instance=True"
Mitja Bonca 557 Nearly a Posting Maven

I will take a look and let you know when I`m done.
btw, can you please explaine me some words, or concepts (for easier understanding, nothing important):
- opd patient
- indore patient
- Incomng medicines (is this complete seperated thread?) - if yes, I would suggest you something else - to keep this in the "Inventory management, like:
Medicines("name", "quality",... on the end "state" (incoming, arrived)
- What is issue from store, where to put that?
- Patient billing (is this all the payments the patient has got?).

Mitja Bonca 557 Nearly a Posting Maven

You are welcome :)
I`m glad you like it.

bye,
Mitja

Mitja Bonca 557 Nearly a Posting Maven

Try to figure out this code bellow, I dont know exactly what is the game about, so I midified it a bit, only to see how to use a string array in the code:
I didnt use the timer, but I pick up the letters on a button click event.

public partial class Form2 : Form
    {
        Random random = new Random();
        string[] array = new string[] { "H", "O", "M", "E" };
        int i = 0;
        public Form2()
        {
            InitializeComponent();
            
        }

        private void button1_Click(object sender, EventArgs e)
        {
            if (listBox1.Items.Count < 4)
            {
                if (i == 0)
                    listBox1.Items.Clear();
                listBox1.Items.Add(array[i]);
                i++;
            }
            else
            {
                listBox1.Items.Clear();
                listBox1.Items.Add("Game over");
                i = 0;
            }
        }

Let me know if this is not it (and can you please give me whole code you got there, that I can imagine whats all about.
thx

Mitja

Mitja Bonca 557 Nearly a Posting Maven

Ok, lets define, you have Form1 and Form2. Form1 is Main Form, Form2 is Info.

Which one you call in Program.cs (Application.Run(XXXX)); - xxxx is from1 or form2?

This is how you should have:
in application.Run method you have to call Form1 (so the main form, not the intro). Before the form shows, you call Form2 with a timer (when timer comes, form1 closes as well and then opens form1.

There is another way, even better - this is the use of keyword "using" arround the application.start.
The code would look like:

//Form1 (Main Form):
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            using (Form2 form2 = new Form2())
            {
                if (form2.ShowDialog() == DialogResult.OK)
                    Application.Run(new Form1());
            }
        }

//Form2 (Info):
public partial class Form2 : Form
    {
        Timer timer1;
        public Form2()
        {
            InitializeComponent();
            timer1 = new Timer();
            timer1.Interval = 10000;
            timer1.Tick += new EventHandler(timer1_Tick);
            timer1.Start();
        }

        private void timer1_Tick(object sender, EventArgs e)
        {
            timer1.Stop();
            DialogResult = DialogResult.OK;
        }
    }

Simple and useful - I hope you like it.

bye, bye
Mitja

charqus commented: thanks +1
Mitja Bonca 557 Nearly a Posting Maven

I did a simple example with 2 forms. Both have textBoxes, and when clicking the button on form2, text transfers to from textBox on form2 to textBox on form1.

//form1:
 public partial class Form1 : Form
    {        
        public Form1()
        {
            InitializeComponent();
            StartMethod();
        }

        private void StartMethod()
        {
            string strID = "SS001";
            int intID = Convert.ToInt32(strID.Substring(strID.Length - 3));  
            //increase the value by 1:
            intID++;
            strID = intID.ToString();
            strID = CreateNewAutoIncrementID(strID);
            UseNewID(strID);
        }

        private string CreateNewAutoIncrementID(string strId)
        {
            int idLenght = strId.Length;
            while (idLenght < 3)
            {
                strId = "0" + strId;
                idLenght = strId.Length;
            }
            strId = "SS" + strId;
            return strId;
        }

        private void UseNewID(string strID)
        {
            //for exampe,
            //method where you can use the new id!
        }

        public void SetTextFromAway(string msg)
        {
            textBox1.Text = msg;
        }

        private void button1_Click(object sender, EventArgs e)
        {
            Form2 form2 = new Form2(this);
            form2.Show(this);
        }
    }

//form2:
  public partial class Form2 : Form
    {
        Form1 form1;
        public Form2(Form1 _form1)
        {
            InitializeComponent();
            form1 = _form1;
        }

        private void button1_Click(object sender, EventArgs e)
        {
            string value = textBox1.Text;
            form1.SetTextFromAway(value);
        }
    }
Mitja Bonca 557 Nearly a Posting Maven

Nice,
just mark the thread as salved, ok?
best regards,

Mitja

Mitja Bonca 557 Nearly a Posting Maven

Can you be please a bit more specific?
All what you have stated are entites. We need now Attributes for every entity. And the connection between entites.
You have to provide me at least attributes for every single Entity. For example:

entity(attributes)
PATIENT(id, name, lastName, SSN, ...)
PATIENT BILLING(id, _patientID, date, value,...)
...

I cannot help you much, until I get all information required, becuase I have no clue about how nurcing home is working and what is needed that all works.
If you need to know more about E-R, look here!

Hope you get sufficient information, to help you out.
Mitja

Mitja Bonca 557 Nearly a Posting Maven

Just dont forget to mark the thread as salved if you are satisfied with the answer :)
bye

Mitja Bonca 557 Nearly a Posting Maven

Here is the code. Take a closer look, and please use a break point to go through all the code - and then let me know if there is anything to add.

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace Dec2Exercise
{
    public partial class Form1 : Form
    {
        int textLenght;

        public Form1()
        {
            InitializeComponent();
            //because the code has no "Open File" option, will call OpenNewFile method here!
            //Otherwise call it just after richTextBox is filled up with text:
            OpeningNewFile();
        }

        private void OpeningNewFile()
        {
            textLenght = this.richTextBox1.Text.Length;
        }

        private string MessageWhileClosing()
        {
            string text = null;
            int textLenght_New = this.richTextBox1.Text.Length;
            if (textLenght < textLenght_New)
            {             
                DialogResult dialog = MessageBox.Show("Do you want to save changes?", "Text Changed", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question);
                if (dialog == DialogResult.Yes)
                    text = "saveYes";
                else if (dialog == DialogResult.No)
                    text = "saveNo";
                else if (dialog == DialogResult.Cancel)
                    text = "saveCancel";
            }
            return text;
        }

        private void ShowSaveFileDialog()
        {
            SaveFileDialog save = new SaveFileDialog();
            save.RestoreDirectory = true;
            save.Filter = "Word files (*.txt)|*.txt|All Files (*.*)|*.*";
            save.FilterIndex = 1;
            if (save.ShowDialog() == DialogResult.OK)
                MessageBox.Show("File on the path:\n" + save.FileName + " has been saved successfully.");
        }

        private void Form1_FormClosing(object sender, FormClosingEventArgs e)
        {
            string strClosing = MessageWhileClosing();
            if (strClosing == "saveYes")
            {
                e.Cancel = true;
                ShowSaveFileDialog();
            }
            else if (strClosing == "saveCancel")
                e.Cancel = true;
            //else if (strClosing == "saveNo") NO NEED TO USE THIS - WILL CLOSE AUTOMATICALY!
            //    e.Cancel = false;
        }

        private void buttonClose_Click(object sender, EventArgs e)
        { …
Mitja Bonca 557 Nearly a Posting Maven

Is the conn. string written like that:

connectionString="Data Source=.\SQLEXPRESS;AttachDbFilename=C:\myFolder\test01DB.mdf;Integrated Security=True;Connect Timeout=30;User Instance=True"

C:\myFolder represents the full path!

Mitja Bonca 557 Nearly a Posting Maven

I did an example of sorting number, and I used a generic list. I copied your values from decimal array to list<decimal> and did what you have requested.
I hope you like it. Its fast and simple - and it works :)

private void method()
        {
            decimal[] arr = new decimal[] { 12.3m, 45.2m, 5.4m, 23.44m, 43.21m, 31.34m, 4.3m, 21.3m, 32.1m, 44.2m, 
                              6.4m, 64.3m, 3.4m, 5.32m, 32.345m, 4.34m, 23.4m, 45.234m, 5.31m };
            List<decimal> list = new List<decimal>();
            for (int i = 0; i < arr.Length; i++)
            {
                list.Add(arr[i]);
            });
            //pG.aL = pG.aL.OrderBy(a => a.number).ToList();
            list = list.OrderBy(a => a).ToList();
            list.Reverse();
        }

Mitja

Mitja Bonca 557 Nearly a Posting Maven

No. You only need to change the full path with the relative path (instead of C:\Folder\myDb.mdf you do : |DataDirectory|\myDb.mdf
thats all!

Mitja Bonca 557 Nearly a Posting Maven

Did you attach the db into your project?
You attach the db to your project when selecting new databse (Tab- Data-> Add new DataSource) On the 2nd page you got a question: Would you like to copy the file to your prouject and modify the connection? You have to choose Yes.
And as you have figured it out, the connection string needs to have a |DataDirectory| path, instead of full path.

And btw, better get rid of double sleshes from connection string, it has to look like that:

connectionString="Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\test01DB.mdf;Integrated Security=True;Connect Timeout=30;User Instance=True"
Mitja Bonca 557 Nearly a Posting Maven

Did you attach the db into your project?
You attach the db to your project when selecting new databse (Tab- Data-> Add new DataSource) On the 2nd page you got a question: Would you like to copy the file to your prouject and modify the connection? You have to choose Yes.
And as you have figured it out, the connection string needs to have a |DataDirectory| path, instead of full path.

And btw, better get rid of double sleshes from connection string, it has to look like that:

connectionString="Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectoryˇ|\test01DB.mdf;Integrated Security=True;Connect Timeout=30;User Instance=True"
Mitja Bonca 557 Nearly a Posting Maven

You have to manualy write the full path to the YourDB.mdf file.
So repair the path in theconnection string.

Mitja Bonca 557 Nearly a Posting Maven

I did some code for you. I have even put the numericUpDown control on the form to select numbe of weeks randomly. And to select the beginning of calculation, you choose if from dateTimePicker. This is the code:

public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            DateTime start = this.dateTimePicker1.Value.Date;
            int weeks = Convert.ToInt32(this.numericUpDown1.Value);
            if (weeks > 0)
                DaysCalculations(start, weeks);
            else
                MessageBox.Show("Calculation cannot start. Number of the weeks to calculate is set to zero.");
        }

        private void DaysCalculations(DateTime start, int weeks)
        {
            DateTime end = start.AddDays(7 * weeks);
            int NumberOfDays = 0;
            string strAllDates = null;
            while (start <= end)
            {
                start = start.AddDays(1);
                if (start == new DateTime(start.Year, start.Month, 1))
                {
                    NumberOfDays++;
                    strAllDates += start.ToShortDateString() + Environment.NewLine;
                }
            }
            if (strAllDates == null)
                strAllDates = "No dates";
            MessageBox.Show("Between " + start.ToShortDateString() + " and the selected date: " + end.ToShortDateString() + 
                            "\nfirst of the month comes " + NumberOfDays.ToString() + " times.\n\n" +
                            "The list of all 1st of the month:\n" + strAllDates);
        }

       
    }
Mitja Bonca 557 Nearly a Posting Maven

You better try something different - more appropriate to use checked, or unchecked. This is to use true, false (its the same think, even better). In your database, set the column`s data type to bit. Bit can have only 2 values, this are true, or false.

Then, how to get this value out of db:
I assume you want to get one value (from one row) not all. If so, you have to use a WHERE clause that your statement can compare to sometihng.

For example, youf dgv has 2 columns (to make is simplier):
- checkBox
- costumer name

When you write the query you need to select the checkBox and complare it to the name which is in the same row, like:

stirng myQuery = @"SELECT myCheckColumn FROM Customers WHERE CustomerName = 'TheDoctered'";

If you dont want to write parameter directly in the query(in this case a string 'TheDoctered') you can pass it to the sqlCommand parameter, like:

SqlCoinnection sqlConn = new SqlConnection ("connectionStringToDB");
stirng myQuery = @"SELECT myCheckColumn FROM Customers WHERE CustomerName = 'TheDoctered'";
SqlCommand cmd = new SqlCommand(mySuery, sqlConn);
cmd.Parameters.Add("@name", SqldbType.Varchar, 50).Value = theName; //the name is parameter passed to the method of this quiery - its holds the value "TheDoctered".

If you want to populate the dgv with all the Customers from db, you dont need to use WHERE clause in the query - all others is the same!

Hope it helps,

Mitja

Mitja Bonca 557 Nearly a Posting Maven

In this code simpleArray[i, m] == simpleArray[1, 2]
there is no array of [1, 2]!
but I dont even know what are you trying to do. maybe would help, if you explain us your code a bit better.

Mitja

Mitja Bonca 557 Nearly a Posting Maven

crishjeny:
STOP wtih such unproductive posts! We all know that!
Its better not to post posts like this in here.

I have already warned you...
Mitja

Mitja Bonca 557 Nearly a Posting Maven

crishjeny:
Wound you please stop posting NON-C# code in C# forum!!!!

Mitja Bonca 557 Nearly a Posting Maven

You can not asign a method ReadLine as the parameter of the WriteLine method.

You can do as follows:

while (!MyReader.EndOfStream)
{
    string Mystring = MyReader.ReadLine();
    // reads data into an array & outputs data to console
    int[] myArray = Mystring.Split(' '); //split value by some marks(white spalce, comma, dot, ...)
    for(int i = 0; i < myArray.Lenght; i++)
    {
        Console.WriteLine("{0}", myArray[i].Tostring());
    }
}
Console.ReadLine();

The code above will read all lines a code, and it will write into each line (seperated) all the values read, one by one.

Hope it helps,
Mitja

Mitja Bonca 557 Nearly a Posting Maven

Now I tried and did my best from by understanding of what you would like to have. This is what I have to offer you:

using (System.IO.StreamReader sr = new System.IO.StreamReader(@"C:\1\test.txt"))
            {
                if (!sr.EndOfStream)
                {                    
                    string line = sr.ReadLine();
                    string[] arrayLine = line.Split(';');

                    string col1 = arrayLine[0];
                    string col2 = arrayLine[1];
                    string col3 = arrayLine[2];
                    string col4 = arrayLine[3];

                    string[] arrayCol3 = col3.Split(',');
                    string[] arrayCol4 = col4.Split(',');

                    int counter = 0;
                    string[] newArray = new string[arrayCol3.Length]; //just for testing, here you will have all 3 lines saved!

                    while (counter < arrayCol3.Length)
                    {
                        string value = col1 + "," + col2 + "," + arrayCol3[counter] + "," + arrayCol4[counter];
                        newArray[counter] = value;
                        counter++;
                    }
                }
            }
Mitja Bonca 557 Nearly a Posting Maven

Anyway, if you want as a result to get these kind of results:
Line 1: one+","+two+","+00+","+10
Line 2: one+","+two+","+01+","+11
Line 3: one+","+two+","+02+","+12

we neeed to implement an array to put all the lines inside (a list<T> is the best option). Anyway, you can have a string, but you have to use it before the code goes back to read a new line (your quote: string i'm then running a function to basically to some server side).

But I still dont understand you well, what exactly are the meanings of one;two;00,01,02;10,11,12.
I will try to display your columns with values inside:

| Column1: | Column2 | Column3 | Column4 |
| ONE | Two | 00,01,02 | 10,11,12 |

So you want values from each column, and with only 1 value from each column (with no repeating if them).

And all these is in one ReadLine method (in one rows) -> | ONE | Two | 00,01,02 | 10,11,12 |

Am I right?

Mitja Bonca 557 Nearly a Posting Maven

No big deal, just let me know, if you are satisfied with what I have gaven you. If not, please let me know. I`ll try to do better, ok?

cya
Mitja

Mitja Bonca 557 Nearly a Posting Maven

You can convert DateTime value to an integer, to get the hour and minutes seperated values. And then use them to compare to the hours which defines to when you say good morning and afternoon.

DateTime time = DateTime.Now;
            int hour = time.Hour;
            int minutes=time.Minute;
            if (hour <= 12)
                Console.WriteLine("Good morning");
            else if (hour >= 12 && minutes >= 1)
                Console.WriteLine("Good afternoon");
            Console.ReadLine();

Hope it helps,
Mitja

Mitja Bonca 557 Nearly a Posting Maven

If you cannot salve the issue, you can send the whole project to me. I will try to look at it.

Mitja Bonca 557 Nearly a Posting Maven