CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 6 of 6

Thread: MS Flex Grid

Threaded View

  1. #4
    Join Date
    Feb 2008
    Location
    Bangalore
    Posts
    149

    Re: MS Flex Grid

    Quote Originally Posted by RussKass View Post
    hey, i am using the following code to save values from a flex grid to access db

    tblHrData("UniOrEq") = MSFlexGrid1.TextMatrix(currow1, 1)
    tblHrData("Degs") = MSFlexGrid1.TextMatrix(currow1, 2)
    tblHrData("Dips") = MSFlexGrid1.TextMatrix(currow1, 3)

    but this code only saves one row if i modify it to the code below it saves the headers instead, in option explicit i have declared currow1 & 2 as variants
    Code:
        Dim confirm, n, dbrow As Integer
        dbrow = MSFlexGrid1.RowSel
        k = "abc"
        currow1 = MSFlexGrid1.RowSel '<----- here you are assiging value to currow1
    
        tblHrData("UniOrEq2") = MSFlexGrid1.TextMatrix(currow2, 1) '<-- here you are using Currow2  for which value is not assigned
        tblHrData("Degs2") = MSFlexGrid1.TextMatrix(currow2, 2)'<-- here you are using Currow2 for which value is not assigned
        tblHrData("Dips2") = MSFlexGrid1.TextMatrix(currow2, 3)'<-- here you are using Currow2 for which value is not assigned
    
        k = MSFlexGrid1.TextMatrix(currow1, 0)
        For n = 0 To 6
            MSFlexGrid1.TextMatrix(currow1, n) = ""
            MSFlexGrid1.TextMatrix(currow2, n) = ""
    
        Next n
    I can see you are assigning value to Currow1 Not to Currow2, but you are using currow2 to access the value from MSFlexGrid1.

    My guess is that, you have declared Currow2 variant variable but not initialised/assigned any value,
    so it is taking value 0. So 0th row is nothing but column header!!
    Last edited by ComITSolutions; February 27th, 2010 at 01:38 AM.
    Encourage the efforts of fellow members by rating

    Lets not Spoon Feed and create pool of lazy programmers

    - ComIT Solutions

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured