hi, 1st of all thank you guys again for all of your help.
a3ce81a2808d02214775965e56a6d32b
i have this datagrid view and i want to write it on a richtextbox like:

14       APPLE0-13       @ 60.00       840.00

so on and so forth.
how can i achieved getting all of them and can i also ask how do you space them?what is padding?do i use padding?how to use padding?

I really appriciate it guys i can only say thank you for the help you are giving me.

btw does foreach come in play with my question?

thank you, arigato, salamat, gracias

You could use an equidistant font, examples here.
Now use "empty" strings(filled with say 20 spaces) and use the CoptyTo method from the string clas, to position the info from the DataGridView in this space filled string.
Append these strings now to the RichTextBox.
Success.

Tnx......
but uhm how can i get the strings from the datagridview to richtextbox :
example i have x numbers of row for datagridview with 4 number of columns. how can i put the datas line per line until i have exhausted all of my datagridview rows

Use for loop through DGV's rows and a nested for loop through DGV's columns
Every time add a new line after completion of nested loop for column.

so uhm like

foreach (Datarows p in Datagridview1)
{
\\transfer 
}
i tried this but foreach gets a red zigzag line it says something about does not contain public definition getenumerator

Use something like this:
Datagridview1.Rows[0].Cells[1].Value
This would reprsent the string in the second cell in the first row of your DGV.

hi , i have tried this.

for (int i = 1; i < dgv.RowCount; i++)
            {
                rtb.Text = rtb.Text+ dgv.Rows[i].Cells[2].Value.ToString();
                    }

but i am getting errors of d6e6d800d6c29042f3078ea6c90f9e71

Your for loop should look like this:
for (int i = 0; i < dgv.RowCount - 1; i++)
DGV has depending on the settings a row extra.
Row and columns start at zero.

yey tnx mr ddanbe!

really appreciate you help.
yours too mr shark_1

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.