×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

VSFlexGrid

VSFlexGrid

VSFlexGrid

(OP)
Simple question...How do you add data to the cells?  I have tried .Value, .AddItem, etc. with no luck.  Thanks.

RE: VSFlexGrid

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

RE: VSFlexGrid

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

RE: VSFlexGrid

(OP)
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

RE: VSFlexGrid

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?

RE: VSFlexGrid

(OP)
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?

RE: VSFlexGrid

FlexiGrid...what is it?
Please enlighten a dimwit!


Mala Singh
'Dare to Imagine'

RE: VSFlexGrid

(OP)
FlexGrid looks like an excel spreadsheet so you can create a table or such.

RE: VSFlexGrid

(OP)
I have the 'light' version that does not allow data binding

RE: VSFlexGrid

The dimwit gives up...


Mala Singh
'Dare to Imagine'

RE: VSFlexGrid

(OP)
This is intersting....If I dont specify 'Option Explicit', then I the flexcpText works.  Odd

RE: VSFlexGrid

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'

RE: VSFlexGrid

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'

RE: VSFlexGrid

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

RE: VSFlexGrid

(OP)
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.

RE: VSFlexGrid

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!

RE: VSFlexGrid

(OP)
Thanks...Do you have a good online source for VSFlexGrid?  It seems to be hit or miss everytime I do a google search.

RE: VSFlexGrid

(OP)
FrancisL,

I cant seem to get the combobox to work.  I used the exact syntax as above and didnt get the combobox to appear.

RE: VSFlexGrid

(OP)
Spoke too soon, I got it.  Had to set it up so the cells were editable.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources