|
Not easily done.
You can only achieve this by extending the groupbox class, and painting it yourself.
|
|
|
|
|
The problem:
I want to allow an administrator (user) to create a list of teachers, each teacher in turn has a list of classes, each class has a list of students.
There's an article at http://aspalliance.com/721 that describes making classes for the Student and the StudentList, but I'm wondering how to make classes that are collections of the other classes, ie a ClassList that holds the StudentList class and a TeacherList class that holds the ClassList class.
TeacherList-->ClassList-->StudentList-->Student
What is the approach to use to make a custom object that could handle this nesting?
The article mentioned above has a StudentList Class that inherits from IEnumerable and uses a Hastable to hold the Student objects that are made up of simple data types. I tried making classes in a similar fashion for the ClassList and StudentList collections, but I'm having casting errors, so I'm not sure that this is the correct approach or my implementation is not correct.
Anyone have any ideas or suggestions as to how to nest collections like this? or another approach to accomplish the same thing? If you want to see the code I've tried, I can post it.
Thanks,
Paul
|
|
|
|
|
The design using a HashTable to hold the objects is sound.
I would make a TeacherList object that is a list of Teacher objects. The Teacher object would contain a ClassList object that is a list of SchoolClass objects (as Class is obviously not a good name). The SchoolClass object contains a StudentList object, which is a list of Student objects.
---
b { font-weight: normal; }
|
|
|
|
|
Guffa:
I just got a reply elsewhere that pointed out the same error that you did, ie, that I don't have a teacher or a class object and that I cannot use the list objects in their place.
> A TeacherList would not hold a ClassList.
>
> A TeacherList has 0-n Teacher objects.
> A Teacher has 1 ClassList
> A ClassList has 0-n Class objects.
> A Class has 1 StudentList
> A StudentList has 1-n Student objects.
I'm working on the solution now. Hopefully, I'll construct it correctly.
Thank you,
Paul
-- modified at 15:49 Tuesday 7th February, 2006
|
|
|
|
|
Well, you could make the TeacherList contain ClassList objects, but then it would hardly be a teacher list, it would just be a ClassList list. A teacher object would probably contain some more information than just the class lists, like the name of the teacher, to start with.
---
b { font-weight: normal; }
|
|
|
|
|
Hi,
I have project when I want to keep all commonly used variables and structures and refer in project. (Like we do using include files in C r C++)
Could any one tell how to do this.
Thanks and Regards,
Subbu
|
|
|
|
|
Add a class file to the project. In the class you put static members.
Also make the class sealed, and make a private constructor in the class. That way it's obvious that one is not supposed to inherit or create objects from the class.
---
b { font-weight: normal; }
|
|
|
|
|
Hi,
Thanks for ur information.
Suppose I want structure(struct) data type which is used accross all the files in the project ...what should I do?
Thanks and Regards,
Subbu
|
|
|
|
|
Put it in the namespace in the class file.
---
b { font-weight: normal; }
|
|
|
|
|
Hi all,
i have a program which is using AxWebBrowser. It was working well under .net framework 1.1. But after upgrading .net framework 2.0, at SOME systems, i receive the error below:
System.Runtime.InteropServices.COMException (0x80004005): Error HRESULT E_FAIL has been returned from a call to a COM component.
at SHDocVw.IWebBrowser2.Navigate(String URL, Object& Flags, Object& TargetFrameName, Object& PostData, Object& Headers)
at AxSHDocVw.AxWebBrowser.Navigate(String uRL, Object& flags, Object& targetFrameName, Object& postData, Object& headers)
does anyone know why it occurs, and how can i fix that problem?
thanks.
ozgur.nevres
|
|
|
|
|
On these "SOME" systems, do they have IE 6.0 SP1 or greater installed? Under .NET 1.0 and 1.1, only IE 5.0 was required. This changed to IE 6.0 SP1 under .NET 2.0.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Thank you, i'll ask it to our clients. But one of our client who is getting this error, has aldready installed ie7.0 Beta. Does it cause the same problem?
ozgur.nevres
|
|
|
|
|
You'll have to test it.
But that's when you tell the customer that since IE7 is a Beta product, you won't support that configuration. After all, how can you support your application when a component that it needs is not stable.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
"But that's when you tell the customer that since IE7 is a Beta product, you won't support that configuration."
it is not easy as you say
But now i am using .net2.0's WebBrowser component and it is working without a problem.
Thanks for your care
ozgur.nevres
|
|
|
|
|
Mertli Ozgur Nevres wrote: it is not easy as you say
Sure it is! You tell them that your code will be tested and supported when IE7 is released. You can't be held responsible for any performance or stability issues because they're using unstable and unsupported software from another manufacturer that your code depends on.
If your customer insists on using it with IE7, they're on their own. You tell them what the terms of support are. They don't get to dictate that to you because, after all, they're not writing the code, you are.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
I have a Windows Forms app in which I execute a SQL statement using SQLDataAdapter. I want the user to be able to kill the SQL statement if it seems to take to long. My thought is to execute the SQL in its own thread. Then when the user clicks a Cancel button it just stops the Thread.
Is this the best way to do this? Will it work? Is is inefficient?
Thanks,
Mark Mokris
|
|
|
|
|
Use the SqlDataAdapter in a thread, as you suggested, but I would add a twist. Instead of calling Thread.Abort() to terminate the thread, have your thread read small chunks of data at a time, and check for a flag telling it to stop between reads. Doing it this way, you could even have a progress bar in your main window showing the progress to the user.
--------
"I say no to drugs, but they don't listen."
- Marilyn Manson
|
|
|
|
|
As someone suggested to me on here yesterday, you might want to look into System.ComponentModel.BackgroundWorker as an alternative. I haven't used it myself, I stuck to threads because it's what I know much more of anyway but it might be worth looking into yourself.
|
|
|
|
|
Can any body help me
I was created one Web Custom Control named WebCustomControl1. I was added the methods called Text, Value, AutoPostBack and compiled. It created as WebCustomControl1.dll.
I opened new web project and copied that WebCustomControl1.dll into the bin folder and added to the ToolBox. Dragged and dropped to the WebForm1.aspx and renamed as wc, and added notmal command button to the page. in the button click event i had written the code like
Response.Write(Request["wc"].ToString());
while executing the line of code it is giving error like Object reference not set to an instance of an object. How can i get the Request of WebCustomControl value from the web page.
Regards
Subbaraju
m.s.raju
|
|
|
|
|
You need to call the constructor of your object. You can't call instance methods or set properties to a null object. So for example:
WebCustomControl1 wcc = new WebCustomControl1();
|
|
|
|
|
Hi,
Does anyone know how I would go about creating a .NET class library that is reentrant between multiple
applications? I need to use this mechanism to "share data" between applications on the same PC. Basically I need to ensure that all applications are using the one and only instance of the DLL. In the "old days" I would have written a reentrant DLL. What is equivalent in .NET? From digging around on MSDN I think I would create a singleton class and use remoting to access it or am I talking nonsense?
Cheers
alan
|
|
|
|
|
objectiveal wrote: From digging around on MSDN I think I would create a singleton class and use remoting to access it
Yep, that's exactly what you would use! More information can be found here[^].
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
|
Thanks guys,
I now have an object that is being used remotely (although on the same PC) via 2 client programs. I am calling methods, setting properties and receiving events from the shared object.
However, what I now need to know is - is this object "thread/process" safe. At the moment I am not using Locks or Monitors or anything on my shared object methods. If I want to make my object "thread/process" safe do I need to implement this or does the remoting architecture automatically take care of this?
Thanks again.
|
|
|
|
|