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. Control access from other classes

Control access from other classes

Scheduled Pinned Locked Moved C#
helptutorialquestion
3 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.
  • D Offline
    D Offline
    DJNokturnal
    wrote on last edited by
    #1

    I was interested in how to accomplish this: Say I have a textbox on form1.cs. I would like to print messages into that textbox from other class files such as work.cs I am sure this is very simple and I am an idiot hehehehe Can someone help me out?

    M 1 Reply Last reply
    0
    • D DJNokturnal

      I was interested in how to accomplish this: Say I have a textbox on form1.cs. I would like to print messages into that textbox from other class files such as work.cs I am sure this is very simple and I am an idiot hehehehe Can someone help me out?

      M Offline
      M Offline
      MoustafaS
      wrote on last edited by
      #2

      Just make a public property in the other class for the text of the text box, and within it you will be able to get the value of it like : //work.cs class Work { TextBox t = new TextBox(); public string TextT { get{return this.t.Text;} } } //form1.cs class form1 { TextBox holder = new TextBox(); holder.Text = Work.TextT; } But this must be have the same namespace or in the same directory ,or at least make a reference to the dll that contains that class Work .

      D 1 Reply Last reply
      0
      • M MoustafaS

        Just make a public property in the other class for the text of the text box, and within it you will be able to get the value of it like : //work.cs class Work { TextBox t = new TextBox(); public string TextT { get{return this.t.Text;} } } //form1.cs class form1 { TextBox holder = new TextBox(); holder.Text = Work.TextT; } But this must be have the same namespace or in the same directory ,or at least make a reference to the dll that contains that class Work .

        D Offline
        D Offline
        DJNokturnal
        wrote on last edited by
        #3

        Thanks for the reply! I have attached a zip with a sample project which (I think) illustrates my problem. If you have some time to spare, could you take a look at it? Thanks and sorry for my pretty rookie problems... http://www.djnokturnal.com/downloads/TextBoxes.zip[^]

        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