Solved

How to kill empty columns!!

Posted on 1998-10-13
1
139 Views
Last Modified: 2010-04-30
My position is that I have a DBGRID with all sorts of columns and information in it.  

Lets say the DBGRID has an empty column, ie. no data in that column.

How do I figure this out (through code) and delete the column, or at least hide it?

Thanks.
0
Comment
Question by:MarkA
1 Comment
 
LVL 3

Accepted Solution

by:
vmano earned 200 total points
Comment Utility
here is how:
this code finds you the contents of a cell in a DBGrid control

Dim igColumn As Integer
Dim igRow As Integer
Dim vargBookmark As Variant
 
      Private Sub DBGrid1_MouseUp(Button As Integer, Shift As Integer, _
                                  X As Single, Y As Single)
         igColumn = DBGrid1.ColContaining(X)   'Set the Cell Column number
         igRow = DBGrid1.RowContaining(Y)      'Set the Cell Row number
 
         vargBookmark = DBGrid1.RowBookmark(igRow) 'Set Bookmark Value
 
         'Show the contents of the cell in a textbox
         Text1.Text = DBGrid1.Columns(igColumn).CellValue(vargBookmark)

after you get the Text1.Text, set the CurrentCellVisible property of the DBGrid control.

let me know if this helps,
vmano
0

Featured Post

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now