• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 2872
  • Last Modified:

VB6 - edit data in a listview or grid control?

I have an Access data table I'd like to allow users to edit (a little). I have 2 text fields and 2 boolean fields (8 fields total in the table).

I'm retrieving the data first from Access, and storing it in a variant array. I'd like to just slap this array up in a datagrid or listview or something on a form for the user to edit, and when they click the "update" button, I'll store everything back in table.

As it's been a while since I've been in VB6, I'm wondering if I could get advice as to what control would be the best to use in this situation. I'm not looking for you to program the whole thing for me - just advise as to the appropriate control and methods?

thanks in advance.
Tom
0
thomasedooley
Asked:
thomasedooley
  • 3
  • 3
  • 2
1 Solution
 
hiteshgoldeneyeCommented:
Hi thomas,

     You can use the FlexGrid Control, Please refer the following links

http://www.thescarms.com/vbasic/editgrid.aspx

http://www.vb-helper.com/howto_edit_flexgrid_control.html
0
 
thomasedooleyAuthor Commented:
Thanks for your post... There's no native VB6 control that allows editiing? I have use a textbox over a grid cell? (just looking for the easiest, lazy man's solution...)
0
 
JMu5667Commented:
Hi

I would recommend Flex grid, and read the data from your database table. You can map each field in each row to the flex grid. This is just a simple loop of rs.rows, and rs.fields(x), if you get my drift..So really you want to end up with a type of excel spread sheet of your table.  you can then edit each cell if you wish with a text box overlay. The user can then hit a cmd btm anf you can write our the cells to the table, the reverse of putting them in the grid.

Hope this give you food for thought.

0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
thomasedooleyAuthor Commented:
Is there a way I can only expose a few of the fields to the user for editing? There are 8 fields in the table, but I only want them to be able to see and edit 4 of them...?
0
 
JMu5667Commented:
Hi Thomas

yes that is easy. you can refer to a field by it's index position in the table or its field name. So once you have your recordset, either ADO, DAO (it does not matter), you can do the following.

? rs.fields.count - this will print the number of fields in the recordset
? rs.fields(1).name - this will print the name of field 1
? rs.fields("user_name").value - this will print the value of the field called user_name.

Also in the sql statement you can do the following:

 SELECT user_name, user_password, account_name FROM users - this will return only 3 fields in the     table users
 SELECT * FROM users - this will return all the fields in the table users

I hope this can help you, if you need more help then please ask.
0
 
JMu5667Commented:
Also if your are using flexgrid to hide a col from the user set the column width to zero :)
0
 
thomasedooleyAuthor Commented:
I ended up using this solution, so you get the points. I'd rather have a native vb solution to just editing the grid (wouldn't we all?), but you can't have everything. Thanks for the timely answer and reference links to the solution.
0
 
hiteshgoldeneyeCommented:
Thanks for the grade thomas.
0

Featured Post

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

  • 3
  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now