Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Deleting Columns from grid
Message
From
29/09/1999 09:30:20
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Miscellaneous
Thread ID:
00270440
Message ID:
00270461
Views:
23
>I have a grid on a form that has a handful of columns. Through code, I then add additional columns as follows ...
>
>- Create a temporary cursor for this column
>- set the relationship to the grid's control source
>- Use AddColumn() to add a column with a control source that references the temporary cursor
>- Refresh the Grid
>
>This all functions wonderfully. The problem is when I want to delete one of the columns connected to a temporary cursor. What I have tried is ...
>
>- Use DeleteColumn() to remove the column
>- Close the temporary cursor
>- Refresh the grid
>
>What happens is that all the columns from the grid disappear as if they are connected to invalid control sources. If I comment out the line of code that closes the temporary cursor, everything works fine. The one column I want to delete disappears and the rest remain. But now I have an extra cursor hanging around that I don't need.
>
>I can't figure out why closing the temporary cursor would break the rest of the grid. The only column in the grid that references the temporary cursor is the one I just deleted with DeleteColumn().


Cathy,
You could do it like this safely :
with myGrid
 .DeleteColumn(lnIndex1) && Delete column(s)
 .DeleteColumn(lnIndex2)
 .DeleteColumn(lnIndex3)
 lcRecordSource = .recordsource
 .recordsource = ""
 Use in "myCursor"
 .recordsource = lcRecordSource
endwith
Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform