Thread: having to .cs files use the same things....

  1. #1
    Registered User
    Join Date
    Aug 2004
    Posts
    731

    having to .cs files use the same things....

    I have the main form which has alot of code in the .cs file. I want to create a new .cs file but be able to use the textboxes and things like that in it. Is this posisble and how?

  2. #2
    C(++)(#)
    Join Date
    Jul 2004
    Posts
    309
    Yes, it is possible. As for the "how" question, you will need to be a bit more specific.
    To code is divine

  3. #3
    Registered User
    Join Date
    Aug 2004
    Posts
    731
    ok. So I got a textbox in Form1. Than I got Form1.cs that uses the textbox. But than I got main.cs (has no part in Form1 yet) that wants to use the textbox in Form1 but it can't.

    See now cause this is hard to explain.

  4. #4
    the hat of redundancy hat nvoigt's Avatar
    Join Date
    Aug 2001
    Location
    Hannover, Germany
    Posts
    3,130
    While possible through hacks, it's bad OO design. Try to put your actions into functions of Form1 and call these functions instead.
    hth
    -nv

    She was so Blonde, she spent 20 minutes looking at the orange juice can because it said "Concentrate."

    When in doubt, read the FAQ.
    Then ask a smart question.

  5. #5
    Banal internet user
    Join Date
    Aug 2002
    Posts
    1,380
    Echoing what nvoigt said.

    WinForms applications should be completely OO. In fact that's one of the reasons I love WinForms.

  6. #6
    Registered User
    Join Date
    Aug 2004
    Posts
    731
    alright yah I can work around it I guess.

    thanks

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Create Copies of Files
    By Kanshu in forum C++ Programming
    Replies: 13
    Last Post: 05-09-2009, 07:53 AM
  2. Reading .dat files from a folder in current directory...
    By porsche911nfs in forum C++ Programming
    Replies: 7
    Last Post: 04-04-2009, 09:52 PM
  3. Error opening files in a different dir
    By Ozzie in forum C++ Programming
    Replies: 3
    Last Post: 10-09-2008, 06:55 AM
  4. Working with muliple source files
    By Swarvy in forum C++ Programming
    Replies: 1
    Last Post: 10-02-2008, 08:36 AM
  5. header and source files
    By gtriarhos in forum C Programming
    Replies: 3
    Last Post: 10-02-2005, 03:16 AM