Solved

How to kill empty columns!!

Posted on 1998-10-13
1
142 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Introduction I needed to skip over some file processing within a For...Next loop in some old production code and wished that VB (classic) had a statement that would drop down to the end of the current iteration, bypassing the statements that were c…
When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
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…

749 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