|
There's no good excuse for not reading the .NET Framework SDK documentation. Reading documentation is one thing that separates the developers from the code monkeys.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
ok ,ive started on my page class so you know what my weekend will be like. i ve started by adding a new class to the project called pgeHeating:TabPage is that correct so far with the inheritance
|
|
|
|
|
Yes, but use the .NET naming conventions. Keeping with the naming conventions is important to maintain a common convention through an application and the Framework. A better name would be something like HeatingPage . Just look at how the classes and members are named throughout the .NET FCL.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
|
|
soory if i was a bit different as it is uk time on a friday i started on the red wine hoefully i will have proceeded with my class over the weekend it has been agreat week thanks to you
|
|
|
|
|
been at since 5 am when creating my page class to get access to all my text values so as i can add them to a database it seem that all the controls i add to my page need to be public then i can see them when i add the page to my tab control. goes against encapsulation????
|
|
|
|
|
It's a far better OO design where the property sheet (or that which opens it) passes a DataSet or something to each TabPage derivative (helps to extend your own base class or implement some custom interface so you can abstractly work with each class) and let them perform the necessary operations. What you're doing now is still pretty inflexible since each TabPage derivative is highly coupled with your property sheet (the form with the TabControl ).
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
first error:
method system.windows.forms.tabpage.schemes not found
then lots of:
operation not valid due to the current state of the object?
whole load of them in the task list when i switch my class to design view?
have i missed some designer specific code?
|
|
|
|
|
If your tab pages are in a different namespace, then you need to import that namespace using the using Namespace; statement like you do with every other class.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
the project is called 'Patriot' so all namespaces are the same as the classes have been created in the same project
|
|
|
|
|
The project name doesn't mean anything, except that the default root namespace is the project name. If you use folders in your project, source files added to those folders are defaulted to the root namespace plus the folder name(s) appended in hierarchical order. Just look at the source files to see what namespace they're in.
Also, do not make a namespace for each separate class! C'mon, think about it. Does each control in System.Windows.Forms have a separate namespace? No, they're all grouped into that namespace. Namespaces are there to logically group classes and other members, just like System includes all the ubiquitous stuff, and System.Data includes all the core ADO.NET classes, and System.Web includes all the core ASP.NET class while System.Web.UI.WebControls includes a bunch of web controls.
If your current class is in a different namespace, then you must import all namespaces that are different - regardless of whether or not they're in your current project! - or you must type in their fully-qualified type name (namespace + class/interface/struct/enum name).
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
what source files are you talking about? im working hard on the namespaces as icant see it yet
|
|
|
|
|
The files that contain your source code.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
yes and they all are using the same namespace ie 'patriot' the problem is only there for my tabpages and when i look at my new tabpage in the deign view the controls look a mess, but comes out perfect when i run the project
|
|
|
|
|
i know you are very busy man, but i hope you have not deserted me
|
|
|
|
|
ive checked and there is only on namespace, but i have lots of errors like
method not found
operation is not valid
the variable fixedsingle is either undeclared or was never used
etc
|
|
|
|
|
Then go through the errors by double-clicking them to go to the line with the error and fix them.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
when i create my tabpage i added an ordinary class and not a component class will that cause me problems? as it works ok when i run the project
|
|
|
|
|
As I said before, your class has to derive from TabPage . It doesn't matter how you added the file - you could've added a simple text file and then changed the name to Something.cs for all VS.NET cares, so long as you change the Build Action to "Compile". I even gave you an example of how to declare your class, which I'll type here again:
public class MyTabPage : TabPage
{
} Whatever namespace those are in must be imported into the class file that uses them, otherwise the classes can't be found, just like you have to import the System.Windows.Forms namespace so that TabPage can be found, otherwise you have to type the fully-qualified namespace EVERY TIME you reference a class, struct, interface, or enumeration.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
i should be able to capture the text in my class when an instance is created then all my database logic can be contained in my class very nice only need to write it once. cheers for the boot in the buttocks
|
|
|
|
|
Hi all,
I m making an application in C# with compact framework. I need to get data from one form to another without making them public static or even without passing like form form1 = new form(variables).......
Any other options....
BE Computer Engineer from India.
Working on C# and Dot net technologies......
|
|
|
|
|
One suggestion: Create a third class to hold this data. Then from each of the forms reference the instance of the class that you set up to hold/manage the data.
Does this help?
"You can have everything in life you want if you will just help enough other people get what they want." --Zig Ziglar
Coming soon: The Second EuroCPian Event[^].
|
|
|
|
|
Hi,
I have read about reflections, seems to be a cool thing... but It's seems more oriented to do case tools than other things ? Am I Wrong ? Some people says me that it's used on huge projects... but I think all that thing of calling "Invoke" and things like that remembers me to the IDispatch nightmare and GUIDS and ...
|
|
|
|
|
Reflection is definitely useful for case tools, but it can be used in production code, although the size of the project doesn't matter. For instance, reflection is used by the runtime and XML serialization routines. Reflection could also be used - while not recommended - to get/set a private field in a class if you really need to (its name could be changed at any time, though, which is one reason it's not recommended). You could use reflection to discover type information at runtime, which makes it a good solution in many things like IDispatch interfaces, although reflection is much easier to use, IMO, than dispatch (just less things you have to do to accomplish the same thing, which is pretty universal comparing .NET to lower-level languages like C and C++).
Microsoft MVP, Visual C#
My Articles
|
|
|
|