Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. working with grid

working with grid

Scheduled Pinned Locked Moved C / C++ / MFC
questioncsscomannouncement
8 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • C Offline
    C Offline
    catngo
    wrote on last edited by
    #1

    i'm making a program to read data from file and display it. i tried to insert the activeX control "microsoft datagrid control 6.0" to display data. but how do i access each cell of grid to assign member variable to update data onto the grid? or what address of each cell?

    C 1 Reply Last reply
    0
    • C catngo

      i'm making a program to read data from file and display it. i tried to insert the activeX control "microsoft datagrid control 6.0" to display data. but how do i access each cell of grid to assign member variable to update data onto the grid? or what address of each cell?

      C Offline
      C Offline
      Cedric Moonen
      wrote on last edited by
      #2

      catngo wrote: i tried to insert the activeX control "microsoft datagrid control 6.0" You mean the Microsoft FlexGrid Control? If yes, you can set text into a cell using the SetTextArray(long index, LPCTSTR lpszNewValue) funtion. Cell index start from 0 and it goes from left to rigt (and then to the next line). Hope this helps.

      C 2 Replies Last reply
      0
      • C Cedric Moonen

        catngo wrote: i tried to insert the activeX control "microsoft datagrid control 6.0" You mean the Microsoft FlexGrid Control? If yes, you can set text into a cell using the SetTextArray(long index, LPCTSTR lpszNewValue) funtion. Cell index start from 0 and it goes from left to rigt (and then to the next line). Hope this helps.

        C Offline
        C Offline
        catngo
        wrote on last edited by
        #3

        no, it said Microsoft Datagrid Control 6.0 . but i also see Flexgrid in the chooses. any grid will work, i'll try insert the flexgrid and see how it work. thank you.

        1 Reply Last reply
        0
        • C Cedric Moonen

          catngo wrote: i tried to insert the activeX control "microsoft datagrid control 6.0" You mean the Microsoft FlexGrid Control? If yes, you can set text into a cell using the SetTextArray(long index, LPCTSTR lpszNewValue) funtion. Cell index start from 0 and it goes from left to rigt (and then to the next line). Hope this helps.

          C Offline
          C Offline
          catngo
          wrote on last edited by
          #4

          sorry, i'm a noob here. can you be more detail on this? okay, let say i want "mom" in cell B2. how the code goes?

          C C 2 Replies Last reply
          0
          • C catngo

            sorry, i'm a noob here. can you be more detail on this? okay, let say i want "mom" in cell B2. how the code goes?

            C Offline
            C Offline
            Cedric Moonen
            wrote on last edited by
            #5

            Ok. In quick, here is a picture of the indexes of the cells (for a 3X3 grid):

                Col A       Col B        Col C
            

            Row0 0 1 2
            Row1 3 4 5
            Row2 6 7 8

            So, if you want to put "mom" in cell B2, you'll have to write: m_Grid.SetTextArray(6,"mom"); 6 is given by: RowIndex * Number of column + ColIndex (In your case: RowIndex=2, ColIndex=0)

            1 Reply Last reply
            0
            • C catngo

              sorry, i'm a noob here. can you be more detail on this? okay, let say i want "mom" in cell B2. how the code goes?

              C Offline
              C Offline
              catngo
              wrote on last edited by
              #6

              Okay, this what i use: CMSFlexGrid FlexGrid; FlexGrid.SetTextArray(2,"mom"); got an "assertion failed" error.

              C 1 Reply Last reply
              0
              • C catngo

                Okay, this what i use: CMSFlexGrid FlexGrid; FlexGrid.SetTextArray(2,"mom"); got an "assertion failed" error.

                C Offline
                C Offline
                catngo
                wrote on last edited by
                #7

                got it, thank you much. i was trying to access the class function instead of variable member control. that how i got the error msg, it work now.

                C 1 Reply Last reply
                0
                • C catngo

                  got it, thank you much. i was trying to access the class function instead of variable member control. that how i got the error msg, it work now.

                  C Offline
                  C Offline
                  catngo
                  wrote on last edited by
                  #8

                  One last question, is there anyway to print the grid with data out just like excel?

                  1 Reply Last reply
                  0
                  Reply
                  • Reply as topic
                  Log in to reply
                  • Oldest to Newest
                  • Newest to Oldest
                  • Most Votes


                  • Login

                  • Don't have an account? Register

                  • Login or register to search.
                  • First post
                    Last post
                  0
                  • Categories
                  • Recent
                  • Tags
                  • Popular
                  • World
                  • Users
                  • Groups