I use VB 6, maybe that's the source of our misunderstandings. I'm afraid my solution won't work in VB 5.
Printable View
I use VB 6, maybe that's the source of our misunderstandings. I'm afraid my solution won't work in VB 5.
I use also VB6 SP3 on Win98.
Where is the difference?
Please copy paste the code to a new project and test it again (last line has definetely a problem)
I am new in Vb but not beginner (1 year experience). I can understand if a line of code is wrong or if it doesn't work because of my system. Thanx and sorry for being continued...!
;-)
Michael Vlastos
Automation Engineer
Company Modus SA
Development Department
Athens, Greece
OK, here we go again:
the code
Dim r as ADOR.Recordset
set r = new ADOR.Recordset
r.Fields.Append "firstfield", adInteger
r.Fields.Append "secondfield", adInteger
r.CursorType = adOpenDynamic
r.Open
r.AddNew
r.Fields(0).Value = 1
r.Fields(1).Value = 2
r.AddNew
r.Fields(0).Value = 3
r.Fields(1).Value = 4
set g.DataSource = r
the component: "Microsoft Datagrid Control 6.0 (SP3) (OLEDB)" (named "g")
references: "Microsoft ActiveX Data Objects Recordset 2.1 Library"
(the sample still works)
based on
- NT 4 SP 5
- VB 6 SP 3
This is the best and simplest code ever seen!!!
Congratulations Lothar!!!
Michael Vlastos
Automation Engineer
Company Modus SA
Development Department
Athens, Greece
Thanks. IMHO this feature (Recordsets without a database connection) is widely ignored by the VB developer community, although it's the best thing in VB 6 that I have found so far.
Hi,
If you are still interested in DBGrid 5.0 (unbound mode) I can mail you a sample.
Code is long & not elegant, but it is easy to modify it - and it doesn't require ADO (mdac_type is over 6 MB)
It's incredable! It's Awsome! I wish I thought of it!!!
Brewguru99
Ok, just post it here or send it via email to me...
Thanx!
Michael Vlastos
Automation Engineer
Company Modus SA
Development Department
Athens, Greece
Well, what comes next Lothar:
I created the table as you said...
One idea: Could it be good to create a control array of text boxes equal with the number of columns of grid. So when the user wants to enter data to the grid to have only to enter the data on the text boxes and display on the grid. If the user wants to edit old data, with double click the whole row will be displayed on text boxes.
Of course there will be two buttons, ok and cancel.
Is it better or not? And I ask this because I want to have complete control on the values entered...!
Michael Vlastos
Automation Engineer
Company Modus SA
Development Department
Athens, Greece
TO restart the whole issue: How about one of these Flex-Grids!:-)
RK
my experience with the various grids is limited.
Thus, I'd say your approach sounds reasonable.
You might be able to get complete control over the editing process within the grid. But, that could be difficult. it's probably easier to use textboxes.
Here we go again: Ravi has suggested that you use a flexgrid. Well, if you do not allow editing within the DBGrid you might as well use a flexgrid.
My dear friend, thanx to all of you here, I have many ideas in my mind...
I will choose the final with these criteria:
1. Not too many resources (memory)
2. I want complete control of all the values entered because I'm going to create an expert system (knowledge based) in order to program a robot!
Any ideas?
Tell me about ms flex grid...
thanx!
Michael Vlastos
Automation Engineer
Company Modus SA
Development Department
Athens, Greece
...and tell me your opinion about control boundaries!
Michael Vlastos
Automation Engineer
Company Modus SA
Development Department
Athens, Greece
I had done this thing with MS-Flex Grid. (VB 5.0)
It displays the values in a Grid. User can edit the values "in-line" by double clicking any cell. Since Flex-grid doesn't allow automatic editing, unlike DBGrid, you need to do some decent amnt of programing to capture all modes of exit from "Editing" mode, like scrolling etc.
The it will also allow editing of a row data, in another set of Text boxes below. So when the user dbl clicks on the Row-x, Col-0, the values will be updated into those text boes, and the focus moves there and he can only escape from that mode by save/cancel stuff. Same set of routines work for data-validation either in-line or off-line editing. Well that's broadly the project:-)
-- I guess, MsFlexGrid will take more memory than DBGrid. It supports lot more stuff, like colors, pictures etc. So even if you dont use them, it may still be more memory hungry than DB grid.
RK
Well, guys, we have 3 grids:
1. My solution with DBGrid in unbound mode.
2. Lothar's solution with DataGrid and ADOR
3. Ravi's solution with MSFlexgrid.
Which is the suitable for what I want?
I repeat my scopes:
1. Not to eat enough resources (memory)
2. Large size (500 rows - 13 columns)
3. Complete control of values entered
4. Easy interface
5. Many, many rules -> knowledge based system
Thanx all!
Michael Vlastos
Automation Engineer
Company Modus SA
Development Department
Athens, Greece