|
I'm sorry if my question sounds silly:
Can i bind a property of a control to another property of
another control?
I´m trying to bind the Text property of a Label control to
a custom property of a custom control (derived from Control). What should I do?
My goal is to write something like:
Label.DataBindings.Add("Text",CustControl.Property, "");
Thanks.
|
|
|
|
|
Yes you can, and the code you wrote should work. This is managed by the PropertyManager , as opposed to the CurrencyManager that's used for data-type data-binding. See the documentation for the PropertyManager class for more details.
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|
|
I think you mite need to apply the DataBindableAttribute to the property.
leppie::AllocCPArticle("Zee blog"); Seen on my Campus BBS: Linux is free...coz no-one wants to pay for it.
|
|
|
|
|
When coding in the editor, I get intellisense hints with the description I made for my objects, functions and parameters. This I get automatically, the only think you must do is to use the documentation tags.
Unfortunatelly, this works only within a single project. When using the documented component in the client application, I do get only class/method with names and function signatures without any documentation. The assembly produced by VS.NET simply lacks the documentation I prepared.
I tried to compile the project using /doc directive hoping that the file gets compiled into the assembly somehow (although there is no explicit mention about this functionality in MSDN documentation). Actually, I'm lacking any information how the C# documentation offers and how compile the documentation into the assembly. Do you know some resource?
What's the heck? Perhaps I should search somewhere else than in VS.NET?
Thanks for help
Vasek
VB6, C#, MS DNA, MS.NET
Software Developer
|
|
|
|
|
You must use the documentation syntax and either use the /doc:AssemblyName.xml flag on the command-line compiler, or set the same filename in the Documentation setting in the project's configuration dialog (right-click on the project and select Properties).
These XML files should be in the same directories as the assemblies. Note, they are NOT added to the assembly. If you want to generate HTML Help or Help 2 help files out of them, see the NDoc project.
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|
|
Jeez Heath, do you ever sleep? Don't you have work to do somewhere? I thought I could beat you to this one...but you out-posted me by one minute.
When I can talk about 64 bit processors and attract girls with my computer not my car, I'll come out of the closet. Until that time...I'm like "What's the ENTER key?"
-Hockey on being a geek
|
|
|
|
|
Heath Stewart wrote:
/doc:AssemblyName.xml
Thanks for reply. This I did but still not have the documentation in the Intellisense. How do I tell to IDE that it should use that file?
Vasek
VB6, C#, MS DNA, MS.NET
Software Developer
|
|
|
|
|
Remember that those XML files must be in the same directory as the assemblies you're referencing. This is how VS.NET and other IDEs (or some tools out there) find the necessary documentation. So, if you move your assemblies out of the target output directories, make sure you take the XML documentation files with them.
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|
|
Vasek wrote:
hoping that the file gets compiled into the assembly somehow
That would be nice, wouldn't it?
Actually what happens is that the XML comments that you wrote get compiled into an entirely separate XML file in your bin directory with the same name as your assembly. Then VS.NET uses that information at design time to populate the help cache. If you move the assembly, you also need to move the XML file with it.
Hope that helps.
When I can talk about 64 bit processors and attract girls with my computer not my car, I'll come out of the closet. Until that time...I'm like "What's the ENTER key?"
-Hockey on being a geek
|
|
|
|
|
I wonder..
Would it be possible to add the documentation.xml-file to your project? This would only work when and if the Xml-file is generated before the assembly is compiled.
- Daniël Pelsmaeker
|
|
|
|
|
Hello,
I'm trying to decide what is the best way to store my application's location, size, state and also a bunch of other options such as font, color, recently viewed files, etc.
Should I store the information in the registry or in some type of a file? Do people still use .ini files for saving settings anymore? In an older version of my application, I stored the information in a .ini file, but I'm not sure if that is the best way to do it.
Thanks in advance,
Blake
|
|
|
|
|
If maintaning xcopy deployment is a factor you should avoid the registry. Otherwise storing it in an ini or other type of file is probably your best solution.
|
|
|
|
|
Try my article: An extension for a Configuration Settings class in .NET[^], it covers what you are asking for.
-Nick Parker
Last time I checked, all programmers have selective ignorance. I know nothing about 3D graphics. I know a lot about COM. VB gets under people's skin because one can be ignorant of computer architecture and ASM and still get a lot done. - Don Box
|
|
|
|
|
Hi there!
Recently I encountered a surprising effect of the C# language. I wrote the following lines:
public class A
{
public string name;
}
public class X
{
public static void Main()
{
A a1 = new A();
A a2 = new A();
A a;
A _a;
a = a1;
_a = a;
_a.name = "TTT";
//ok, variable "a1" is modified
a = a2; //change the reference target to instance "a2"
_a.name = "SSS";
//?!?, still variable "a1" is modified, although
//the reference is pointing to variable "a2" !!!
_a = a;
_a.name = "SSS";
//ok, now variable "a2" is modified
}
Om, what's happening here? It should be possible to create references to a reference in C#? Is there any optimization action done in the background, that translates a "ref to ref" to a "ref", what would explain the ignoring of the changed ref variable?
Greetings,
Matej
}
Balkanese
|
|
|
|
|
A Reference is just a fancy word for a pointer. Consider...
A a1 = new A();
A a2 = a1;
A a3 = a2;
So everything is pointing to the same instance of the class A
Now...
a2 = new A();
What do you think happens? ...
a1 still points to the first instance
a2 now points to the second instance
a3 still points to the first instance
Why? Because a3 was never told to point to anything else. When a3 was created it was told to point to the first instance, not to a2 - In other words it was told to point to whatever a2 was currently pointing to. a2 is still at liberty to point to something else in the future.
Does this help clear things up?
--Colin Mackay--
"In the confrontation between the stream and the rock, the stream always wins - not through strength but perseverance." (H. Jackson Brown)
Enumerators in .NET: See how to customise foreach loops with C#
|
|
|
|
|
Yes, thank you!
I was assuming something like this. So this means there is no way to let a reference point to a reference instead to the instanced object itself in C#, like it was possible in C++?
This would be a great thing e.g. for a list (ArrayList, etc.). If the listelements would point to a reference variable not to an instance I would just have to change that ref variable in order to change all list elements with that target at one time!
But it seems, that if I want to do so, I will have to change the instantiated object itself, won't I?
Matej
|
|
|
|
|
Why does VS.NET 2003 delete everything from the debug directory, when building a solution? I can't run my application, because when I build it, app.exe.config is removed from the debug directory.
Please HELP
|
|
|
|
|
This is the behavior of practically any build system - it removes the old stuff. VS.NET does have an undocumented (at least, from what I've read) feature where any file named app.config in your project gets renamed appropriately and moved to your target output directory. You could either add this file to your project and make sure the settings are correct in that, or have a backup app.exe.config file in your target output directories that you can copy to the appropriate name after building.
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|
|
If you have a "myapp.exe.config" file in your output folder (e.g. "Debug"), VS.NET tries to replace it with one within your project directory, if it doesn't find it, it deletes it. You can avoid this by making it read-only.
But the better solution is:
-Add an "app.config" (exactly this name) to your VS.NET project. Use it as your configuration file.
- Now everytime you change this file and build your project, it gets copied as "myapp.exe.config" into the output folder.
--
- Free Windows-based CMS: www.zeta-software.de/enu/producer/freeware/download.html
- See me: www.magerquark.de
|
|
|
|
|
I want a control that is based off the Panel control, I would like to be able to drag and drop items on this the same way that i can for the Panel on the toolbox. when i create this custom control it's design view is that of a control that you can not drag and drop things on it.
how can i get my custom panel control to act and feel like the base Panel that comes out of the box?
thanks
|
|
|
|
|
What do you mean, ...based off the Panel control...? Do you mean you extended it? This should work if you did because the designer usually uses the designers from classes up the class chain. Hmm. If nothing else, use ildasm.exe to find out the what Type the DesignerAttribute of the Panel class uses, and use that same attribute (specifying the same Type, which is probably a string representation, but if not it will use the typeof statement) to attribute your class.
You could also implement your own designer than enables drag and drop - and filter the types of controls that can be added - by reading the docs on the DesignerAttribute and the IDesigner interface, although it's typically easier to start off (i.e., extend) with a root designer class, like the ParentControlDesigner , which has support for controls that contain nested controls (like you want).
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|
|
Hello,
I have a C# application I want to speed up.
Does anybody know a tool to monitor it and tell me in which part of the process it spends its time ?
Thanks
Callixte.[^]
|
|
|
|
|
The CLR Profiler (v2.0)[^] might be of some help, give it a try.
-Nick Parker
Last time I checked, all programmers have selective ignorance. I know nothing about 3D graphics. I know a lot about COM. VB gets under people's skin because one can be ignorant of computer architecture and ASM and still get a lot done. - Don Box
|
|
|
|
|
|
This is propably a question from which everyone should know the answer, but I want to ask it anyway.
If I have an enum, like this:
[Flags]
public enum ThisIsAnEnum
{
None,
FirstFlag,
SecondFlag,
ThirdFlag,
FourthFlag
}
How do I test whether a specific value is used?
Is this the proper way?
ThisIsAnEnum enumValue = ThisIsAnEnum.SecondFlag | ThisIsAnEnum.FourthFlag;
if (enumValue & ThisIsAnEnum.SecondFlag != 0)
{
}
Or is there some method like Flags.Match() , but for a bitfield value?
And why do I have to add the values of the enum to it's members? Like this:
[Flags]
public enum ThisIsAnEnum
{
None = 0,
FirstFlag = 1,
SecondFlag = 2,
ThirdFlag = 4,
FourthFlag = 8
}
If I don't, their values will be 0, 1, 2, 3, 4, 5, 6..., and not 0, 1, 2, 4, 8, 16... .
Thanks in advance,
- Daniël Pelsmaeker
The earth is not dying. it is being killed...
|
|
|
|