Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Insert new column in data grid without builder????
Message
From
21/12/2002 09:25:14
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Miscellaneous
Thread ID:
00735012
Message ID:
00735121
Views:
12
>Is there a way to insert a new column between other columns in a data grid without utilizing the builder wizard?

-You could increase columncount and then set new column's columnorder
-Sometimes it's easier to do in code rather than using mouse and PEM sheet.
You could add a new column programmatically from command window specifying its column order. ie: To add a new column in 3rd position.

Select the grid
Go to command window
Enter commands :

aselobj(arrObj)
oGrd = arrObj[1] && Assign so you could use Intellisense
oGrd.addcolumn(3)

Column is added. You can set its properties in PEM sheet or could continue to do it programmatically. ie:

oNewCol = oGrd.columns(oGrd.ColumnCount)
oNewCol.header1.caption = "My New Column"
*...

Note that new added column's index (grid.columns(nIndex)) is new columncount, not 3. ColumnOrder is 3.
Doing it from command window or from a code window (using aselobj() to get ref.) what you're actually doing is you're using your primitive-interactive builder. If you'd do this often you could save your code, add parameters maybe and choose to register as a builder or not. Even if you don't register it you could call it as a plain prg that would still act as a builder for you (tip: doing that way you could change class of contained controls while you can't do that from PEM sheet). For a sample check Message #539128
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