Solved

How to kill empty columns!!

Posted on 1998-10-13
1
140 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
ID: 1439771
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

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

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…
I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
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…

776 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