Solved

Adding new row in unbound TDB8

Posted on 2004-04-02
8
636 Views
Last Modified: 2007-12-19
Hi experts,

I am using TDBGrid 8.0 and VB6.
My grid is unbound, using an XArrayDB.

I want my grid to show ONE row (add new) when it (the grid) is first opened IF the array is empty.

In the OnInit, RowColChange events, I tried to use the AllowAddNew or the Redim 0,0,0,0 or ReDim 0,1,0,0 but it did not work.

How can I do it ?

Thanks

gallia
0
Comment
Question by:Gallia
  • 4
  • 4
8 Comments
 
LVL 39

Accepted Solution

by:
appari earned 150 total points
ID: 10745222
you first set allowaddnew property of the grid to true.
redim the xarray as follows

xarray.redim 0,-1,0,noofcolumns
or
xarray.redim 0,noofcolumns,0,-1

i am not sure whether the columns are first or rows. test, now i am posting this from my home pc i dont have vb here.
0
 

Author Comment

by:Gallia
ID: 10765742
Hi again,

I tried what you suggested, but it did not work.

I have partially found the solution. The grid showed 2 rows because I was "adding" twice the record. (1- in the xarraydb and 2-in the grid).

BUT, The row still gets added on top, not in the new row. Is it inherent to the grid or is there a way to keep the new record on the new added row ?

Thanks
gallia
0
 
LVL 39

Expert Comment

by:appari
ID: 10765995
>>The row still gets added on top, not in the new row
i am confused. its working on my m/c.
when we enter new record in the new row (with a * mark) and update, the new row is added to xarray. this is normal behaviour of the grid.
0
Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 

Author Comment

by:Gallia
ID: 10766234
Hi,

Are you saying that after an update, it is normal that the new row (* at the bottom) gets added on top of all rows ?

example
before update
row0
row1
row*

after update
row*
row0
row1

Is that normal behavior for the grid ?
Thanks
gallia
0
 
LVL 39

Expert Comment

by:appari
ID: 10766327
is it is adding new on top?
this is not normal. can you take the screen shot and put it somewhere on the web just i am curious to see it.
0
 
LVL 39

Expert Comment

by:appari
ID: 10766338

did you check on the componentone site for any patches?
0
 

Author Comment

by:Gallia
ID: 10766536
I haven't check the ComponentOne site. I will, but i have the feeling the problem is due to something in the code.

Sorry, I have no place on the web where to put the screenshot.

gallia
0
 

Author Comment

by:Gallia
ID: 10789379
Hi,

I was told by a collegue that this behavior is normal, due to the sort on the recordset.

Thanks a lot  for the help
Gallia

NB: accepted answer xarray.redim 0,-1,0,noofcolumns
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

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.
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…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

856 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