Tilted Forum Project Discussion Community  

Go Back   Tilted Forum Project Discussion Community > Interests > Tilted Technology


 
 
LinkBack Thread Tools
Old 04-26-2004, 12:51 PM   #1 (permalink)
Insane
 
Location: West Virginia
C# and dataGrid

Okay, I am doing a dataGrid that loads in an XML file and displays it on the screen by using the following...

Code:
private void loadButton_Click(object sender, System.EventArgs e)
{
     mySet = LoadBooks( @"C:\Documents and Settings\Jay\Desktop\C#\pgm2\Books.xml" );
     dataGrid.DataSource = mySet;
}

public DataSet LoadBooks( string strFileName )
{
	DataSet loadSet = new DataSet();
	loadSet.ReadXml( strFileName );
	return loadSet;
}
That part works great. Here's the problem, I also have two text fields for the user to input a <TITLE> and an <AUTHOR>. I cant figure out how to do this and then update it on the screen in the dataGrid. I do not want to add the new book and author directly to the file as I have a save button that will end up doing that for me.

Here's the method prototype that my add book button click will call:
Code:
addBook( mySet, newTitle.Name, newAuthor.Name );
__________________

- Artsemis
~~~~~~~~~~~~~~~~~~~~
There are two keys to being the best:
1.) Never tell everything you know
Artsemis is offline  
Old 04-27-2004, 12:07 PM   #2 (permalink)
Insane
 
Location: Belgium
can't really help you, but you might check out datagrids girl website

www.datagridgirl.com
__________________
Let's GO
Cuball is offline  
Old 04-27-2004, 06:24 PM   #3 (permalink)
Crazy
 
What you want to do is create a new DataRow and add it to the DataSet and then rebind the DataSet to the DataGrid. Then when the user clicks "Save" then you update the XML file. Here's a link showing you how to do that
twister002 is offline  
Old 04-28-2004, 03:51 AM   #4 (permalink)
Insane
 
Location: West Virginia
I had done something similar to what you just posted twister, but I had a problem with my dataset having a duplicate table name inside. If I gave the new one a different name, it wouldn't add it to the same table, but create a new one in the grid.

I ended up finding a simple update method to call on my current table

Thanks for the help guys.
__________________

- Artsemis
~~~~~~~~~~~~~~~~~~~~
There are two keys to being the best:
1.) Never tell everything you know
Artsemis is offline  
 

Tags
datagrid


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT -8. The time now is 04:33 AM.

Tilted Forum Project

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Search Engine Optimization by vBSEO 3.6.0 PL2
© 2002-2012 Tilted Forum Project

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73