Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations cowski on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

VSFlexGrid 1

Status
Not open for further replies.

Creigbm

Mechanical
Aug 1, 2003
161
Simple question...How do you add data to the cells? I have tried .Value, .AddItem, etc. with no luck. Thanks.
 
Replies continue below

Recommended for you

Try something like:

Single cells-
Range("A1").Value=3
Range("B3").Value="ABC"

Horizontal range-
Range("A1:J1").Value=Array(1,2,3,4,5,6,7,8,9,10)

Vertical range -
Range("A1:A10").Value=Worksheetfunction.transpose(Array(1,2,3,4,5,6,7,8,9,10))


'Dare to Imagine'
Mala Singh
 
Try
VSFlexGrid.Cell(flexcpText, VSF.Row, 4) = YourValue
That sets column 4 in the current row to YourValue
Of course VSFlexGrid has to be editable (it's a property of the grid), you can set that in design mode or on the EnterCell event for example
Francis
 
Francis,

I tried that but got an error saying that it cant find the project or library. I checked to make sure the VSFlexGrid reference was loaded and it was. Any ideas?

Thanks,
Brian
 
I don't use VSFlexGrid in VBA, only in VB so I can't help (no time to try it)
Do you have an example you can load to see if that works?
 
No, I dont. I got the same error with another set of references but just had to load them. It is getting hung up on 'flexcpText'. Do you have a source that I can load into my project that defines all of those variables?
 
FlexiGrid...what is it?
Please enlighten a dimwit!



Mala Singh
'Dare to Imagine'
 
FlexGrid looks like an excel spreadsheet so you can create a table or such.
 
I have the 'light' version that does not allow data binding
 
The dimwit gives up...



Mala Singh
'Dare to Imagine'
 
This is intersting....If I dont specify 'Option Explicit', then I the flexcpText works. Odd
 
I just downloaded a trial version to look at this.

Francist has already pointed out the solution - I am just elaborating on it with another example for others who may be interested.

You need to use the Cell property of the control to put values in the cells.

The syntax is:
[form!]vsFlexGrid.Cell(Setting As CellPropertySettings, [R1 As Long], [C1 As Long], [R2 As Long], [C2 As Long]) [ = Value ]

I suggest you look at the Help for details...

Example: The following code will fill the first 5 rows × 4 columns block of cells with numbers from 1 through 20.

Code:
Private Sub VSFlexGrid1_Click()
  With Me.VSFlexGrid1
    For i = 1 To 5
      For j = 1 To 4
        .Row = i
        .Col = j
        .Cell(flexcpText, i, j) = (i - 1) * 4 + j
      Next j
    Next i
  End With
End Sub


Mala Singh
'Dare to Imagine'
 
I do not get any error on specifying Option Explicit - the code works just fine. Maybe it has something to do with the order in which you added the reference and wrote the code.


Mala Singh
'Dare to Imagine'
 
Craigbm,

the simplest way to add values to the a vsflexgrid is to use the method

vsFlexGrid.TextMatrix(Row As Long, Col As Long)[ = value As String ]

where Row and Col are indexes for table's row and colums.

HTH

_LF
 
Thanks for all your help...I have seem to get it working properly. One last question...how do you create a combobox? I have tried different ways and it does not seem to follow the way a normal combobox is created. Thanks again.
 
To create a drop down that appears in column x and returns an index number
VSFlexGrid1.ColComboList(x) = "#0;Auto|#1;Direct|#2;Bezier|#3;Manual|#4;Connector"

To create one specific to a cell catch the EnterCell event and add
VSFlexGrid1.ComboList= "=|>|<|<>|>=|<="
This just lists operators and returns the selected one.
There are lots more options!
 
Thanks...Do you have a good online source for VSFlexGrid? It seems to be hit or miss everytime I do a google search.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor