473,324 Members | 2,548 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,324 software developers and data experts.

datagrid display when loading config file

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>
Jul 11 '06 #1
2 2149
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>
Jul 11 '06 #2
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]" <pb*******@yahoo.nospammin.comwrote in message
news:68**********************************@microsof t.com...
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>

Jul 11 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Darryn Ross | last post by:
Hi there... I am trying to display both parent and child details in my datagrid at the same time but i cannot seem to do it. It's either one or the other, if anyone has any suggestions on how i...
2
by: Raj | last post by:
Hi, When we are sorting the DataGrid Boolean column the grid is becoming redcross. I have my own PPMIPDataGridBoolColumn class inherited from System.Windows.Forms.DataGridBoolColumn. In this...
5
by: John Richardson | last post by:
I've been bothered for some time about my DataGrid not populating my rows very quickly. I have about 10K rows loading into the grid. I create a datatable dt with 2 columns, an ID and a display. ...
2
by: Joanne | last post by:
Hi, I have an "interesting" problem with UserControls in a datagrid and I'm desperate for your help as I work alone and have no-one else to ask. It is quite complicated but I'll try to keep it...
9
by: Steve | last post by:
How I can remove an AutoGenerated column? I wnat to inlcude the primary key in the resultset for creating some custom LinkButtons, but I don't want it (the PK) displayed in the DataGrid. I tried...
2
by: simon | last post by:
hello, new to vb.net, have a few questions about DataGrid. I have a dataGrid that is working pulling a dataset back from a stored proc and binding to the datagrid for display the datagrid's...
3
by: daz_oldham | last post by:
I am populating my datagrid 'by hand' by that I mean that i am not using the wizard! What I would like to know, is if I can format my colums - for example if I have a column that is returning...
4
by: Rush | last post by:
I'm new to web development in Visual Studio 2005, and I'm creating a web site using ASP.NET, and right now its a very simple page with only labels on it. I have a third party that hosts the site,...
5
by: rn5a | last post by:
In my application, I want to populate all the directories & files existing in a directory on the server in a DataGrid. To ensure that all the directories get listed first followed by all the files,...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....

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.