| | |
problems editing dataGrid and 'Tab' delimited text file
Please support our C# advertiser: Intel Parallel Studio Home
Thread Solved |
•
•
Join Date: Oct 2007
Posts: 52
Reputation:
Solved Threads: 0
c# Syntax (Toggle Plain Text)
StreamReader reader = File.OpenText("mystations.txt"); string line = reader.ReadLine(); while (line != null) { // string[] stationtxt = line.Split('\t'); string name = line.Split('\t')[0]; string url = line.Split('\t')[1]; string desc = line.Split('\t')[2]; Image img = Image.FromFile("c:/pictures/"+ name + ".jpg"); line = reader.ReadLine(); dgLogo.Image = new Bitmap(img); dataGridView1.Rows.Add(name, url, desc, img); //(stationtxt); } reader.Close(); reader.Dispose();
I'am able to edit the values in the datagrid but when i reload the form it display the original values of course.
i want to catch the edited values and save it again to the tab delimited text file.
and also be able to delete a row from the text file and datagrid.
the image column is there just for display its not editable.
if someone can provide me a sample or point me in the right direction
•
•
Join Date: Oct 2007
Posts: 52
Reputation:
Solved Threads: 0
believe me a read a lot of guides and the worst are from msft msdn website there samples never works.
i have the logic in my head. the problem is converting that to code, in where event to add it. datagrid have a lot lot of events,
for example i have to added to oncellchange event, onclick event, on edit event.
all codes have very different methods and it get confusing.
-thanks BTW, I think you reply to my other post, right?
i have the logic in my head. the problem is converting that to code, in where event to add it. datagrid have a lot lot of events,
for example i have to added to oncellchange event, onclick event, on edit event.
all codes have very different methods and it get confusing.
-thanks BTW, I think you reply to my other post, right?
•
•
Join Date: Oct 2007
Posts: 52
Reputation:
Solved Threads: 0
•
•
•
•
As for your other post - which one?
•
•
•
•
I took a csv file and chucked it into a list of array of string and then added it.
so my doubt is not how to add the text file to the datagrid I did that already. is how to get the new edited values once the user edit them directly in the datagrid. then get all the values from the datagrid and save them back to the 'tab' delimited text file.
Last edited by reaven; Aug 25th, 2008 at 4:33 pm.
•
•
Join Date: Aug 2008
Posts: 1,735
Reputation:
Solved Threads: 186
You dont, or rather you shouldnt need to it should all be done for you..
See http://msdn.microsoft.com/en-us/libr...tychanged.aspx
See http://msdn.microsoft.com/en-us/libr...tychanged.aspx
•
•
Join Date: Oct 2007
Posts: 52
Reputation:
Solved Threads: 0
•
•
•
•
You dont, or rather you shouldn't need to it should all be done for you..
i am reading from a text file and passing that values to the datagrid for easy viewing and (possible and hope so) easy editing.
or do you mean this could be done even if i am not using a database?
•
•
Join Date: Oct 2007
Posts: 52
Reputation:
Solved Threads: 0
I know I read it but if you see my code I fill the datagrid individually because of the image column if I use the list how I fill the images column because my textfile only contain the name of the image file, the image is in another folder and the datagrid column is a DataGridViewImageColumn.
i was trying the code from the page you post when i encounter the problem of the image.
i was trying the code from the page you post when i encounter the problem of the image.
![]() |
Other Threads in the C# Forum
- Previous Thread: Using (externally?) declared variables with Forms
- Next Thread: problem with xml file
| Thread Tools | Search this Thread |
.net access algorithm array asp.net barchart bitmap box broadcast c# check checkbox client combobox control conversion csharp custom database databaseconnection datagrid datagridview dataset datetime dbconnection degrees design development draganddrop drawing encryption enum event eventhandlers excel file firefox form format forms function gdi+ grantorrevokepermissionthroughc#.net httpwebrequest image index input install java label libraries list listbox loop mandelbrot marshalbyrefobject math mouseclick movingimage mysql mysql.data.client operator path photoshop picturebox pixelinversion platform post programming radians regex remote remoting resourcefile richtextbox server sleep socket sql statistics stream string system.servicemodel table tcpclientchannel text textbox thread time timer update usercontrol validation visualstudio webbrowser windows winforms wpf wpfc# xml






