473,396 Members | 2,090 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Main Form functions in separate files?

Newbie question: I would like to place some functions in the class
MainForm in several files besides Form1.cs. Is there a way to do this?

JG

Jul 22 '05 #1
1 1063
2.0 framework allows for parts of classes to be decalred in seperate .cs files. I don't think there is any way to do this in the
1.* frameworks.

A work-around is to use an entirely seperate class that the MainForm can access. This will effectively allow you to write interface
code in a much 'cleaner' environment, while seperating anything deemed as 'business logic' code in a seperate class. You can also
add the 'business logic' or 'utility' code into a seperate assembly or "component library" altogether and reuse it for other
projects.

--
Dave Sexton
dave@www..jwaonline..com
-----------------------------------------------------------------------
"Jon Gabel" <jo******@rcn.com> wrote in message news:%2******************@TK2MSFTNGP12.phx.gbl...
Newbie question: I would like to place some functions in the class
MainForm in several files besides Form1.cs. Is there a way to do this?

JG

Jul 22 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Erwin Moller | last post by:
Hi group, I have an includefile that I (ahum) include in many scripts. It contains only functions I need now and then. Now I was wondering how things work behind the scenes. Is the whole...
45
by: Steven T. Hatton | last post by:
This is a purely *hypothetical* question. That means, it's /pretend/, CP. ;-) If you were forced at gunpoint to put all your code in classes, rather than in namespace scope (obviously classes...
27
by: poiuz24 | last post by:
aeh, this may be stupid, but could s.b. please explain to me why the following won't link (gcc 3.3)? foo.cpp = """ namespace foo { int main () { return 0; }
3
by: Peng Yu | last post by:
Hi, I'm trying to define inline_test::test() to be inline. But I always got errors. I know that if I define inline_test::test() in inline_test.h, there are no errors. But I still would rather...
9
by: Felix Kater | last post by:
Hi, if I link my code to other o-files: Does the linker include the whole o-file or does it use the needed functions from that only? Felix
1
by: Jon Gabel | last post by:
Newbie question: I would like to place some functions in the class MainForm in several files besides Form1.cs. Is there a way to do this? JG
8
by: Peter Pippinger | last post by:
Hello NG, i have done some work in c#. But now i want to learn c++. I cant find out, how to use strings. in c# i have a function: public void info(string nachricht) {...
25
by: mdh | last post by:
Hi all, Going quite methodically through K& R ( as some of you can attest to!), I have never seen a big diffference in declaring a function within "main" or "ahead" of it. Now, (p119, K&R II), the...
4
by: gw7rib | last post by:
If a class has more than one member function, is it possible for the code for one to be in one translation unit (ie file) and the code for another to be in a different translation unit? I would...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.