473,473 Members | 1,576 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Datagridview in c# (help pls)

12 New Member
Dear All

The project that i'm doing is readind data form txt file and then put these data in an array and display them in datagridview. this part has been done. But the second part is when I excuate the programe of course the data will be displaied in the datagridview then when I write data in the new and last row in the datagrid view I would like when I click on a save button for example this new row will be written in an array so, I can then add it in the file(txt file)

thank u again
knid regards
nasser

--------------------------------------------------------------------------------
Jul 24 '06 #1
6 7579
axas
32 New Member
All that you want is to transfer from the array to the txt file my friend?
I did'nt understand well your question.
Jul 24 '06 #2
nasser
12 New Member
HI, thank u for ur reply, what i want is take the data form the data gridview and then but them in an array and form the array write them to a text file.

thank u again,

Kind regards,
nasser
Jul 24 '06 #3
nasser
12 New Member
All that you want is to transfer from the array to the txt file my friend?
I did'nt understand well your question.
HI,
thank u for ur reply, what i want is take the data form the data gridview and then but them in an array and form the array write them to a text file.

thank u again,

Kind regards,
nasser
Jul 24 '06 #4
axas
32 New Member
You have to do that:

array[] <- DataGrid1[col1, DataGrid1.CurrentRowIndex].ToString(); // or another type
array[] <- DataGrid1[col2, DataGrid1.CurrentRowIndex].ToString(); // or another type
...
array[] <- DataGrid1[coln, DataGrid1.CurrentRowIndex].ToString(); // or another type

... then write the array[] to the file.

Do you mean something like this?
Jul 27 '06 #5
arundamu
1 New Member
Dear All

The project that i'm doing is readind data form txt file and then put these data in an array and display them in datagridview. this part has been done. But the second part is when I excuate the programe of course the data will be displaied in the datagridview then when I write data in the new and last row in the datagrid view I would like when I click on a save button for example this new row will be written in an array so, I can then add it in the file(txt file)

thank u again
knid regards
nasser

--------------------------------------------------------------------------------
Hi Nasser,

Even I am trying to do the same of collecting data from txt file and displaying it in a datagrid view in C# . could you help me with huv you could do that. I m still bogging with this.

Arun
Jan 4 '07 #6
Khoder
1 New Member
Dear All

The project that i'm doing is readind data form txt file and then put these data in an array and display them in datagridview. this part has been done. But the second part is when I excuate the programe of course the data will be displaied in the datagridview then when I write data in the new and last row in the datagrid view I would like when I click on a save button for example this new row will be written in an array so, I can then add it in the file(txt file)

thank u again
knid regards
nasser

--------------------------------------------------------------------------------
Dear nasser

I'm a new member here but i red ur question , and i have the answer and a comment on your think.
First : The Comment
* why u want to save data in an array u already saved it in the file except if u wanna to use the array again.

Second : The answer

This is the method u can follow :
Code

StreamWriter sw = File.CreateText(String Path+Name);
for (int i ; i<dataGridView.Rows.Count-1 ; i++)//looping on all rows
{
sw.WriteLine ( dataGridView.Rows[i].Cell["First Column name "].value.ToString()+ "," + dataGridView.Rows[i].Cell["Second Column name "].value.ToString() + ....and so on);
}
sw.close();

if this is the answer for ur question tell me or if it wasn't also tell me
yasser khoder
Feb 3 '08 #7

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: nasser | last post by:
Hi, I'm writting a programe using C# that reads data from file and then store these data in array and display these data from the array to the datagridview. this the frist part. the second part is ...
3
by: nasser | last post by:
Dear All I would like the code that allow me to write data in a new row in the datagridview and then when for example click on a save button Iwould like these data to transfer directly to the...
1
by: ashik478 | last post by:
Hi! I have a problem. I have a table in oracle database with one field is primary key. Now I want to insert data from Datagridview with hide column which contain not null field(this field is...
0
by: anureddy | last post by:
help me how to add datagridview columns to another table,using windowsapplications. and set the displaymember and value member datagridviewcomboboxcolumn. i used this below code but that not...
2
by: ssknov | last post by:
hi everybody pls help me to solve my problem. Though my code is right (i feel) i couldnt achieve the result i expect , i tried in all means, any one pls solve my headache!. private void...
5
by: usyra42 | last post by:
We have Created DataGridView from a XML. Now whenever we update the values in the cells of DataGrid View it should reflect the XML also. Can u pls help in this...
0
by: nithyamca | last post by:
Hi I want change the process of key events in datagridview in vb.net .. now enter key is press in datagridview it move to next row but i want to stop this process pls help me
0
by: rk4088 | last post by:
Hi all, I'm a new to vb.net. I'm having datagridview in my windows form. I've to make a focus in the fourth column of the datagridview.. I need coding for this.. Pls help.
2
by: priyanka rangan | last post by:
friends pls help me........ i want to fill datagridview with the values selected through the query.. con1 = new System.Data.SqlClient.SqlConnection(); con1.ConnectionString = "Data...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.