|
You're need to. It's not hard - just see the DataGrid.TableStyles property in the .NET Framework SDK documentation. If you don't, you can't. The other reply is correct in what you must do.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
I have this project in school, doing a project and while the code is the small part(main thing is learning use RUP and so on) it is still kinda tricky. Not codewise but design wise.
Right now we have one Project class, one Resource class, one Employee class, one "main" class and a "storage manager".(The program will be quite bigger eventually but this is the gist of it).
The program can handle several projects and several employees. And we added a resource class "between" employee and project, ie a resource can only have one project and one employee and it keeps the information needed. Like how many hours the employee should work on the project and so on.
At first we had no relation between these three classes, instead we had a database way of thinking and used a "foreign key" a employee id and project id in resource. But instead it was recommended to us that a good object oriented design should have associations instead.
So I've have been thinking of adding knowledge of project and employee to the resource class and both the employee and project should know about the resource. Will this be good or just too "cluttered".
Another problem we faced was that if that many objects are bound to each other we will have trouble sending them back and forth to our server.(Or will we?)
Any tips of design patterns or just general tips about how we can do?
(Not asking you too do school work for me here , we are actually recommended seeking information on the Internet)
|
|
|
|
|
Cenatar wrote:
So I've have been thinking of adding knowledge of project and employee to the resource class and both the employee and project should know about the resource. Will this be good or just too "cluttered".
It depends on which way you need to travel through the objects. I would imaging your suggestion above is correct. Asking yourself some questions like: Does an employee object need to know about the projects it is connected with? Does a project object need to know about the employees working on it? If it is "yes" in both cases then:
Project keeps a collection of references to its resources
Resource keeps a reference to its project and the employee
Employee keeps a collection of references to its resources
"You can have everything in life you want if you will just help enough other people get what they want." --Zig Ziglar
The Second EuroCPian Event will be in Brussels on the 4th of September
|
|
|
|
|
Colin Angus Mackay wrote:
Project keeps a collection of references to its resources
Resource keeps a reference to its project and the employee
Employee keeps a collection of references to its resources
That is actually exactly how we imagined it thank you, but later wont this be a big mess when we try and transfer it to the server? ie what happens when I get a project from the server(or database) and I want to see what resources that is connected to it?
This might be a stupid question, as I've not looked into this at all. Will do that though, but thank you for your help.
|
|
|
|
|
Cenatar wrote:
what happens when I get a project from the server(or database) and I want to see what resources that is connected to it?
What do you mean? That depends on how you want to implement it, what technologies are abailable and so on.
If you are concerned about large ammounts of data transferring in one go you could implement a lazy fetch algorithm. In other words, you get the project as your starting point. Then if you need to iterate through the list of resources, you'll access that collection through a property and the internal code of the property checks whether the information is available yet and if not builds the collection by fetching the relevant data from the database. The resource object will expose properties that get you to the project and employee with a lazy fetch algorithm, since the project already exists that reference will be reused, but since the employee doesn't exist in your application any attempt to get the employee property will, for the first time, perform a database lookup.
Be warned that over zealous use of lazy fetch (aka lazy lookup) algorithms can hurt performance, however some uses, like in matrix classes (and this is more of a lazy calculation, than lookup) can work very well if you don't need to know everything about the matrix. As a general rule, try and fetch as much as possible in one request (without fetching so much the user is left waiting) because it reduces network traffic (one request and lots of data in the reply, rather than lots of requests and lots of replies - which probably won't fill network packets efficiently).
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
The Second EuroCPian Event will be in Brussels on the 4th of September
|
|
|
|
|
Hi,
I'm trying to set a mailto option in a Windows Form that will send an attachment (eg: WordPad has this feature, call "Send").
This is as far as I got...
System.Diagnostics.Process.Start("mailto:?attachment=" + fileNameWithPath);
Not working though... any help is greatly appreciated )
Ron
|
|
|
|
|
Many MAPI clients do not support attachment in the mailto: pluggable protocol. Outlook and Outlook Express are two that don't support that.
The only way to do it that is application independent is to use Extended MAPI, which must be wrapped. You can also use simple MAPI, but Outlook XP and newer will prompt the user with annoying questions (Microsoft "fix" to all the Outlook-related problems).
One such article that is pretty good is Simple MAPI.NET[^].
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Hi,
I want to color a column in a datagrid . How do I do this?
Karteek
|
|
|
|
|
I told you how the last time you asked this: by extending the DataGridColumnStyle with your own class nad overriding the necessary properties and methods. You must then define your DataGridTableStyle s and DataGridColumnStyle s explicitly. See DataGrid.TableStyles in the .NET Framework SDK documentation for more information.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
|
Hi,
I do not know the number of coulmns in the table or name of the columns. I am dynamically reading the table data from the database. In that case how can I set the mappingname,column name etc... Is there a way to get these while reading data from database.
KArteek
|
|
|
|
|
DataSetObject.Tables[0].Columns gives you the collection of the columns, you can set mapping name to any string value
(like someName+ i // i is the column number).
I think u need to solve the problem logically (I guess, not sure)
|
|
|
|
|
Does anyone know of a way to keep the user from deleting or adding rows in a dataGrid when it it being displayed. They need to be able to edit the data. Thanks in advance.
|
|
|
|
|
You can bind against a DataView with the AllowNew and AllowDelete properties set to false . You could also set these properties on the DataTable.DefaultView property, which returns a DataView over the DataTable .
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
I've seen NetMaster's article on DirectShow (DShowNET) and was excelent in my opinion.
Simple file playback is a joke with this tehnology , but I was wandering about playback from memory or netsockets.I don't mean capture cards , but simple file pre-procesing before playing. As an example , let's say that I wanna send to the filter just the images I want from a movie.My program will take care of pre-procesing but that implies that the filter will be forced to receive input from memory or , in the worst scenario , from a network socket. I've read about MPEG-2 Demultiplexer filter in the DirectX 9 SDK add-on , but I can't quite make it work.
If anyone can help me pls provide an example ( best in C# )
Thanks.
Angel
|
|
|
|
|
Is it possible to implement methods from an interface class as internal in C#? From my first try, it doesn't look like it is possible (the project won't build):
<br />
public interface IMyInterface{<br />
string Name{ get; set; }<br />
}<br />
<br />
public class MyClass : IMyInterface{<br />
internal string Name{ <br />
get{} <br />
set{}<br />
}<br />
}<br />
<br />
...this results in a build error.
But this IS possible to do in VB.Net:
<br />
Public Interface IMyInterface<br />
Property Name() as String<br />
End Interface<br />
<br />
Public Class MyClass<br />
Implements IMyInterface<br />
Friend Property Name() as String Implements IMyInterface.Name<br />
Get<br />
End Get<br />
Set(value as String)<br />
End Set<br />
End Property<br />
End Class<br />
...this generates no errors.
Why is this? If VB.Net can do it, the CLR must allow it, so why can't C# do it?
Would it be because an internal class member defined in an interface doesn't make much sense from a design standpoint? In other words, an internal interface member kind of defeats the purpose of creating an interface in the first place. Is this just a well-thought-out constraint of C#?
- Mike
-------------------------
"No human being would stack books like that." - Dr. Venkman
|
|
|
|
|
C# can, but you're mixing implementation types. You do this in C# using explicit interface implementations, which is what youre VB.NET snippet is doing:
public class MyClass : IMyInterface
{
void IMyInterface.MyMethod()
{
}
} Notice that there's no access modifier. This would be private. This fairly common throughout the .NET FCL. Think about ADO.NET: there's several interface methods but they're all typed; the explicit interface implementation still works and is used to essentially "hide" the "generic" method so that a typed method can be used.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Makes perfect sense. This actually helps open up some other doors that explain a few other things. Muchas gracias.
- Mike
-------------------------
"No human being would stack books like that." - Dr. Venkman
|
|
|
|
|
How can I read the bitmap file pixel by pixel? I need some code.
|
|
|
|
|
Load the file into a Bitmap object and call its GetPixel method.
Bitmap myBitmap = new Bitmap("Grapes.jpg");
Color pixelColor = myBitmap.GetPixel(50, 50);
RageInTheMachine9532
"...a pungent, gastly, stinky piece of cheese!" -- The Roaming Nome
|
|
|
|
|
|
Hi all
I have currently learning to program in C#. I am inspired by the A* path-finding C# algorithms written by Eric Marchesin.
I like to seek help on the implementation of Potential Field Method for robot navigation.
Can anyone show how the complex objects( such as goal, robot, multi-shaped obstacles) can be created systematically ? I am really at a lost.
Other challenges include solving local minima problem and intelligent navigation.
Anyone who has the expertise.Please your help is very much appreciated.
|
|
|
|
|
sodium wrote:
Can anyone show how the complex objects( such as goal, robot, multi-shaped obstacles) can be created systematically ?
What do you mean by "systematically"?
RageInTheMachine9532
"...a pungent, gastly, stinky piece of cheese!" -- The Roaming Nome
|
|
|
|
|
methodically would be a better description. Dave, are you capable ?
|
|
|
|
|
Nope. Never touched Navigation algorithms...
RageInTheMachine9532
"...a pungent, gastly, stinky piece of cheese!" -- The Roaming Nome
|
|
|
|