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
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. Visual Studio
  4. Missing "using" directive

Missing "using" directive

Scheduled Pinned Locked Moved Visual Studio
helpdatabasegraphicsquestion
12 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.
  • B Offline
    B Offline
    Branislav Vidovic
    wrote on last edited by
    #1

    Hy, guys! I'm having a small problem here. I bet it is a trivial one, but I still can't solve it on my own. In my code I have a section which goes foreach (Table tbl in rpt.Database.Tables) { tbl.ApplyLogOnInfo(logOnInfo); } Anyway I keep geting an error message that I am missing a "using" directive and clause "Table" is underlined. Currently I have these "using" directives in my code: using System; using System.Drawing; using System.Collections; using System.ComponentModel; using System.Windows.Forms; using System.Data; So I was wondering if anyone knows which "using" directive is necessary if you want to use the clause "Table"? Thank you for your time. Cheers!

    D L P 3 Replies Last reply
    0
    • B Branislav Vidovic

      Hy, guys! I'm having a small problem here. I bet it is a trivial one, but I still can't solve it on my own. In my code I have a section which goes foreach (Table tbl in rpt.Database.Tables) { tbl.ApplyLogOnInfo(logOnInfo); } Anyway I keep geting an error message that I am missing a "using" directive and clause "Table" is underlined. Currently I have these "using" directives in my code: using System; using System.Drawing; using System.Collections; using System.ComponentModel; using System.Windows.Forms; using System.Data; So I was wondering if anyone knows which "using" directive is necessary if you want to use the clause "Table"? Thank you for your time. Cheers!

      D Offline
      D Offline
      Dave Kreskowiak
      wrote on last edited by
      #2

      "Table" isn't a clause, but a class name. There isn't a class in the .NET Framework called Table, so it's telling you to tell it where to find the class definition of "Table". In your case, I think you're using Crystal Reports, so the Table definition would be somewhere in the CrystalReports namespace. I don't use CR, so this may be wrong, but I think you're missing:

      using CrystalDecisions.CrystalReports.Engine;

      A guide to posting questions on CodeProject[^]
      Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
           2006, 2007

      B 1 Reply Last reply
      0
      • D Dave Kreskowiak

        "Table" isn't a clause, but a class name. There isn't a class in the .NET Framework called Table, so it's telling you to tell it where to find the class definition of "Table". In your case, I think you're using Crystal Reports, so the Table definition would be somewhere in the CrystalReports namespace. I don't use CR, so this may be wrong, but I think you're missing:

        using CrystalDecisions.CrystalReports.Engine;

        A guide to posting questions on CodeProject[^]
        Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
             2006, 2007

        B Offline
        B Offline
        Branislav Vidovic
        wrote on last edited by
        #3

        Thanks Dave, once again you were right. I am using Crystal Reports, and you were write with the using CrystalDecisions.CrystalReports.Engine; Now there is just one more thing left. It can't find class "TableLogOnInfo". Do you know where could that one be? Cheers We try !!

        D 1 Reply Last reply
        0
        • B Branislav Vidovic

          Thanks Dave, once again you were right. I am using Crystal Reports, and you were write with the using CrystalDecisions.CrystalReports.Engine; Now there is just one more thing left. It can't find class "TableLogOnInfo". Do you know where could that one be? Cheers We try !!

          D Offline
          D Offline
          Dave Kreskowiak
          wrote on last edited by
          #4

          Found it here[^], in the CrystalDecisions.Shared namespace.

          A guide to posting questions on CodeProject[^]
          Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
               2006, 2007

          1 Reply Last reply
          0
          • B Branislav Vidovic

            Hy, guys! I'm having a small problem here. I bet it is a trivial one, but I still can't solve it on my own. In my code I have a section which goes foreach (Table tbl in rpt.Database.Tables) { tbl.ApplyLogOnInfo(logOnInfo); } Anyway I keep geting an error message that I am missing a "using" directive and clause "Table" is underlined. Currently I have these "using" directives in my code: using System; using System.Drawing; using System.Collections; using System.ComponentModel; using System.Windows.Forms; using System.Data; So I was wondering if anyone knows which "using" directive is necessary if you want to use the clause "Table"? Thank you for your time. Cheers!

            L Offline
            L Offline
            Luc Pattyn
            wrote on last edited by
            #5

            Hi Branislav, If you decide to go and use some type ("Table" or "TableLogOnInfo") and don't know how exactly it is used, I suggest you read its documentation; it will tell you the namespace, hence the using statement (and everything else you may need). :)

            Luc Pattyn [Forum Guidelines] [My Articles]


            this weeks tips: - make Visual display line numbers: Tools/Options/TextEditor/... - show exceptions with ToString() to see all information - before you ask a question here, search CodeProject, then Google


            1 Reply Last reply
            0
            • B Branislav Vidovic

              Hy, guys! I'm having a small problem here. I bet it is a trivial one, but I still can't solve it on my own. In my code I have a section which goes foreach (Table tbl in rpt.Database.Tables) { tbl.ApplyLogOnInfo(logOnInfo); } Anyway I keep geting an error message that I am missing a "using" directive and clause "Table" is underlined. Currently I have these "using" directives in my code: using System; using System.Drawing; using System.Collections; using System.ComponentModel; using System.Windows.Forms; using System.Data; So I was wondering if anyone knows which "using" directive is necessary if you want to use the clause "Table"? Thank you for your time. Cheers!

              P Offline
              P Offline
              Pete OHanlon
              wrote on last edited by
              #6

              If you are using Visual Studio 2005, there is a handy little tip. Select the errored item in your code and press Shift + Alt + F10 to get a suggestions list.

              Deja View - the feeling that you've seen this post before.

              L 1 Reply Last reply
              0
              • P Pete OHanlon

                If you are using Visual Studio 2005, there is a handy little tip. Select the errored item in your code and press Shift + Alt + F10 to get a suggestions list.

                Deja View - the feeling that you've seen this post before.

                L Offline
                L Offline
                Luc Pattyn
                wrote on last edited by
                #7

                Hi Pete, Do you mean SHIFT/ALT/F10 will offer suggestions including the right namespace, using statement, and/or add reference to project instruction? my VS C# Express Edition 2005 does not react on SHIFT/ALT/F10 at all when the unknown class name is selected. The only way it is willing to "help" me is when I select the error message and hit F1 I get a window explaining Compiler Error CS0246 (add reference, using, typing error?, ...) :)

                Luc Pattyn [Forum Guidelines] [My Articles]


                this weeks tips: - make Visual display line numbers: Tools/Options/TextEditor/... - show exceptions with ToString() to see all information - before you ask a question here, search CodeProject, then Google


                P 1 Reply Last reply
                0
                • L Luc Pattyn

                  Hi Pete, Do you mean SHIFT/ALT/F10 will offer suggestions including the right namespace, using statement, and/or add reference to project instruction? my VS C# Express Edition 2005 does not react on SHIFT/ALT/F10 at all when the unknown class name is selected. The only way it is willing to "help" me is when I select the error message and hit F1 I get a window explaining Compiler Error CS0246 (add reference, using, typing error?, ...) :)

                  Luc Pattyn [Forum Guidelines] [My Articles]


                  this weeks tips: - make Visual display line numbers: Tools/Options/TextEditor/... - show exceptions with ToString() to see all information - before you ask a question here, search CodeProject, then Google


                  P Offline
                  P Offline
                  Pete OHanlon
                  wrote on last edited by
                  #8

                  Aah - I don't have VS Express, so I can't say how that behaves but in Visual Studio Professional it offers the option to add the right namespace as a using statement, or to fully qualify the item. So, if you type in List and then press Shift Alt F10, you'll get an option to add using System.Collections.Generic and an option to convert the List into System.Collections.Generic.List.

                  Deja View - the feeling that you've seen this post before.

                  L 1 Reply Last reply
                  0
                  • P Pete OHanlon

                    Aah - I don't have VS Express, so I can't say how that behaves but in Visual Studio Professional it offers the option to add the right namespace as a using statement, or to fully qualify the item. So, if you type in List and then press Shift Alt F10, you'll get an option to add using System.Collections.Generic and an option to convert the List into System.Collections.Generic.List.

                    Deja View - the feeling that you've seen this post before.

                    L Offline
                    L Offline
                    Luc Pattyn
                    wrote on last edited by
                    #9

                    I see, Express Edition hasn't done that for me. What you describe implies VSpro somehow knows where to find all possible types; do you think it keeps a cache on disk (what if you download say Office PIA, or remove something?), or is it scanning the entire disk when you launch VS ? or invoke the feature the first time ? And the other question puzzling me is how the heck can one remember (or rediscover) all these fancy shortcuts? Is there a one-page description that lists them all ? :)

                    Luc Pattyn [Forum Guidelines] [My Articles]


                    this weeks tips: - make Visual display line numbers: Tools/Options/TextEditor/... - show exceptions with ToString() to see all information - before you ask a question here, search CodeProject, then Google


                    P 1 Reply Last reply
                    0
                    • L Luc Pattyn

                      I see, Express Edition hasn't done that for me. What you describe implies VSpro somehow knows where to find all possible types; do you think it keeps a cache on disk (what if you download say Office PIA, or remove something?), or is it scanning the entire disk when you launch VS ? or invoke the feature the first time ? And the other question puzzling me is how the heck can one remember (or rediscover) all these fancy shortcuts? Is there a one-page description that lists them all ? :)

                      Luc Pattyn [Forum Guidelines] [My Articles]


                      this weeks tips: - make Visual display line numbers: Tools/Options/TextEditor/... - show exceptions with ToString() to see all information - before you ask a question here, search CodeProject, then Google


                      P Offline
                      P Offline
                      Pete OHanlon
                      wrote on last edited by
                      #10

                      OK - I've just tried it out in an Express edition and it worked for me. I created a quick windows app, and in the constructor for the code I typed CollectionBase, which let me press Shift+Alt+F10. It pops up a menu with using System.Collections and System.Collections.CollectionBase.

                      Deja View - the feeling that you've seen this post before.

                      L 1 Reply Last reply
                      0
                      • P Pete OHanlon

                        OK - I've just tried it out in an Express edition and it worked for me. I created a quick windows app, and in the constructor for the code I typed CollectionBase, which let me press Shift+Alt+F10. It pops up a menu with using System.Collections and System.Collections.CollectionBase.

                        Deja View - the feeling that you've seen this post before.

                        L Offline
                        L Offline
                        Luc Pattyn
                        wrote on last edited by
                        #11

                        Hi Pete, Long time ago I unchecked the Intellisense checkbox "Show completion list after a character is typed" because I found it was distracting and slowing me down rather than helping me. I now have learned it also controls your Shift/Alt/F10 trick. So what I want now is those suggestions without completion list ! Thanks anyway.

                        Luc Pattyn [Forum Guidelines] [My Articles]


                        this weeks tips: - make Visual display line numbers: Tools/Options/TextEditor/... - show exceptions with ToString() to see all information - before you ask a question here, search CodeProject, then Google


                        P 1 Reply Last reply
                        0
                        • L Luc Pattyn

                          Hi Pete, Long time ago I unchecked the Intellisense checkbox "Show completion list after a character is typed" because I found it was distracting and slowing me down rather than helping me. I now have learned it also controls your Shift/Alt/F10 trick. So what I want now is those suggestions without completion list ! Thanks anyway.

                          Luc Pattyn [Forum Guidelines] [My Articles]


                          this weeks tips: - make Visual display line numbers: Tools/Options/TextEditor/... - show exceptions with ToString() to see all information - before you ask a question here, search CodeProject, then Google


                          P Offline
                          P Offline
                          Pete OHanlon
                          wrote on last edited by
                          #12

                          That would do it of course.

                          Deja View - the feeling that you've seen this post before.

                          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