Problem with MSFlexGrid in Visual Basic

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • godhulirbalaka
    New Member
    • Oct 2007
    • 26

    Problem with MSFlexGrid in Visual Basic

    Dear all, I have a problem with MSFlexGrid.
    I have few field and one MSFlexGrid
    So i want if i doubleclick any row then the datas of that row distribute to those field
    I already wrote the command

    Private Sub MFG_Item_dbclic k()
    with mfg_item
    .Row=.rowsel
    txt_Name.text=m fg_Item.textmat rix(row, 1)
    txt_Id.text=mfg _Item.textmatri x(row, 2)
    txt_quantity.te xt=mfg_Item.tex tmatrix(row, 3)
    end with
    End sub
    but the problem is there is an error message that subscript out of range
    then it highlight txt_quantity.te xt=mfg_Item.tex tmatrix(row, 3)

    design mode i declare 2 fix column and run mode as per field
    so how can i skip this message
  • debasisdas
    Recognized Expert Expert
    • Dec 2006
    • 8119

    #2
    What about using 0 based index.

    Comment

    • godhulirbalaka
      New Member
      • Oct 2007
      • 26

      #3
      Originally posted by debasisdas
      What about using 0 based index.

      Hi please clear me more. I dont use any index

      Comment

      • QVeen72
        Recognized Expert Top Contributor
        • Oct 2006
        • 1445

        #4
        Hi,

        Change your code to :

        [code=vb]
        Private Sub MFG_Item_dbclic k()
        With mfg_item
        txt_Name.text=m fg_Item.textmat rix(.Row, 1)
        txt_Id.text=mfg _Item.textmatri x(.Row, 2)
        txt_quantity.te xt=mfg_Item.tex tmatrix(.Row, 3)
        End With
        End Sub
        [/code]

        REgards
        Veena

        Comment

        • godhulirbalaka
          New Member
          • Oct 2007
          • 26

          #5
          Originally posted by QVeen72
          Hi,

          Change your code to :

          [code=vb]
          Private Sub MFG_Item_dbclic k()
          With mfg_item
          txt_Name.text=m fg_Item.textmat rix(.Row, 1)
          txt_Id.text=mfg _Item.textmatri x(.Row, 2)
          txt_quantity.te xt=mfg_Item.tex tmatrix(.Row, 3)
          End With
          End Sub
          [/code]

          REgards
          Veena






          Hi Veena,
          Sorry there was a mistake.

          the code was

          Row=.rowsel ' there was no dot before Row

          so i think there modified could should not be

          txt_Name.text=m fg_Item.textmat rix(.Row, 1)

          Comment

          • godhulirbalaka
            New Member
            • Oct 2007
            • 26

            #6
            Hi Veena,
            Sorry there was a mistake.

            the code was

            Row=.rowsel ' there was no dot before Row

            so i think there modified could should not be

            txt_Name.text=m fg_Item.textmat rix(.Row, 1)

            Comment

            • QVeen72
              Recognized Expert Top Contributor
              • Oct 2006
              • 1445

              #7
              Hi,

              Dont use "Row" as Variable name, it is FlexGrid's Property name.
              You need not use rowsel, Grd.Row will give you Selected Row.

              Regards
              Veena

              Comment

              • CyberSoftHari
                Recognized Expert Contributor
                • Sep 2007
                • 488

                #8
                Originally posted by godhulirbalaka
                Dear all, I have a problem with MSFlexGrid.
                I have few field and one MSFlexGrid..... ..............
                What is the use of with statement? You have to use it properly.
                [CODE=vb]
                with mfg_item
                .Row=.rowsel
                txt_Name.text = .textmatrix(.Ro w, 1)
                txt_Id.text = .textmatrix(.Ro w, 2)
                txt_quantity.te xt = .textmatrix(.Ro w, 3)
                end with
                [/CODE]

                That is not Datas it’s Data.

                Comment

                Working...