Solved

VB6 Datagrid - deleting and selecting rows

Posted on 2002-05-08
8
670 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
8 Comments
 

Expert Comment

by:HeN_da_MaN
Comment Utility
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
Comment Utility
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
Comment Utility
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
 

Expert Comment

by:GebhartBob
Comment Utility
    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
Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

 
LVL 1

Expert Comment

by:Moondancer
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
per recommendation

SpideyMod
Community Support Moderator @Experts Exchange
0

Featured Post

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

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…
Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

728 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

9 Experts available now in Live!

Get 1:1 Help Now