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#
  4. muliple class problem

muliple class problem

Scheduled Pinned Locked Moved C#
data-structureshelpquestion
5 Posts 5 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.
  • G Offline
    G Offline
    Gretna
    wrote on last edited by
    #1

    I have a class called Graph.cs and in this class I set the values of some data from another class called Data.cs. I then try and read this data from another class called DrawGraph.cs, but I can't seem to read the data I set before this is because it is creatinga new instance of the Graph.cs class is there anyway around this. Thanks :)

    "When will I learn? The answers to life's problems aren't at the bottom of a bottle. They're on TV" - Homer Simpson

    C I 2 Replies Last reply
    0
    • G Gretna

      I have a class called Graph.cs and in this class I set the values of some data from another class called Data.cs. I then try and read this data from another class called DrawGraph.cs, but I can't seem to read the data I set before this is because it is creatinga new instance of the Graph.cs class is there anyway around this. Thanks :)

      "When will I learn? The answers to life's problems aren't at the bottom of a bottle. They're on TV" - Homer Simpson

      C Offline
      C Offline
      Christian Graus
      wrote on last edited by
      #2

      fix your code, it's obvioulsy broken. You're creating a new class instance, they don't create themselves.

      Christian Graus No longer a Microsoft MVP, but still happy to answer your questions.

      L M 2 Replies Last reply
      0
      • C Christian Graus

        fix your code, it's obvioulsy broken. You're creating a new class instance, they don't create themselves.

        Christian Graus No longer a Microsoft MVP, but still happy to answer your questions.

        L Offline
        L Offline
        Lost User
        wrote on last edited by
        #3

        Christian Graus wrote:

        You're creating a new class instance, they don't create themselves

        :laugh:

        1 Reply Last reply
        0
        • C Christian Graus

          fix your code, it's obvioulsy broken. You're creating a new class instance, they don't create themselves.

          Christian Graus No longer a Microsoft MVP, but still happy to answer your questions.

          M Offline
          M Offline
          Mark Salsbery
          wrote on last edited by
          #4

          Christian Graus wrote:

          You're creating a new class instance, they don't create themselves.

          :laugh: That's why this C# fad will never last.

          Mark Salsbery Microsoft MVP - Visual C++ :java:

          1 Reply Last reply
          0
          • G Gretna

            I have a class called Graph.cs and in this class I set the values of some data from another class called Data.cs. I then try and read this data from another class called DrawGraph.cs, but I can't seem to read the data I set before this is because it is creatinga new instance of the Graph.cs class is there anyway around this. Thanks :)

            "When will I learn? The answers to life's problems aren't at the bottom of a bottle. They're on TV" - Homer Simpson

            I Offline
            I Offline
            ianhunt01
            wrote on last edited by
            #5

            Hi, I had the same question here with no positive answers and did a lot of reading finding the answer in Delegates and Event handling - do a search in the articles in Delegates and Event handling. It ends up a long and tedious process of three pages of coding to fix. I got fed up and just posted the variables as public static and then everything can see it allways. Very crude and non conforming to OOP, but quick !! cheers Ian

            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