Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Adding new row in unbound TDB8

Posted on 2004-04-02
8
Medium Priority
?
642 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 600 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
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 

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: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

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

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
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…
Suggested Courses

877 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