Solved

Adding new row in unbound TDB8

Posted on 2004-04-02
8
638 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

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

PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
How does CurrentUser work? 10 43
Set email body to html using vbscript 6 92
Automatic Email Reminder 4 94
Visual Basic 6: Code needed for TripleDES Encryption/Decryption 14 92
Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
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…

732 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