473,320 Members | 1,817 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,320 software developers and data experts.

Retaining column widths in the datagridview (.net 2.0) :-(

Hi all,

Can anyone tell me if there is an easy way to retain per-user column
widths for the datagridview in a windows forms application.

I know I could do it with a lot of database programming and what not,
but I was hoping there would be a much easier solution. It seems like
such an obvious requirement, but I can find any articles on how to do it.

Many thanks to anyone who can advise

Kindest Regards

Simon
Mar 8 '07 #1
3 1946
Have you considered making a dataset and storing the values in there (along
the lines of 1 table with 3 columns [tablename, columnname, width] and just
adding the values through a loop) then saving the xml in the users
application data folder.

Then when the application starts, load the xml file if it exists and restore
the changes.

"Simon Harvey" wrote:
Hi all,

Can anyone tell me if there is an easy way to retain per-user column
widths for the datagridview in a windows forms application.

I know I could do it with a lot of database programming and what not,
but I was hoping there would be a much easier solution. It seems like
such an obvious requirement, but I can find any articles on how to do it.

Many thanks to anyone who can advise

Kindest Regards

Simon
Mar 8 '07 #2
Hi Andrew

Thanks very much for your thoughts. If there isn't an easier way I may
have to do just that - but I'm holding out for something simpler! :-)

I'm just hoping, perhaps in vain, that there is some dead easy way to
get this to work using some Visual Studio design time trickery.

Anyone?

Thanks again

Simon
Mar 8 '07 #3
You can bind them to User-scoped Application Settings. I'm not sure whether
this can be done explicitly in the Designer, but it isn't hard. Here are a
couple of references for you:

http://msdn2.microsoft.com/en-us/library/0zszyc6e.aspx
http://msdn2.microsoft.com/en-us/lib...9h(vs.80).aspx

--
HTH,

Kevin Spencer
Microsoft MVP

Help test our new betas,
DSI PrintManager, Miradyne Component Libraries:
http://www.miradyne.net

"Simon" <si***@nothanks.comwrote in message
news:Ol**************@TK2MSFTNGP03.phx.gbl...
Hi Andrew

Thanks very much for your thoughts. If there isn't an easier way I may
have to do just that - but I'm holding out for something simpler! :-)

I'm just hoping, perhaps in vain, that there is some dead easy way to get
this to work using some Visual Studio design time trickery.

Anyone?

Thanks again

Simon

Mar 9 '07 #4

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

Similar topics

3
by: Steve Sabljak | last post by:
I seem to having a little trouble getting a table to display correctly in both msie and firefox. I want to set the table and column widths in pixels, and have some cell padding too. The table...
5
by: nimdez | last post by:
Hi, I am working on an existing code base in which a lot of data displayed to the user is formatted in tables. Most tables are printed row-by-row using printf() with "%s" print conversion...
18
by: chimalus | last post by:
I am using a table with no column widths specified, letting the table layout manager do its thing for figuring out the column widths, and this works just fine. Now I want to make the table...
1
by: Rich | last post by:
Hello, I am reading data from a sql server table that is under replication. This table has the replicatin GUID column that is generated with replicatin. I am reading the data from a...
4
by: Chuck | last post by:
I'm setting the column with for a gridview (25+- columns) and have paging turned on. When the gridview is first displayed, the column widths are all set to the default. But after paging to...
5
by: Roger | last post by:
I am trying to do a 'simple' task in a DGV control. The problem is this. I have an unbound DGV with all 'AllowUser' options disabled. RowHeader.Visible=False ColumnHeader.Text is labelled as...
2
by: Midsomer | last post by:
Hi. I have an Access database with a form containing 4 datasheets and I allow the user to change column widths. On closing the form, a routine is fired that saves each column width to an INI file....
2
by: =?Utf-8?B?Sm9uYXRoYW4=?= | last post by:
Hi I so new to vb.net that the paints still wet... I would like to load a listbox (as I would do using vba). The properties show multicolumn = true column width = 300 How do I set the...
3
by: =?Utf-8?B?bWljaGFlbCBzb3JlbnM=?= | last post by:
I am wondering what is considered a best practice for setting column widths to fit the data for a DataGridView (.Net 2.0) that was created on-the-fly from an arbitrary query. What I would probably...
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
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
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...
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....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

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.