Solved

VB6 Datagrid - deleting and selecting rows

Posted on 2002-05-08
8
678 Views
Last Modified: 2008-01-16
I am using a datagrid in my VB6 application. I am looking for code to actually delete a row or make it invisible, I dont want to delete the record from the database . All I can find is the before and after delete functions.
I am also wondering is there a way to capture when just a row /record is selected , not a column. When I select a row I want to get the ID of the record.
This is driving me nuts so any help would be appreciated.
0
Comment
Question by:Lisad
[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
8 Comments
 

Expert Comment

by:HeN_da_MaN
ID: 6996212
I haven't got VB Environment here, some time ago I created an app with datagrids and ran into exactly the same problem.
the datagrid is only able to delete a row (record) visually (with mouseclick) NOT with code.
you must set the property Datagrid.AllowDelete=True .
Isn't there a property 'SelectedCel' or something, for the second part of your question.
Since I haven't got VB here I can't check myself.

Hen
0
 
LVL 43

Accepted Solution

by:
TimCottee earned 100 total points
ID: 6996222
The datagrid really isn't up to this. You can actually delete a record in code but this isn't the point. As I read it you really just want to hide this row from being displayed. Unfortunately the datagrid doesn't do this. If you were to use a flexgrid for example you can set individual row heights and can therefore set it to zero to prevent the row from being displayed. Unfortunately again you cannot use in-cell editing in a flexgrid (though you can simulate this quite effectively). Overall the best option is to look for a commercial grid such as the VS Flexgrid from http://www.componentone.com which has both the in-cell editing features of the datagrid and the flexibility of the flexgrid (the MS Flexgrid is actually a cut down version of this commercial one).
0
 
LVL 15

Expert Comment

by:ameba
ID: 6996432
Maybe add one field "RowIsVisible" to your table, or maybe to the recordset to which DataGrid is bound?

This comment is not intended as answer.
0
Independent Software Vendors: 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!

 

Expert Comment

by:GebhartBob
ID: 6998040
    We ran into this problem and a bunch more concerning datagrids. For example, we wanted a row to expand vertically a la Multiline for Textboxes. We wanted some columns to be check boxes, others to be Comboboxes with automatic translation of codes to text. We wanted to be able to configure just specific cells with these capabilities, rather than whole columns. We wanted ... well, we wanted a lot.
 
     After looking very hard, we finally settled on ComponentOne's VSFlexGrid, an exceptionally powerful and sophisticated grid. We have yet to run into a problem it won't handle.
 
     For your specific problem, there are two VSFlexGrid solutions:
 
     (1) You can hide a row by setting the RowHidden property true. If you have, say, 7 rows of grid "fgr", and you want to delete the 4th row, you'd write:
          fgr.RowHidden(4) = True
     That would move rows 5-7 up one row visually. Row 4 would still be in the grid, but visually it's removed; that is to say, if you processed the grid rows sequentially, you'd still process the hidden row 4 as the 4th row of the grid. The only effect is what the user sees.
 
     (2) You can actually delete the 4th row in the abov e example by issuing this command:
          fgr.RemoveItem(4)
     In this case, the grid row would be completely removed.
 
     In neither case is the underlying database changed in any way.
 
     VSFlexGrid costs about $300, but the whole ComponentOne suite of controls only costs about $400, so that's what we bought. We've been using it about six months now.
0
 
LVL 1

Expert Comment

by:Moondancer
ID: 7078686
Greetings.

This question has been locked with a Proposed Answer, and remains open today.

If the Proposed Answer did not serve your needs, please reject it and comment with an update.  If the Proposed Answer helped you, please accept it to grade and close this question.  If you need help splitting points between multiple experts, please comment here with details so we can help you.

EXPERTS ->  Please guide me here in terms of closing recommendations if the Asker does not respond in 4 days.

Thanks to all,
Moondancer - EE Moderator
0
 
LVL 1

Expert Comment

by:kodiakbear
ID: 7522867
Dear GebhartBob@devx
I've rejected your proposed answer as Experts Exchange holds an experiment to work without the answer button.

See: <http://www.experts-exchange.com/jsp/communityNews.jsp>
Paragraph: Site Update for Wednesday, November 06, 2002

By this rejection the Asker will be notified by mail and hopefully he will take his responsibility to finalize the question or post an additional comment.
The Asker sees a button beside every post which says "Accept This Comment As Answer" (including rejected answers) -- so if he/she thinks yours is the best, you'll be awarded the points and the grade.

EXPERTS: I will return in seven days to close this question.
Please leave your thoughts and recommendations here

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER !

Thanks !

kodiakbear
Experts Exchange Moderator
0
 
LVL 16

Expert Comment

by:twalgrave
ID: 7895782
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:
- answered by TimCottee
Please leave any comments here within the
next seven days.

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER !

twalgrave
Cleanup Volunteer
0
 

Expert Comment

by:SpideyMod
ID: 7941745
per recommendation

SpideyMod
Community Support Moderator @Experts Exchange
0

Featured Post

Salesforce Made Easy to Use

On-screen guidance at the moment of need enables you & your employees to focus on the core, you can now boost your adoption rates swiftly and simply with one easy tool.

Question has a verified solution.

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

Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
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…
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…

740 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