Re: datagrid display when loading config file



Thank you Peter.
I also found a simpler approach to just load the timer interval from the
config file into a textbox for editing.
XmlDocument myConfig = new XmlDocument();
myConfig.Load("c:\\Service.exe.config");
string strXPath;
XmlNode oNode;
strXPath = "configuration/appSettings/add[@key='interval']/@value";
oNode = myConfig.SelectSingleNode(strXPath);
textBox1.Text = oNode.InnerText;


"Peter Bromberg [C# MVP]" <pbromberg@xxxxxxxxxxxxxxxxxxx> wrote in message
news:68BC4DA2-B2B5-46EB-8891-085A643BC6C4@xxxxxxxxxxxxxxxx
When you assign a DataSet to a Windows Forms DataGrid, the default
behavior
is to display the + sign. If you want the grid to show one table, bind it
just to the one table of the DataSet and it will display expanded.
Peter

--
Co-founder, Eggheadcafe.com developer portal:
http://www.eggheadcafe.com
UnBlog:
http://petesbloggerama.blogspot.com




"hazz" wrote:

With this code, the config file(listed below) opens initially into the
datagrid display with only a plus sign '+'.
On clicking that, it becomes expanded to;
-
appsettings
add

When I click on appsettings, it reverts back to '+' On clicking that,
- appsettings add is displayed
Finally, when I click on appsettings this time, the contents of the
config
file is displayed.
What is going on here? How could I have the config file load into an
already expanded state?
Thanks -Greg

***************** code ******************************************
dsConfigFile = new DataSet("configfile");
dsConfigFile.ReadXml("c:\\Service.exe.config");
dataGrid1.DataSource = dsConfigFile;

****************** config file ******************************************
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<appSettings>
<add key="interval" value="10000" />
<add key="sDbConn" value="Data
Source=xxxx;Database=xxxx;UID=xxx;Pwd=xxxx"
/>
</appSettings>
</configuration>





.



Relevant Pages