Click here to Skip to main content
15,887,746 members
Please Sign up or sign in to vote.
1.00/5 (3 votes)
See more:
I have a MSFlexGrid control (have 5 cols and 3 rows) that it had data as follow:

A B C D E
1 2 3 4 5
5 4 3 2 1
0 9 8 7 6
Now I want to addcolumn F(don't have data) into before column C and after column B as follow:

A B F C D E
1 2 - 3 4 5
5 4 - 3 2 1
0 9 - 8 7 6
So how to add column F. If using datagrid i can add it
VB
Dim dc
   Set dc = DataGrid1.Columns.Add(2)
   dc.Caption = "New Field"
   dc.DataField = "New Field"


but with MSFlexGrid I can not.
can you help me some code,pls?
thanks
Posted
Comments
TweakBird 24-Dec-10 4:30am    
Cross post. already you asked same Question 5 Hrs back. If you want improve your question, just edit it & modify it.
JF2015 24-Dec-10 11:30am    
Please don't repost your question. You could easily modify the existing question by using the "Improve question" link.
thatraja 24-Dec-10 11:36am    
check my answer in your existing question
fjdiewornncalwe 24-Dec-10 12:10pm    
Dude. This is the 4th time you have asked this question. You will NOT get codez plz from us. thatraja provided you with a very appropriate answer the last time you asked this and I suggest you do some work from there.
Eddy Vluggen 25-Dec-10 15:39pm    
I voted 1: Don't spam the board with several wrong ways of asking a question. And drop that monster of a MSFlexGrid like Microsoft did, install the InterOp Forms Toolkit. That will allow you to mix .NET and VB6, enjoying the best of both worlds. Then you kick out all those FlexGrids and replace them with nice and enjoyable DataGridViews. It's supported by Microsoft;

http://msdn.microsoft.com/en-us/vbasic/bb419144

1 solution

Simply add

Grid.Columns = Grid.Columns +1

Set Value : Grid.set_TextMatrix(0, Grid.Columns, "New Field F")
 
Share this answer
 
Comments
Henry Minute 12-Feb-11 8:22am    
That will not insert a column, it will add it as the last column. If you must go back over very old questions in order to improve your rep points, at least have the decency to post correct answers.
[no name] 13-Feb-11 23:25pm    
Hello Dear,

I miss my answer to Complete. The Complete answer is Add the Column first then Change it's Index.

The Code for changing index is <pre> Gridname.set_ColPosition(2, 5) </pre>


Best Regard

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900