|
-
Dec 2nd, 2002, 06:51 PM
#1
Thread Starter
Frenzied Member
Exclude field from view of Datagrid
How do I exclude a field in a RS from being shown in my datagrid?
thnx,
squirrelly1
Now happily married and still crankin' away at the keyboard.  Life is grand for a coder, no?
-
Dec 3rd, 2002, 02:47 AM
#2
Hyperactive Member
VB Code:
dg.Columns(0).Width = 0 '1st column will not be displayed
-
Dec 3rd, 2002, 08:31 AM
#3
PowerPoster
Another thought is to direct your datasource to an SQL statement which doesn't include the excluded column.
-
Dec 3rd, 2002, 09:47 AM
#4
Thread Starter
Frenzied Member
hmm...
These are both wonderful ideas and would work great if my datagrid was setup a specific way everytime; however, it isn't. The user of my program has the ability to choose which fields he wants displayed in the datagrid and in which order, so I can not know where the field is located that I want excluded from viewing.
Unless...
Ok, how would I know which field is the last field shown in the datagrid?
If I could do this, then I could just set that columns visible property to false...
thanx,
squirrelly1
Now happily married and still crankin' away at the keyboard.  Life is grand for a coder, no?
-
Dec 3rd, 2002, 10:59 AM
#5
Fanatic Member
The column captions and positions can be determined:
for i = 0 to datagrid1.Columns.Count - 1
position = i
caption = datagrid1.Columns(i).Caption
next i
Similarly the fields in the underlying recordset
for i = 0 to rs.Fields.Count - 1
position = i
name= rs.Fields(i).Name
next i
VB 6.0, Access, Sql server, Asp
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|