Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Hide grid column
Message
From
22/02/2005 19:22:49
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
 
To
22/02/2005 18:39:21
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Environment versions
Visual FoxPro:
VFP 7
OS:
Windows XP
Network:
Windows 2000 Server
Database:
MS SQL Server
Miscellaneous
Thread ID:
00989465
Message ID:
00989478
Views:
37
>I have a grid and got to a point that want to hide a column, but i don't know how. since the columns(1).Visible = .F., doesn't hide it.
>
>This is my problem, i have a grid withe some records, let's say 3, then i appended on record at the end to represent some aggregates. of the 3 records.
>
>can someone give me an idea.
>
>My first attempt:
>I had added code to the textboxes of the columns, and i was using columncount to hide the columns, but doing this erase my code from the textboxes.
>
>My second attempt:
>use column's visible property, but didn't hide the columns.

Remove the column. There is no hiding way with VFP grids if column stays there.
ie:
Public oform
oform = Createobject("myForm")
oform.Show

Define Class myForm As Form
    DataSession=2
    Add Object grdSample As Grid
    Procedure Load
        Create Cursor test (col1 i,col2 i,col3 i,col4 i,col5 i)
        Local ix
        For ix=1 To 10
            Insert Into test Values (100+m.ix,200+m.ix,300+m.ix,400+m.ix,500+m.ix)
        Endfor
        Locate
    Endproc
    Procedure Init
        * Add column - sum col1,col3,col5
        With This.grdSample
            .ColumnCount = .ColumnCount + 1
            With .Columns(.ColumnCount)
                .Header1.Caption = "Total"
                .ControlSource = "(test.col1+test.col3+test.col5)"
            Endwith
        EndWith
        * (Hide) remove cols 2 and 4 - do in reverse
        This.myHideColumn(4,This.grdSample)
        This.myHideColumn(2,This.grdSample)
    Endproc

    Procedure myHideColumn
        Lparameters nColIndex, toGrid
        For ix=nColIndex + 1 To toGrid.ColumnCount
            With toGrid.Columns(m.ix)
                .ColumnOrder = .ColumnOrder - 1
            Endwith
        Endfor
        toGrid.ColumnCount = toGrid.ColumnCount - 1
    Endproc
Enddefine
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