OK I am right but how is the right code?
Please can you post me the right code, because I am very curious to explore your way...
It seems very simple to be true!!!
:-)
Michael Vlastos
Automation Engineer
Company Modus SA
Development Department
Athens, Greece
Re: OK I am right but how is the right code?
Set YourGridNameGoesHere.DataSource = r
should do it.
Re: Still doesn't work...
Looks like we are using different grids?!
I have already thrown away my sample project. Try using one of the grids that supports ADO data binding.
Re: Still doesn't work...
I use VB 6, maybe that's the source of our misunderstandings. I'm afraid my solution won't work in VB 5.
No it's not! Please check the last line again....
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
Re: No it's not! Please check the last line again....
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
Absolutely Reccomended: All must see the above code...
This is the best and simplest code ever seen!!!
Congratulations Lothar!!!
Michael Vlastos
Automation Engineer
Company Modus SA
Development Department
Athens, Greece
Re: Absolutely Reccomended: All must see the above code...
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.
Waiting for your solution...
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, going to the top if we count the messages here...!
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
Re: Well, going to the top if we count the messages here...!
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.
Check my message to Ravi, Lothar!
...and tell me your opinion about control boundaries!
Michael Vlastos
Automation Engineer
Company Modus SA
Development Department
Athens, Greece
Re: Grid or Text Boxes ?: Flex-Grid
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
I can easily say I am confused!
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
Re: I can easily say I am confused!
That's easy: my solution is the best! :-)
just kidding.
1. resources: if you had NT you could use the task manager to find the true resource usage without guessing.
I doubt, though, that resources should be a real concern.
2. that's not really a "large" size. all 3 approaches can handle that easily
3. use the text box approach and be totally independent of the smartness of the underlying grid
4. see 3
5. that's not a problem of the grids.