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

C# - DataGrid on Windowsform.

Hi all,

Was wondering if somebody could help me or at least point me in the right
direction...

I have a System.Windows.Forms.DataGrid, which is bound to a dataset. I
would like to hide certain columns, so that the user can't see them..

Also was wondering if it was possible if when a cell was selected the whole
row is selected..
I want it to behave like a Listbox, I guess..

Thanks

Wayne Gibson
Nov 15 '05 #1
2 1253
Wayne,

If you want to select a whole row when a cell is selected, you will want
to hook up to the CellChanged event and then select the whole row when the
cell changes.

If you want to hide some columns, then what you will want to do is get
the TableStyles for the particular table you want to view, and then get the
ColumnStyles for that table. Then, you would just remove the columns that
you don't want to see.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- ni**************@exisconsulting.com

"Wayne Gibson" <wa**********@rendersoft.com> wrote in message
news:bj*******************@news.demon.co.uk...
Hi all,

Was wondering if somebody could help me or at least point me in the right
direction...

I have a System.Windows.Forms.DataGrid, which is bound to a dataset. I
would like to hide certain columns, so that the user can't see them..

Also was wondering if it was possible if when a cell was selected the whole row is selected..
I want it to behave like a Listbox, I guess..

Thanks

Wayne Gibson

Nov 15 '05 #2
Thanks, that helped a lot..
Nov 15 '05 #3

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

Similar topics

1
by: geek | last post by:
Hi all, I have a datagrid I want to store the data in the datagrid to a dataset. Can anybody please tell me how to do this. TIA.
10
by: ShadowsOfTheBeast | last post by:
hi all i am trying to bind data to my datagrid from a listbox which i think it should work but an error is coming up saying i have to bind to a datasource that implements the Inumerable or...
2
by: SammyBar | last post by:
Hi, I'm trying to bind a custom collection class to a data grid, following the guidelines from the article http://msdn.microsoft.com/msdnmag/issues/05/08/CollectionsandDataBinding/default.aspx....
1
by: Raul Cortes | last post by:
Hi. I am using a windowsform datagrid to modify a table. The DataSet seems to be filled fined. The DataTable seems to be ok. I am not using 'read only' anywhere. The DataSource seems to be...
15
by: Rik Brooks | last post by:
I find it amazing that I am quickly able to find answers to obscure questions but simple ones elude me. I have a datagrid that I've bound, no problem at all. Now I want to - programatically -...
9
by: Rekha | last post by:
The data is filled in datagrid. I want to know how to add a checkbox column in datagrid? In the runtime, checkbox is checked then instead of checkbox value the (caseID )column value is retained....
2
by: Arsalan | last post by:
Is it possible to make a DataGrid containing other controls, for e.g checkbox or combo box ?? Is it possible to directly edit those DataGrid which are bound to Data set
4
by: juya | last post by:
Hi all, I have been struggling with datagrid for more than a week. I pretty new to datagrid, have never used it before. All I am trying to do is Edit the TDBGrid in Visual basic. I am...
3
by: Sonu | last post by:
Hello, I have a winform1 that contains the Datagrid and in winform2 you can add new values to the database for datagrid. I cannot update the datagrid on winform2 close event! All I want is to...
3
by: =?Utf-8?B?SmFja21hYw==?= | last post by:
Hi all, Hopefully someone can offer some advice. I've got a form with two data grids on it. One has names of boxes in it, the other grid has contents of the boxes. I want to click on a box in...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

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.