how to make a col invisible in msflexgrid control at run time

 i have taken a msflexgrid control and i assigned 9 cols to it at design time but at run time i want to make col 6 invisible. i tried but not got thru.
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

ZorxxConnect With a Mentor Commented:
What I always use is setting the width of the col to 0.. If you want to show the col then set its width back.
u cant make it that way.
U can do it the other way.
Make 3 cols only and when u need 9 make it 9

I will send my code

just copy and paste
'first procedure make it 3 cols if u want
Call InitializeGrid(fgridfee, 4, 10, "No", "Name", "Frequency", "Amount", "FromDate", "LastDate", "Fine", "FineAmount", "Month", "Total")

'make size o0f all the cells
Call SetCellSize(fgridfee, 350, 1800, 1100, 800, 1200, 1200, 500, 1000, 1000, 1000)

Public Sub InitializeGrid(grd As MSFlexGrid, nrows As Integer, ncols As Integer, ParamArray colnames() As Variant)
''To Initialize Flex Grid
Dim i As Integer
With grd
    .Rows = nrows
    .Cols = ncols
    .FixedCols = 0
    .Row = 0
    For i = 0 To UBound(colnames)
    .Col = i
    .Text = colnames(i)
    Next i
End With
End Sub
'this procedure has to be used after InitilizeGrid function
Public Sub SetCellSize(grd As MSFlexGrid, ParamArray size() As Variant)
Dim colcount As Integer
Dim i As Integer
colcount = grd.Cols
With grd
    For i = 0 To UBound(size)
    .Col = i
    .ColWidth(i) = CInt(size(i))
    Next i
End With

End Sub
a)Thatz is just a sample
for ur requirement

Call InitializeGrid(fgridfee, 4, 3, "No", "Name","age" )

'make size 0f all the cells
Call SetCellSize(fgridfee, 350, 1800,1000)

'if u want to change the number of columns then

2)use grid's clear function to clear it.
3)reinitialize by calling the same method
'make 9 cols selecting the 3rd parameter to 9
'call setcellsize for those 9  cols

Call InitializeGrid(fgridfee, 4, 9, "No", "Name", "age", "Amount", "FromDate", "LastDate", "Fine",
"FineAmount", "Month")

'make size o0f all the cells
Call SetCellSize(fgridfee, 350, 1800, 1100, 800, 1200, 1200, 500, 1000)

'this should solve ur problem
The new generation of project management tools

With’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

Simply set colWidth to 1

Hi Zorxx
U R right as I said !!!!
Sorry Bahnas, I didn't read your answer
The Asker

Questions Asked 7
Last 10 Grades Given  
Question Grading Record 0 Answers Graded / 0 Answers Received
Questions Answered 2
Last 10 Grades Received A A  

Zorxx  Do not be so sorry  the asker will decide about points soon !!!!!!  nice 2 meet U

1 09/18/01 50 how to fix a position of a control like textbox in... UnlockedQ
2 09/17/01 50 how to make a col invisible in msflexgrid control ... LockedQ
3 09/08/01 50 how to edit a cell in msflexgrid control UnlockedQ
4 09/06/01 50 How to edit a unbound column in a datagrid control UnlockedQ
Active Server Pages (ASP)
# Date Pts Title Type
5 05/30/01 50 To fill one dropdownlist on selection of another d... UnlockedQ
# Date Pts Title Type
6 07/30/01 20 how to connect mssql server using php UnlockedQ
# Date Pts Title Type
7 08/01/01 80 How to use web service  UnlockedQ

If this proposed answer has helped you, please accept it, grade it and close this question.  If it did not, reject it and add comments as to your progress and what else is needed.  If no action is taken here by next week, we'll need to decide this outcome.  Expert input always welcome as well.

Community Support Moderator @ Experts Exchange
Finalized today be EE Moderator.
All Courses

From novice to tech pro — start learning today.