473,769 Members | 5,724 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

storing a DataGridView in a Setting

Is it possible to store an unbound DataGridView component into a setting?
I naively tried defining a Setting that is a DataGridView called DGV, then
simply assigning it:
Properties.Sett ings.Default.DG V = myDataGridView;
After I closed the program, the user.config file shows an empty value, so
apparently that is not the way to do it.
Apr 13 '06 #1
10 7797
michael sorens wrote:
Is it possible to store an unbound DataGridView component into a
setting? I naively tried defining a Setting that is a DataGridView
called DGV, then simply assigning it:
Properties.Sett ings.Default.DG V = myDataGridView;
After I closed the program, the user.config file shows an empty value,
so apparently that is not the way to do it.

I never found a way to do it -- tried dozens of methods. I finally gave up and just bound the DataGridView to a DataSource and serialized the underlying DataSet.

--
Take care,
Ken
(to reply directly, remove the cool car. <sigh>)
Apr 14 '06 #2
Hi,

I don't think you can store the DataGridView into a setting, because the
DataGridView itself doesn't contain any data. The data is stored in the
underlying DataSource. So, it will be better to store the datasource
instead. HTH.

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."

Apr 14 '06 #3
Kevin Yu [MSFT] wrote:
I don't think you can store the DataGridView into a setting, because the
DataGridView itself doesn't contain any data. The data is stored in the
underlying DataSource. So, it will be better to store the datasource
instead. HTH.


So, what's the datasource of an unbound DataGridView? Specifically, I had a DataGridView displaying the files selected from an OpenFileDialog. Those file names were used by other methods just fine, but there appeared to be no way to serialize those names.

--
Take care,
Ken
(to reply directly, remove the cool car. <sigh>)
Apr 15 '06 #4
Actually, Ken, you can't store a DataGridView in the Settings file because
it isn't Serializable.

--
HTH,

Kevin Spencer
Microsoft MVP
Professional Numbskull

Hard work is a medication for which
there is no placebo.

"Ken Arway" <ka****@jaguar. att.net> wrote in message
news:et******** ******@TK2MSFTN GP02.phx.gbl...
Kevin Yu [MSFT] wrote:
I don't think you can store the DataGridView into a setting, because the
DataGridView itself doesn't contain any data. The data is stored in the
underlying DataSource. So, it will be better to store the datasource
instead. HTH.


So, what's the datasource of an unbound DataGridView? Specifically, I had
a DataGridView displaying the files selected from an OpenFileDialog.
Those file names were used by other methods just fine, but there appeared
to be no way to serialize those names.

--
Take care,
Ken
(to reply directly, remove the cool car. <sigh>)

Apr 15 '06 #5
Kevin Spencer wrote:
Actually, Ken, you can't store a DataGridView in the Settings file because
it isn't Serializable.

Yep, I learned that one the hard way.
--
Take care,
Ken
(to reply directly, remove the cool car. <sigh>)
Apr 16 '06 #6
Hi Ken,

This depends on how you display data on the DataGridView. Could you show us
some of your code that put data on the datagridView?

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."

Apr 17 '06 #7
Kevin Yu [MSFT] wrote:
Hi Ken,

This depends on how you display data on the DataGridView. Could you show us
some of your code that put data on the datagridView?


Unfortunately, I no longer can show how I was populating the unbound DataGridView--now that I'm using a bound DataGridView, the current code shows how I'm populating it's underlying dataset and I don't have samples of the previous code.

--
Take care,
Ken
(to reply directly, remove the cool car. <sigh>)
Apr 18 '06 #8
So how do I connect the DataGridView to a DataSource after I have filled
the DataGridView?

On Thu, 13 Apr 2006 18:35:00 -0700, Ken Arway <ka****@jaguar. att.net>
wrote:
michael sorens wrote:
Is it possible to store an unbound DataGridView component into a
setting? I naively tried defining a Setting that is a DataGridView
called DGV, then simply assigning it:
Properties.Sett ings.Default.DG V = myDataGridView;
After I closed the program, the user.config file shows an empty value,
so apparently that is not the way to do it.

I never found a way to do it -- tried dozens of methods. I finally gave
up and just bound the DataGridView to a DataSource and serialized the
underlying DataSet.


Apr 18 '06 #9
michael sorens wrote:
So how do I connect the DataGridView to a DataSource after I have filled
the DataGridView?

