Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium


FlexGrid Doesn't Exhibit a TextMatrix under .NET

Posted on 2003-03-10
Medium Priority
Last Modified: 2011-09-20
While trying to move to .NET, I have a situation where I want to populate a flexgrid (or Datagrid, if I *really* have to) out of a couple of hashtables ("TransCounts" and "FNames"), like so:

 Sub RefreshGrid()
        Dim iCount As Integer, FName As String, iTranCount As Integer
        Dim StrTransName As String, TransItem As DictionaryEntry

        iCount = 0
        Me.AxMSFlexGrid1.Cols = 3
        Me.AxMSFlexGrid1.FixedCols = 0
        Me.AxMSFlexGrid1.FixedRows() = 0
        Me.AxMSFlexGrid1.Rows = TransCounts.Count
        For Each TransItem In TransCounts
            iCount = iCount + 1
            StrTransName = CType(TransItem.Key, String)
            iTranCount = CType(TransItem.Value, Integer)
            FName = CType(FNames(StrTransName), String)
            AxMSFlexGrid1.Textmatrix(iCount, 1) = StrTransName
            AxMSFlexGrid1.Textmatrix(iCount, 2) = iTranCount
            AxMSFlexGrid1.Textmatrix(iCount, 3) = FName
    End Sub

And of course, VB.NET really doesn't like the TextMatrix bit of a Flexgrid, even though the Object Browser shows us:

Public Property TextMatrix(ByVal Row As Integer, ByVal Col As Integer) As String
    Member of MSFlexGridLib.MSFlexGrid

under Interop.MsFlexGrid

Is there an easy way to do this..? Why does Microsoft have to make everything harder than before??
Question by:nchantim
LVL 28

Accepted Solution

iboutchkine earned 540 total points
ID: 8104229
Try to use .Text property instead of TextMatrix

msfg.Row =1
msfg.Text = "Whatever"

Author Comment

ID: 8105910
It does work, and I hadn't even tried that before.
Why does Microsoft have to castrate ActiveX controls though.

Just a note: I ended up using a Datagrid bound to a datable that I dynamically build from the two hashtables...
Nice and simple ;)


Featured Post

Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

It seems a simple enough task, yet I see repeated questions asking how to do it: how to pass data between two forms. In this article, I will show you the different mechanisms available for you to do just that. This article is directed towards the .N…
The object model of .Net can be overwhelming at times – so overwhelming that quite trivial tasks often take hours of research. In this case, the task at hand was to populate the datagrid from SQL Server database in Visual Studio 2008 Windows applica…
Is your OST file inaccessible, Need to transfer OST file from one computer to another? Want to convert OST file to PST? If the answer to any of the above question is yes, then look no further. With the help of Stellar OST to PST Converter, you can e…
With just a little bit of  SQL and VBA, many doors open to cool things like synchronize a list box to display data relevant to other information on a form.  If you have never written code or looked at an SQL statement before, no problem! ...  give i…
Suggested Courses

580 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