Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Hide Column in Dbgrid?

Status
Not open for further replies.

joelxez

Programmer
Apr 18, 2002
67
PH
Dear experts,

I have dbgrid in form which is to view the records in the table, i'm using Data Control. It seems that ID field is not important to view. How can i hide ID Field Column in the DBGrid?

Joel,
 
There are 2 easy approaches to this:
1. use a Flexgrid rather than a DBGrid and use ColWidth property
2. Use a query (SELECT Name, Address1 FROM myTable) instead of the table in your ADODC control

You'll need to look up VBHelp for details on using ADODC control with a query, but you will find it a valuable technique until you're ready for ADO code access to data
________________________________________________________________
If you want to get the best response to a question, please check out FAQ222-2244 first

'People who live in windowed environments shouldn't cast pointers.'
 
Um, Just use:

DataGrid1.Columns(iColIndex).Visible = False

Where iColIndex is the index of the column starting with 0.

You may need that unique ID field later, so leave it in your query. [/b][/i][/u]*******************************************************
General remarks:
If this post contains any suggestions for the use or distribution of code, components or files of any sort, it is still your responsibility to assure that you have the proper license and distribution rights to do so!
 
<G>
Thanks CCLINT,
As I was saying, there are THREE easy....
________________________________________________________________
If you want to get the best response to a question, please check out FAQ222-2244 first

'People who live in windowed environments shouldn't cast pointers.'
 

[cheers] [/b][/i][/u]*******************************************************
General remarks:
If this post contains any suggestions for the use or distribution of code, components or files of any sort, it is still your responsibility to assure that you have the proper license and distribution rights to do so!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top