On Thu, 13 Apr 2006 18:35:00 -0700, Ken Arway <ka****@jaguar. att.net>
wrote:
michael sorens wrote:
Is it possible to store an unbound DataGridView component into a
setting? I naively tried defining a Setting that is a DataGridView
called DGV, then simply assigning it:
Properties.Sett ings.Default.DG V = myDataGridView;
After I closed the program, the user.config file shows an empty
value, so apparently that is not the way to do it.

I never found a way to do it -- tried dozens of methods. I finally
gave up and just bound the DataGridView to a DataSource and serialized
the underlying DataSet.


I did all the work in the VS2005 IDE: I created a dataset from an XSD file (using XSD.exe), added it to the project and after compiling added it as a DataSource in VS2005. The appropriate BindingSource was automagically added and I simply dragged the DataGridView from the DataSource Explorer onto my form. After that, I wrote my code to populate the DataSet, not the DataGridView.

--
Take care,
Ken
(to reply directly, remove the cool car. <sigh>)
Apr 19 '06 #10

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

Similar topics

4
22119
by: Stropher | last post by:
I have the following: this.dataGridViewBill.DataSource = tblResult; //hide the following columns this.dataGridViewBill.Columns.Visible = false; //email this.dataGridViewBill.Columns.Visible = false; //mobiltelefon When I run the programm, the columns are still displayed. I am developing with Visual C#2005 Express Edition Beta.
4
7280
by: Chris Botha | last post by:
VS2005 and I have a DataTable displayed in a DataGridView that needs custom sorting, with the DataSource of the grid set to the DataTable and the SortCompare event just won't fire. Then I found this in the docs "This event occurs only when the DataSource property is not set and the VirtualMode property value is false" This seems really odd but may be true. I can't see what the purpose of this event is then, how else will one use the...
7
12631
by: Mitchell S. Honnert | last post by:
Is there an equivalent of the DataGrid's DataGridTableStyle for the DataGridView? If not, is there an easy way to duplicate the DataGridTableStyle's functionality for the DataGridView? Here's the background for my question... Before I switched my application over to the Fx 2.0, I used a DataGrid to display my data. I would store different DataGridTableStyles (each one with a custom set of columns) in the DataGrid.TableStyles property...
11
27321
by: Kevin | last post by:
I've been searching forever for examples of saving data changes in a DataGridView. There's all kinds of examples, but none really show how to save changes. Someone please help me. I have a Windows Forms program with a DataGridView and a BindingSource added to a form. Here is the code I'm using to populate the grid: Dim CRClassesTableAdapter As SqlDataAdapter Dim CRClassesTable As New DataTable()
3
1837
by: Johnny E. Jensen | last post by:
Hello Dot sure if this it the right group but here goes. I'am using the DataGridView multiple times in my application, and then i'll read a book on inherience, and that opend a new world for me. So i'll Created a class that inherience from the DataGridView Like: public class AWDataGridView : System.Windows.Forms.DataGridView In the Dispose event i'll want to store some info about the DataGridView's
2
4289
by: mrstrong | last post by:
Gday, I have a datagridview that I am creating the columns programatically which all seems to work fine. I have a couple of dropdown boxes, so I have set the editMode= EditOnEnter. Now my checkboxes dont seem to work, and the datagridview throws a dataerror when I try to leave the cell after trying to check/uncheck the checkbox?!
2
6126
by: mrstrong | last post by:
Gday, Why would all my checkboxes inside a datagridview stop working (ie checked state not updating when user clicks) when the datagridview's editmode property is changed to "EditOnEnter"? It seems to return an error: "Formatted Value of the cell has wrong type". It works fine when the datagridview's editmode property is
6
4416
by: hzgt9b | last post by:
Using VS2005, VB.NET, I have a windows app with a DataGridView (lets call it DGV). At some point in the life of my app I want to clear the selection of the currently selected row (Multiselect=false) from DGV - to do that I tried this: DGV.ClearSelection() Cosmetically this appears to work but it appears that the DGV still stores the index value of the selected row. If the 1st row I click on after executing ClearSelection() is the row...
3
5744
by: Andrus | last post by:
I have DataGridView in virtual mode containing 3500 rows. In code below, assigning to RowCount value to 3500 takes 8 seconds. CPU usage goes high at this time. Stepping by F11 into user code shows few celltemplate property getters and combobox/datecombo constructor calls without database access which does not take a lot of time. Debug output (below) shows lot of messages Stepping over non-user code. Running in release mode from...
0
9589
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9423
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10045
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9863
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8870
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6673
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5298
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
3958
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 we have to send another system
3
2815
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.