Solved

MSFlexGrid: Want To Load arrays and variables

Posted on 2000-03-31
5
341 Views
Last Modified: 2012-05-04
I'm real new to VB and I'm working on an application where I have a 2 Column MSFlexGrid.  What I would like to do is load the 2nd Col with an array or a variable from a procedure.  I can "hard load" data in the grid but don't understand why I can't bring in data from variables.  The example Grid below is only 3 lines deep but in my procedure I need to display 101 lines.  I like the way MSFlexGrid displays the data but am not sure this is the way to go.  I've been stumped on this for a while and as I said earlier I'm just starting in VB.

Dim intLoadAddr00 as Integer
Dim intLoadAddr01 as Integer

Private Sub Form_Load()

    ' initialize grid
    With AddrGrid
        .Cols = 2
        .Rows = 3
        .ColWidth(0) = 500
        .ColWidth(1) = 1000
        .TextMatrix(0, 0) = "Addr"
        .TextMatrix(1, 0) = "0"
        .TextMatrix(2, 0) = "1"
 
        .TextMatrix(0, 1) = "CODE"
        .TextMatrix(1, 1) = intLoadAddr00
        .TextMatrix(2, 1) = intLoadAddr01

    End With
 
End Sub
0
Comment
Question by:mikepennst
5 Comments
 
LVL 10

Expert Comment

by:caraf_g
ID: 2673041
In the MSFlexGrid you can set the .Row and the .Col properties and then simply set the .Text property to change the contents of the cell in question.
0
 
LVL 10

Expert Comment

by:caraf_g
ID: 2673048
Check out this handy Flex Grid example ;-)

http://homepage.eircom.net/~carafa/VBSamples/VB5/MSFLEXGRID.zip
0
 
LVL 6

Accepted Solution

by:
VBGuru earned 100 total points
ID: 2673072
To add new row just say
MSFlexGrid.rows= MSFlexGrid.rows +1
To add new column to grid say
MSFlexGrid.cols = MSFlexGrid.cols + 1

to refer to a cell just say
which column that cell belongsusing the property
MSFlexGrid.Col=1(1st column)
and the row by MSFlexGrid.Row = 1(1st row)
then manuplate the content MSFlexGrid.Text = "New Content"

Thats it very simple
0
 
LVL 6

Expert Comment

by:Marine
ID: 2673203
When using .TextMatrix property you can interprit it as an 2 dimentional array, Cols,Rows. Having that you can bring your procedure and populate it.
0
 
LVL 14

Expert Comment

by:wsh2
ID: 2673230
To load you Flexgrid.. try this (assuming you have VB6).. With your MSFlexgrid empty, then use the Additems method to populate your rows. In the array statement you can use variables or constants, whicever you require.

Dim varTable as variant
varTable = Array(strColumn1_Data, strColumn2_Data, intColumn3_Data, "etc")
MSFlexGrid1.AddItem Join(varTable, vbTab) ' Row 0 Space
0

Featured Post

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…

708 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now