Mitja Bonca 557 Nearly a Posting Maven

Do you wanna add only one picture?
why you call this code:

byte[] arrimage = dt.Rows[0][0];

As far as I can see from this code, you get image(s) from dataBase. And you wanna show it/them in pictureBox.
Only one, or you wanna show more? If more, then you create a button Next and Back to loop through images (and data of Patients - if there are any).

Am I right?

Mitja Bonca 557 Nearly a Posting Maven

hmm now i have a problem : how can i separate this images?

What do you mean? Dont you have images in a ImageList or something?

Mitja Bonca 557 Nearly a Posting Maven

Pass every image to this method bellow:

'in your method:
Private bImage As byr() = ImageToByteArray(yourImage)

'method
Public Function ImageToByteArray(imageIn As System.Drawing.Image) As Byte()
	Dim ms As New MemoryStream()
	imageIn.Save(ms, System.Drawing.Imaging.ImageFormat.Gif)
	Return ms.ToArray()
End Function
Mitja Bonca 557 Nearly a Posting Maven

to create events, put the code in form constructor.

//on form1:
public Fomr1()
{
     InitializeComponent();
     this.Load += new System.EventHandler(Form1_Load);
}

private void Form1_Load(object sender, EventArgs e)
{
     //this will now fire at loading time!
}
Mitja Bonca 557 Nearly a Posting Maven

Your error is in the Update query. You mixed up one and double quotes. Do it this way:

sqlSOPDept.CommandText = "UPDATE dbo.docHeader SET revision = '" & newRev & "' WHERE model = '" & Convert.ToString(Me.cmbModel.SelectedValue.ToString) & "' AND part = '" & Convert.ToString(Me.cmbPart.SelectedValue.ToString) & "'"
Mitja Bonca 557 Nearly a Posting Maven

In my opinion, you have way too much code of DGV.
What you need is only to use DataSource property.

just and only this:

SqlConnection main_user_con = new SqlConnection();
            main_user_con.ConnectionString = "Data Source=.\\SQLEXPRESS;AttachDbFilename=|DataDirectory|\\clubdb.mdf;Integrated Security=True;User Instance=True";
            string con_string = "select * from users";
            SqlDataAdapter userda = new SqlDataAdapter(con_string, main_user_con);
            DataTable userdt = new DataTable();
            userda.Fill(userdt);
            userdgv.AutoGenerateColumns = false;
            userdgv.DataSource = new BindingSource(userdt, null); //use it this way

And then you only add a code to add a new column - checkBox column.

Mitja Bonca 557 Nearly a Posting Maven

Hi, would you mind to share your code here with us? Will be easier to salve the problem.
Show us how you bind DGV to the dataTable (and stuff).

Mitja Bonca 557 Nearly a Posting Maven

YOu can do a windows application, which will work fine over the net (like msn, skype,..).
You need to create a server (which is always good to have, to check what going on around) and then you need clients to log on to server and chat to each other.
One simple example you can find here.

Mitja Bonca 557 Nearly a Posting Maven

Hi,
I would suggest you to use ReadLine() method, not ReadToEnd(). This way you avoid some additional code, which would be needed if you would use ReadToEnd() method.
So after using ReadLine() method, you get a string of text line by line. Each line will habe the shape of you:

"Name amount1 amount2"

What you can do is to split string (by whitespace), and:
1. put into a stirng array and all add to generic list
2. create a new class and assign data to properties of this class and add to generic List<T>
-------------------------------------------------

1.

List<string[]> list  = new List<string[]>();
StreamReader sr = new StreamReader("Aqua.txt");
string line;
while((line = sr.ReadLine()) != null)
{
    string[]array = line.Spit(' ');
    list.Add(array); 
}

//when retreiving data loop over list and access to the vlaues by settting indexes:
foreach(string item in list)
{
    string name = item[0];
    string no1 = item[1];   
    string no1 = item[2];
    //you can convert to int if oyu like:
    int intNo1 = int.Parse(item[0]);
}
Mitja Bonca 557 Nearly a Posting Maven

Depends on what he has in mind to put together and what to seperate from other data.

Mitja Bonca 557 Nearly a Posting Maven

Ok, that you wont bother with insert query (even if you know it, or if you have a stored procedure), here is my full code:

string lastDir;
        string fileName;
        public Form1()
        {
            InitializeComponent();
        }

        private void buttonOpen_Click(object sender, EventArgs e)
        {
            OpenFileDialog open = new OpenFileDialog();
            open.Filter = "Image Files(*.png; *.jpg; *.bmp)|*.png; *.jpg; *.bmp";
            if (lastDir == null)            
                open.InitialDirectory = @"C:\";
            else
                open.InitialDirectory = lastDir;
            if (open.ShowDialog() == DialogResult.OK)
            {
                fileName = System.IO.Path.GetFullPath(open.FileName);
                lastDir = open.FileName;
                pictureBox1.Image = new Bitmap(open.FileName);
                this.pictureBox1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom;
            }
        }

        private void buttonSave_Click(object sender, EventArgs e)
        {
            //get image:
            Image img = Image.FromFile(fileName);
            //get byte array from image:
            byte[] byteImg = ImageToByteArray(img);

            //here do the insertion into dataBase!
            //but remember, your field in DB must be type to byte array
            //example:
            using (SqlConnection sqlConn = new SqlConnection("connString"))
            {
                using (SqlCommand cmd = new SqlCommand())
                {
                    cmd.CommandText = @"INSERT INTO MyTable VALUES (@id, @image, @name)";
                    cmd.Connection = sqlConn;
                    sqlConn.Open();
                    try
                    {
                        cmd.ExecuteNonQuery();
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show(ex.Message);
                    }
                }
            }
        }

        public byte[] ImageToByteArray(Image img)
        {
            System.IO.MemoryStream ms = new System.IO.MemoryStream();
            img.Save(ms, System.Drawing.Imaging.ImageFormat.Jpeg);
            return ms.ToArray();
        }
yousafc# commented: Mitja is best developer +3
Mitja Bonca 557 Nearly a Posting Maven

What is your DB table (table you wish to insert into) structure?

Anyway, here is my solution for you, I only didnt include sql and DB insertion.
(for it you have to use sql query:
@"INSERT INTO Table VALUE (@id, @picByte, @picName)"
- id
- pic byte[]
- pic name (string) - its optional, but its good to have it.

So heres the code:

string lastDir;
        string fileName;
        public Form1()
        {
            InitializeComponent();
        }

        private void buttonOpen_Click(object sender, EventArgs e)
        {
            OpenFileDialog open = new OpenFileDialog();
            open.Filter = "Image Files(*.png; *.jpg; *.bmp)|*.png; *.jpg; *.bmp";
            if (lastDir == null)            
                open.InitialDirectory = @"C:\";
            else
                open.InitialDirectory = lastDir;
            if (open.ShowDialog() == DialogResult.OK)
            {
                fileName = System.IO.Path.GetFullPath(open.FileName);
                lastDir = open.FileName;
                pictureBox1.Image = new Bitmap(open.FileName);
                this.pictureBox1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom;
            }
        }

        private void buttonSave_Click(object sender, EventArgs e)
        {
            //get image:
            Image img = Image.FromFile(fileName);
            //get byte array from image:
            byte[] byteImg = ImageToByteArray(img);

            //here do the insertion into dataBase!
            //but remember, your field in DB must be type to byte array
        }

        public byte[] ImageToByteArray(Image img)
        {
            System.IO.MemoryStream ms = new System.IO.MemoryStream();
            img.Save(ms, System.Drawing.Imaging.ImageFormat.Jpeg);
            return ms.ToArray();
        }
Mitja Bonca 557 Nearly a Posting Maven

Hi, check here.

Remember you have to get Byte array (byte[]) from picture to save it into a dataBase.

Mitja Bonca 557 Nearly a Posting Maven

I did the code for scrolling text in label.
Take a look at it:

public Form1()
        {
            InitializeComponent();
            label1.Text = "abcde";
        }

        private void button1_Click(object sender, EventArgs e)
        {
            char[] chars = label1.Text.ToCharArray();
            char[] newChar = new char[chars.Length];

            int k = 0;
            for (int j = 0; j < chars.Length; j++)
            {
                if (j + 1 < chars.Length)
                    newChar[j + 1] = chars[j];
                else
                {
                    newChar[k] = chars[j];
                    k++;
                }
            }
            label1.Text = new string(newChar);
        }
Mitja Bonca 557 Nearly a Posting Maven

Scroll text ok, but what did you mean by "if the text do not fit into the label..." ?
ADDED: Text always fits to the label.

Mitja Bonca 557 Nearly a Posting Maven

Delimiter is some character which you pick it up by your self. Something that you know you have to use split string (if the string containg delimiters).
By default, you can write "\r\n" (no quotes), which is a literal to new line.
You can use some of your own, like comma, or semicolon.

So you do:

dataGridView1.Columns.Add("col1", "column 1");

            //INSERT:
            string a = "line 1";
            string b = "line 2";
            string c = "line 3";
            
            string delimiter = "\r\n";
            string textTogether = String.Join(delimiter, new string[] { a, b, c });
            //now do the insertion into dataBase (into one cell(column)).

            //then when you want to get it back and pass data into one column (into seperate lines):
            //get data back out of dataBase and from dataTable.
            string line = textTogether;
            //now:
            //string[] array = line.Split(',');
            dataGridView1.Rows.Add();
            dataGridView1.Columns[0].DefaultCellStyle.WrapMode = DataGridViewTriState.True;
            dataGridView1.Rows.Add(line);
Mitja Bonca 557 Nearly a Posting Maven

So:
chicken 11/2
fish 1
egg 1

are all in its lines in database?

Is your dataBase field type of varchar?
But it doesnt matter. You cannot declare any height and width of a cell.
YOu can only split text using some delimiters, which will later help you to split the text into multilines, or create a column width so only one word will go into one line, and then use property AutoResizeRow, and use AutoSizeRowsMode.

Mitja Bonca 557 Nearly a Posting Maven

Hi, would you share a solution here with us? Would be cool.
thx in advance.

Mitja Bonca 557 Nearly a Posting Maven

Strange people. Instead of giving you a solution you are looking for, they think the contrary.
Anyway, did that link help you?

Mitja Bonca 557 Nearly a Posting Maven

The DataGridView does not have any support for merging cells. You can custom paint content across cells, but apart from that you would have to do a lot of work and custom coding to produce merged editable cells.

Go here, and check the code.

Mitja Bonca 557 Nearly a Posting Maven

It can be possible in both side. Which do you prefer.
nmaillet just showed how it will be look like a stored procedure.

If you wanna do in code (C#) you can do it:

int a = int.Parse(textBox1.Text); //but do better checked to make sure if user does not enter a number!
int b = int.Parse(textBox2.Text);
if(b>=a)
{
     //do the insert code
}
else
    MessageBox.Show("Value B must be greater or at least equal to value A.");
Mitja Bonca 557 Nearly a Posting Maven

There is many options. If you want to save as DateTime, you will not be able to save as an array. Because only one value of dateTime can be stored into one cell.

You can choose a varChar - that means converting dateTime values into a string, and seperated them by some delimiter (like comma, or semi-colon, so you will be later when retreiving data be able to split them back and convert them to dateTime). I would go for this one.
In any case, if you want to save data as array, you will have to do some work-around.
Do what you want, but array as you know its not possible, you can seperate each data by some delimiter as explained.

Mitja Bonca 557 Nearly a Posting Maven

Simpliest way to do so, it touse ShowDialog method:

//in the main form:
using(Login log = new Login())
{
     if(log.ShowDialog() == DialogResult.OK)
     {
          Application.Run(Form1);
     }
}

//in login form:
//when you do all the checking on the user`s name and password 
//and all is OK, do:
this.DialogResult = DialogResult.OK;
Mitja Bonca 557 Nearly a Posting Maven

How come?
if connection string is ok, and table is not empty, Momerath`s solution has to work.
His query and use of ExecuteScalar method returns the number of rows.

Mitja Bonca 557 Nearly a Posting Maven

In your method GetInput you have a parameter, which you do NOT pass it. Do it this way:

public static void Main(string[] args)
        {
            DisplayApplicationInformation();
            string someName = "this is some name";
            GetInput(someName); //here you have to put a parameter to pass with a method
        }
        
        public static void GetInput(string userName) //because here you have declared a parameter
        {
            userName = Convert.ToString(Console.Read());
            Console.WriteLine(userName);
        }

Or remove parameters on boths sides, or you have to have them on both sides.

Mitja Bonca 557 Nearly a Posting Maven

Try it this way:

while (reader.Read())
 {
     textBox1.Text = reader["Grey3"] != (object)DBNull.Value ? (string)reader["Grey3"] : String.Empty;
 }
Mitja Bonca 557 Nearly a Posting Maven

Depends on number of columns.
For example if you have 3 columns you do:

foreach (DataRow row in dt.Rows)
{
    object obj1 = row[0]; //column 1
    object obj2 = row[1]; //column 2
    object obj3 = row[2]; //column 3
}
Mitja Bonca 557 Nearly a Posting Maven

I dont think that this is possible - to disable just one item. Better option to be removing it from the list.

Mitja Bonca 557 Nearly a Posting Maven

Yes it does. It really does. Sorry.
In this case, your approach is correct.
Even if StudentId field is only in Studentinfo table, it should work.
But if he has the same field name in more then one table, then it will not work.

As far as I can see he has the same name in Admission table too, so your code will do it!

Mitja Bonca 557 Nearly a Posting Maven

Some strange sql query. Why would you compare those two table, when you only want to get all the data from Studentinfo table. Admission table has nothing to do here, since you do get any data from Admission table.
So I recommend you to change the query to:

Select * from Studentinfo
where Studentid= '1'
Mitja Bonca 557 Nearly a Posting Maven

or:

Imports System.Windows.Forms
Imports Microsoft.VisualBasic.ApplicationServices

Namespace WindowsApplication1
	Public Class MyApp
		Inherits WindowsFormsApplicationBase
		Public Sub New()
			Me.ShutdownStyle = ShutdownMode.AfterAllFormsClose
			Me.MainForm = New Form1()
		End Sub
	End Class
	NotInheritable Class Program
		Private Sub New()
		End Sub
		<STAThread> _
		Private Shared Sub Main(args As String())
			Dim app As New MyApp()
			app.Run(args)
		End Sub
	End Class
End Namespace

You can now close your startup form (Form1) without problems. Your program will exit when the last form is closed.

Mitja Bonca 557 Nearly a Posting Maven

There is maybe another solution:

Private Shared Sub Main()
	Application.EnableVisualStyles()
	Application.SetCompatibleTextRenderingDefault(False)
	Application.Run(New Form1())
	' Form1 in this Application.
	Application.Run(New Form2())
	' Form2 in this application.
End Sub

.. if you want Form2 to open after Form1 exits. There's no going back. When Form2 closes, the programs end.

Mitja Bonca 557 Nearly a Posting Maven

You cant. The Form2 was stared as the Main form in the Main method. You can only Hide it (use this.Hide() method), if you will close it, the whole application will close.

Mitja Bonca 557 Nearly a Posting Maven

Why you create a new dgv? The new one is again not created.Try this one:

con = New OleDbConnection("Provider=Microsoft.JET.OLEDB.4.0;" & _
"Data Source=C:/Users/Space Era/Documents/perf.mdb")
            con.Open()
            Dim dgv As New DataGridView()            
            'here you can set Size, Location, ... and other properties too (but it would be good to create a new, seperate method of DGV creation
            Me.Controls.Add(dgv)
            Dim dataset1 As New DataSet()
            Dim sqlstring As String = "select * from data where Date >= '" & DateTimePicker2.Value & "' and Date<= ' " & DateTimePicker1.Value & "'"
            cmd = New OleDbCommand(sqlstring, con)
            Dim oledbdataadapter1 As System.Data.OleDb.OleDbDataAdapter = New System.Data.OleDb.OleDbDataAdapter(cmd)
            oledbdataadapter1.Fill(dataset1, "data")
 
            datagridview1.DataSource = dataset1.Tables("data")
Mitja Bonca 557 Nearly a Posting Maven

Try this code:

Private table As DataTable
Public Sub New()
	InitializeComponent()

	table = New DataTable("myTable")
	table.Columns.Add("column 1", GetType(String))
	table.Columns.Add("column 2", GetType(String))
	table.Rows.Add("a1", "b1")
	table.Rows.Add("a2", "b2")
	table.Rows.Add("a3", "b3")
	table.Rows.Add("a4", "b4")
	dataGridView1.DataSource = New BindingSource(table, Nothing)
End Sub

Private Sub button1_Click(sender As Object, e As EventArgs)
	Dim selectedRow As DataRow = table.Rows(dataGridView1.CurrentRow.Index)
	Dim newRow As DataRow = table.NewRow()
	newRow.ItemArray = selectedRow.ItemArray
	' copy data
	table.Rows.Remove(selectedRow)
	table.Rows.InsertAt(newRow, 0)
End Sub

as you can see the dataTable is bound to datagridview, so you can see the actual results, when selecting a row and pressing a button. The selected row will move to the top of DGV (the same as in dataTable).
If you want to use the code in dataSet, just create is, and add a dataTable to it.

mrbungle commented: Thanks for your help and time! Good code! +2
Mitja Bonca 557 Nearly a Posting Maven

You didnt add the newly created dataGridiView to the form. Do it this way:

Dim dgv As New DataGridView()
Me.Controls.Add(dgv)
'this line you are missing
Mitja Bonca 557 Nearly a Posting Maven

hi Mitja, firstly thanks for the remind of the word 'form', I will remind it.
The class is created below the Form1 or I needs to add it from the Project >> Add Class ?

No, not need it. Ok, you can do that, but you can write this kind of class on the Form1, take a look at this example:

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;
using System.Data.SqlClient;

namespace Jun28Test1
{
    public partial class Form1 : Form
    {
        DataTable table;
        public Form1()
        {
            InitializeComponent();
        }

        //rest of the code on Form1
    }

    static class MyClass
    {
        public static string MyText { get; set; }
    }

This is all on one *.cs file - like you see

So no need to create a brand new *.cs file. But if you want, you can do it.

Mitja Bonca 557 Nearly a Posting Maven

As I understand Your, you like to send value of text to textbox of other form.

go to the designer of the destination form and find the code for text change the access specifier from private to public
Now

//create object of destination
form2 f =new form2;
f.textbox.text="Your text";
f.show();

Bad, bad example.
What you did is to set control and public (textBox), and this is sometihng the worst you can do.
And besides, he said he wasnt to pass data over 3 forms, not only form 1st to 2nd, but from 1st, over 2nd, to 3rd form. And this is not gonna work.

Take a look at mine Simple and working example.

Mitja Bonca 557 Nearly a Posting Maven

This is not how we do the method in "correct" way. I put the correct word into quotation marks, becuase everything is correct as long as the code works, but there wre have some rules we have to follow, so the code is more appropriate and looks better and works better (better performance - which is one of the goals of every programmer).
So try to do it this way:

static string concString = @"Data Source=BJ-PC\\SQLEXPRESS;Initial Catalog=new;Integrated Security=SSPI";
        public void getLastMemID()
        {
            int ID = 0;
            using (SqlConnection CN = new SqlConnection(concString))
            {
                CN.Open();
                string sqlQuery = @"SELECT MAX(ImageId) FROM ImagesStore";
                using (SqlCommand com = new SqlCommand(sqlQuery, CN))
                {
                    using (SqlDataReader dr = com.ExecuteReader())
                    {
                        if (dr.Read())
                            ID = (int)dr[0];
                    }
                }
            }
            if (ID > 0)
                MessageBox.Show("Max id is " + ID.ToString());
            else
                MessageBox.Show("There is no id in this table (its an empty table)");
        }
Mitja Bonca 557 Nearly a Posting Maven

1st of all, there is no word about Interfaces - there is a completely different expression. You wanna talk aobut Forms. Ok? So, please in the future use this term - Form.
What you can do, is to create a seperate class, with property (property is a "field" which uses get set accessors). And mark the property as static (with static modifier).

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

        private void button1_Click(object sender, EventArgs e)
        {
            //set the static property with the text you want:
            MyClass.MyText = textBox1.Text;
            Form2 f2 = new Form2();
            f2.Show();
            this.Hide();
        }
    }

    static class MyClass
    {
        public static string MyText { get; set; }
    }

    public partial class Form3 : Form
    {
        public Form3()
        {
            InitializeComponent();
            //get data from static class from where ever you want:
            //form2 was in between, but form2 has nothing to do with passing data
            //so we can call the GET accessor from where every want - from form3:
            textBox1.Text = MyClass.MyText;
        }
    }
Mitja Bonca 557 Nearly a Posting Maven

An interface is a reference type object with no implementation. You can think of it as an abstract class with all the implementation stripped out and everything that is not public removed. Abstract classes are classes that can not be instantiated. No properties or methods are actually coded in an interface, they are only defined. So the interface doesn't actually do anything but only has a signature for interaction with other classes or interfaces.

Check for some simple examples here.

Mitja Bonca 557 Nearly a Posting Maven

You can create your own boolean variable, which will be set accordinglly:

string query1 = @"update trainn set Adultno=Adultno-1 where ID=@pram1 and adult=@pram2 and Adultno>0";
            string query2 = @"update trainn set childno=childno-1 where ID=@pram1 and child=@pram2 and childno>0";
            string[] queriesArray = new string { query1, query2 };
            bool bAllOK;
            foreach (string query in queriesArray)
            {
                sqlCmd = new SqlCommand();
                sqlCmd.Connection = sqlCon;
                sqlCom.CommandText = query;
                if (sqlCon.State != ConnectionState.Open)
                    sqlCon.Open();
                sqlCmd.Parameters.AddWithValue("@pram1", textBox3.Text);
                try
                {
                    sqlCmd.ExecuteNonQuery();
                    bAllOK = true;
                }
                catch
                { 
                //show your error message
                    bAllOK = false;
                    break;
                }
            }
            if (bAllOK)
                MessageBox.Show("All ok");
Mitja Bonca 557 Nearly a Posting Maven

You can do:

string query1 = @"update trainn set Adultno=Adultno-1 where ID=@pram1 and   
  adult=@pram2 and Adultno>0";
string query2 = @"update trainn set childno=childno-1 where ID=@pram1 and  
  child=@pram2 and childno>0";
string[] queriesArray = new string { query1, query2 };
foreach(string query in queriesArray)
{    
     sqlCmd = new SqlCommand();
     sqlCmd.Connection = sqlCon;
     sqlCom.CommandText = query;
     if(sqlCon.State != ConnectionState.Open)
          sqlCon.Open();
     sqlCmd.Parameters.AddWithValue("@pram1", textBox3.Text);
     sqlCmd.ExecuteNonQuery();
}
sqlCon.Close();
Mitja Bonca 557 Nearly a Posting Maven

Do you get any data into DataTable? Use a break point, hover the mouse ovher "dat" variable, and click on Magnifying glass to see if there is any data inside. If its not, your query is not corrct, or database is empty.

Check that 1st.

Mitja Bonca 557 Nearly a Posting Maven

Same here ddanbe. I started in early 2009, and same as you. But even if I like programming, I am still far from being a professional progamer. It takes time, thats it.

Mitja Bonca 557 Nearly a Posting Maven

LOL, there is no such thing! Sorry, you came on the wrong place.

Best way to get knowledge is to try to use it in practice. SO has a plenty of questions about C# books/sites/tutorials. Learning pattern is really simple: read a little bit of information on C# and try to write small program that uses this information. Don't try to understand the whole thing at once, grok it by small pieces and in a couple of weeks you'll get enough knowledge to write meaningful programs.

----------------
But in case, if you want to spend a couple of days more then only a few day, you can start to buy some books (or at least one), you can start here. Check for great books on amazon.com. This is the link to one great book I am currently reading (C# 2008 Step by Step; there is 2010 version too). On amazon.com you can find many, many books about programming. But the thing is, THERE IS NO FAST WAY of learing programming. It will take time, especially if you dont know any other programming language. If you do, it will be simplier and shorter learning, but in any case you will have to be patient.
btw, there is one great link of the most popular threads on StackOverflow here.

Hope it helps to start with :)

kvprajapati commented: Correct! +14
ddanbe commented: adatapost is right! +14
Mitja Bonca 557 Nearly a Posting Maven

Momerath is saying you cannot multiply some double value with double array value. No go.

You have this code:

double [] perminuterate = { 0.07, 0.10, 0.05, 0.16, 0.24, 0.14 };

What are these numbers mean?
And you have to select ONLY one value from this double array to multiply with user`s input, like:

double [] perminuterate = { 0.07, 0.10, 0.05, 0.16, 0.24, 0.14 };
double userInput = 0M;
double result = 0M;
if(double.TryParse(Console.ReadLine(), out userInput)
{
    //now you have user`s input in correct type, you only habe to select one value from array
    //but which one, this is up to you.
    //example: I will choose 3rd (0.05):
    result = userOutPut * perminuterate[2];
}
Console.WriteLine("Result is {0}.", result.Tostring());
Console.ReadLine();
Mitja Bonca 557 Nearly a Posting Maven

Didnt we show you two example how yucan save the array into *.csv file?
Mine and and sandeepparehk0`s post have these kind of solutions.

Mitja Bonca 557 Nearly a Posting Maven

I would rather suggest you to use generic list<T>. But if you insist uisng string array, you can do it in this way too:

string[] array = new string[7];
//reading port and fill the array!
//then you can do:
string delimiter = ";";
//and write to a file:
string path = @"C\MyFolder\myFile.csv";
System.IO.File.WriteAllText(path, Stirng.Join(delimiter, array));
Mitja Bonca 557 Nearly a Posting Maven

As Momerath said, please tell us what do you want to have in textBoxes, otherwise here is a simple example of a textBoxes array and a loop to insert text into them:

TextBox[] tbs = new TextBox[] {textBox1, textBox2, textBox3 }; //put all of them in here!
//then loop:
for(int i = 0; i < tbs.Lenght; i++)
{
   if(tbs[i] != null) //if needed, if not remove this line!
      tbs[i].Text = "some text + i.ToString();
}