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

Can I hide the data of a column?

meomap0z1
I have this table of data. Now I wanna hide the data of the "Password" column. How can I do that?. Many thanks
Attached Images
File Type: png hideData.png (18.7 KB, 148 views)
Apr 26 '20 #1
5 18148
SioSio
272 256MB
Here's an easy way to just hide the display.
This is VB.net code.
Expand|Select|Wrap|Line Numbers
  1.     ''' <summary>Set password cell Number</summary> 
  2.     Private Function IsPasswordCell(ByVal row As Integer, ByVal column As Integer) As Boolean
  3.         Return column = 2
  4.     End Function
  5.     ''' <summary> Returns True if password cell</summary> 
  6.     Private Function IsPasswordCell(ByVal address As Point) As Boolean
  7.         Return IsPasswordCell(address.Y, address.X)
  8.     End Function
  9.  
  10.     Private Sub DataGridView1_CellFormatting(ByVal sender As Object, ByVal e As _
  11.       DataGridViewCellFormattingEventArgs) Handles DataGridView1.CellFormatting
  12.         If IsPasswordCell(e.RowIndex, e.ColumnIndex) Then
  13.             'Mask password 
  14.             e.Value = StrDup(Len(e.Value), "*"c)
  15.         End If
  16.     End Sub 
Apr 30 '20 #2
If you want to hide an entire row or column, right-click on the row or column header and then choose Hide. To hide a row or multiple rows, you need to right-click on the row number at the far left. To hide a column or multiple columns, you need to right-click on the column letter at the very top.
Apr 30 '20 #3
tmudgal16
10 Byte
You can only hide full columns. If you are hiding the data in the table is important, then the data below needs to be moved to a different sheet. Or, if it only needs to be hidden when printed, then you can change the font color to match the background color.
Feb 7 '23 #4
Vanisha
25 16bit
Yes, you can hide data of a column in a database, spreadsheet, or table by making the column's width smaller, by setting the font color to match the background, or by using a formula to display an empty string.

However, keep in mind that hiding data in this manner doesn't actually make the data secure, as it can still be accessed by someone with the right knowledge and tools. If you need to protect sensitive information, you should consider using encryption or other security measures.
Feb 7 '23 #5
danp129
323 Expert 256MB
If you were binding to an object of List<User> you could add the [Browsable(false)] attribute to the Password property. Alternatively you could do this:

Expand|Select|Wrap|Line Numbers
  1.         private void FillGrid()
  2.         {
  3.             DataGridView1.DataSource = YourDataSource;
  4.             var passCol = DataGridView1.Columns["Password"];
  5.             if(passCol != null )
  6.             {
  7.                 DataGridView1.Columns[passCol.Index].Visible = false;
  8.             }
  9.         }
  10.  
Aug 25 '23 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

6
by: Das | last post by:
Hi everyone, I'm using datagrid control to display the data. I want to hide column to be displayed into the data grid. I'm using the code as given below: Method given below is used to bind the...
2
by: Thanh Nu | last post by:
Hi, I would like to hide a column in a web datagrid (with create columns automatically at runtime checked), and I cannot refer to the columns collection like this: DataGrid1.Columns(0).Visible...
4
by: Sidney | last post by:
Hi~ I want to know if I want to hide a column in datagrid because I don't want to show that column of data. How can I do this? Sidney
3
by: Jason | last post by:
How do I hide a column in a GridView in ASP.NET 2.0 when all of the columns are autogenerated based on the datasource? I want to hide the first of three columns, but the following doesn't work: ...
9
by: ghostwolf | last post by:
Hi, I want to hide a column in the asp:GridView, say one of the column of asp:BoundField. But it is not allowed to put <divinside for setting it display:none. What can I do? Thanks in millions.
4
by: Luqman | last post by:
I have populated the Child Accounts and Parent Accounts in a Grid View Control, I want to hide the Select Column of Parent Accounts, but not the Child Accounts, is it possible ? I am using VS...
0
by: =?ISO-8859-1?Q?=22Fernando_A=2E_G=F3mez_F=2E=22?= | last post by:
Hello all, I have an ASP.NET page with a GridView bounded to a DataSource. When I click the edit button/link, I'm able to update the data with no problemos. However, if further in my code I hide...
0
Debadatta Mishra
by: Debadatta Mishra | last post by:
Introduction In this article I will provide you an approach to manipulate an image file. This article gives you an insight into some tricks in java so that you can conceal sensitive information...
2
by: nikhilnangia1 | last post by:
How do you Hide a Column of data in a Data Grid in Access 2007 using VBA code? Please help me. This is urgent
1
by: coreyk | last post by:
I have been trying for ever to hide a column in gridview using the following code, GridView1.Columns.Visible = false; but the debugger says that index is out of range, the number columns when...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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: 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
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
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...

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.