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. Visual Basic
  4. Read selected Excel data into DataGridView using VB.NET2008

Read selected Excel data into DataGridView using VB.NET2008

Scheduled Pinned Locked Moved Visual Basic
helpcsharpquestion
21 Posts 4 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.
  • H helelark123

    At which line of code it gave you the error?

    Shay Noy

    modified on Sunday, July 12, 2009 6:55 AM

    D Offline
    D Offline
    drexler_kk
    wrote on last edited by
    #10

    Well..The Error appeared at this line>> MyCommand.Fill(DtSet) What might be the problem? Thanks ~!

    H 1 Reply Last reply
    0
    • D drexler_kk

      Well..The Error appeared at this line>> MyCommand.Fill(DtSet) What might be the problem? Thanks ~!

      H Offline
      H Offline
      helelark123
      wrote on last edited by
      #11

      I made a simulation by changing the name of the Qty column in my excel file and I got the same error message as you got. The problem is that you do not have a Qty column in your excel file. You have to change the "Select Qty" in the query to "Select YourNameField"

      Shay Noy

      D 1 Reply Last reply
      0
      • H helelark123

        I made a simulation by changing the name of the Qty column in my excel file and I got the same error message as you got. The problem is that you do not have a Qty column in your excel file. You have to change the "Select Qty" in the query to "Select YourNameField"

        Shay Noy

        D Offline
        D Offline
        drexler_kk
        wrote on last edited by
        #12

        I do have a Qty column located at A3 cell here at Sheet1 actually. But I don't know why can cause this problem. My data is start at A4 column,I cannot put my Qty column to A1 because there is other data in A1 field in my Excel. Do you have any idea how should solve this problem? Thanks Regards Drex

        H 1 Reply Last reply
        0
        • D drexler_kk

          I do have a Qty column located at A3 cell here at Sheet1 actually. But I don't know why can cause this problem. My data is start at A4 column,I cannot put my Qty column to A1 because there is other data in A1 field in my Excel. Do you have any idea how should solve this problem? Thanks Regards Drex

          H Offline
          H Offline
          helelark123
          wrote on last edited by
          #13

          Have you got data in A1, A2 lines? If yes you must leave those lines blank. Try it and reply

          Shay Noy

          D 1 Reply Last reply
          0
          • H helelark123

            Have you got data in A1, A2 lines? If yes you must leave those lines blank. Try it and reply

            Shay Noy

            D Offline
            D Offline
            drexler_kk
            wrote on last edited by
            #14

            No,it was blank field for A1 and A2 field here actually. My table start with A3 actually. Do you have any other way beside this? Is that Interop can help to solve this problem? Do you have sample for using interops? Thanks~! Regards Drex

            H 1 Reply Last reply
            0
            • D drexler_kk

              No,it was blank field for A1 and A2 field here actually. My table start with A3 actually. Do you have any other way beside this? Is that Interop can help to solve this problem? Do you have sample for using interops? Thanks~! Regards Drex

              H Offline
              H Offline
              helelark123
              wrote on last edited by
              #15

              I have another way, if you want, by linking the excel table to MS Access and then using access table to continue you project. But, let's try to understand what you problem is. If you want send me your excel file by email (helelark@gmail.com) and the button1 code too, I will check and re-send it to you. Just tell me if you send it too me by email so I will check my email

              Shay Noy

              D 1 Reply Last reply
              0
              • H helelark123

                I have another way, if you want, by linking the excel table to MS Access and then using access table to continue you project. But, let's try to understand what you problem is. If you want send me your excel file by email (helelark@gmail.com) and the button1 code too, I will check and re-send it to you. Just tell me if you send it too me by email so I will check my email

                Shay Noy

                D Offline
                D Offline
                drexler_kk
                wrote on last edited by
                #16

                I just email you my Excel file. Hope you can check it for me. Thank you~! Regards Drex

                H 1 Reply Last reply
                0
                • D drexler_kk

                  I just email you my Excel file. Hope you can check it for me. Thank you~! Regards Drex

                  H Offline
                  H Offline
                  helelark123
                  wrote on last edited by
                  #17

                  Just remove the 2 first rows, A1 and A2 and it will works fine

                  Shay Noy

                  D 1 Reply Last reply
                  0
                  • H helelark123

                    Just remove the 2 first rows, A1 and A2 and it will works fine

                    Shay Noy

                    D Offline
                    D Offline
                    drexler_kk
                    wrote on last edited by
                    #18

                    Yes,but the problem is I must get it work with A4 as the row header. Because I need to grab the data from the OrderingFormat.xls file I have send to you. If I start with A1 as the row header,it won't works in my project. Do you have any other ideas? Thank you. Regards Drex

                    H 1 Reply Last reply
                    0
                    • D drexler_kk

                      Yes,but the problem is I must get it work with A4 as the row header. Because I need to grab the data from the OrderingFormat.xls file I have send to you. If I start with A1 as the row header,it won't works in my project. Do you have any other ideas? Thank you. Regards Drex

                      H Offline
                      H Offline
                      helelark123
                      wrote on last edited by
                      #19

                      Sorry, I saw the second file you sent me only after sending you this reply. I have checked in google and the solution is as following: select Qty from [Sheet1$A3:C6]... A3:first column,first row C6:last column,last row Good luck

                      Shay Noy

                      D 1 Reply Last reply
                      0
                      • H helelark123

                        Sorry, I saw the second file you sent me only after sending you this reply. I have checked in google and the solution is as following: select Qty from [Sheet1$A3:C6]... A3:first column,first row C6:last column,last row Good luck

                        Shay Noy

                        D Offline
                        D Offline
                        drexler_kk
                        wrote on last edited by
                        #20

                        Yes,I got the solution now. Thank you so much for your help on this issue Mr. Eric Hilel. I will solve the problem here. Thanks alot for your kind effort. Regards Drex

                        H 1 Reply Last reply
                        0
                        • D drexler_kk

                          Yes,I got the solution now. Thank you so much for your help on this issue Mr. Eric Hilel. I will solve the problem here. Thanks alot for your kind effort. Regards Drex

                          H Offline
                          H Offline
                          helelark123
                          wrote on last edited by
                          #21

                          You are welcome

                          Shay Noy

                          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