|
Thanks, it worked
But since i work with it in Linq, i've made it an function in my class.
For those that are interested, I use it this way:
<br />
<br />
public object GetValue(string property) {<br />
Type x = typeof(clsHotel);<br />
PropertyInfo p = x.GetProperty(property);<br />
return p.GetValue(this,null);<br />
}<br />
<br />
<br />
switch (regel[1]) {<br />
case "=":<br />
case "is gelijk aan":<br />
lijst = from d in lijst<br />
where (string)d.GetValue(regel[0]) == regel[2]<br />
select d;<br />
break;<br />
}<br />
return lijst;<br />
|
|
|
|
|
You can use indexer properties for wrapping that up.
For example
public object this[string propertyName]
{
get
{
Type booType = typeof(boo);
PropertyInfo desiredProperty = booType.GetProperty(propertyName);
return desiredProperty.GetValue(temp);
}
}
object boo = foo["boo"];
Isnt this simple?
|
|
|
|
|
I've created this windows user control:
public class ToolStripMenuItemRol : ToolStripMenuItem
So it still supporting all the native properties of the ToolStripMenuItem. The enhacement applied in this user control was a new property:
private List<int> _roles = new List<int>();<br />
<br />
[Description("Listado de roles válidos para usar este menú")]<br />
[Category("Security")] <br />
public List<int> Roles<br />
{<br />
get { return _roles; }<br />
set {_roles = value; }<br />
}
Then the property Roles appears in the Properties Page in Design mode. And when I'm trying to edit this property in design time, a collection editor appears and work fine. Everything's good up here. But when I close the collection editor, the value entered is cleared, so I reedit, and the collection appears empty. The value of the property Roles is losted; it is not been saved. What should I do in order to persist the data registered in the collection editor?
Open mind for a different view.
|
|
|
|
|
Hi,
I have a ListView in "details" mode in which I programmatically add items and display the items with a gray forecolor. I also set HideSelection to false. Everything is fine until I click outise the ListView (so the list loses focus). Whenever I do this, the selected item's ForeColor becomes black.
This also happens when I click inside the list where there are no items (so the list still has focus, but the selection goes away): the previously selected item's forecolor will become black.
Has anyone seen this behavior? Any ideas?
thanx
|
|
|
|
|
Hello everyone,
I recently noticed a strange thing in one of my programs.
After loading the program, the task manager shows memory usage of about 2mb-5mb.
When I minimize my app to tray, the memory usage goes down to 400kb-600kb.
First of... Why is that?
And second...
If I use a certain function in my app, usage jumps back up.
I show the form again, then minimize it to tray again... Usage goes down again...
My theory is that the memory holding GUI data is released.
Any ideas?
Thanks in advance,
Shy.
|
|
|
|
|
That's not strange at all.
When you minimise the program, the memory management in the .NET framework will try to release as much unused memory as possible back to windows. This may include doing a garbage collection to release unused objects. Also the system may swap out rarely used memory areas to the swap file on disk.
If you also bring up the column "Virtual Memory Size" in the task manager, you will see the total memory amount used, including the swapped out memory.
If you use a part of the program or data that has been swapped out to disk, it will be brought back into physical memory, bringing up the memory usage, but not the virtual memory usage.
---
b { font-weight: normal; }
|
|
|
|
|
Actually, it does that for about every application; it's a feature of Windows XP & 2000 IIRC.
|
|
|
|
|
At least the OP's program is giving memory back rather than keeping it and sucking the life out of system resources.
|
|
|
|
|
I have a custom Windows Forms Control. I'll call it "JealousControl".
I want to make it so that if the user puts focus on JealousControl and tries to change focus to another control on the Form that hosts JealousControl, it won't let the user do that except in very specific situations. Furthermore, I want the code that does this to be internal to JealousControl and not inside the Form that hosts JealousControl.
Does anyone know if this is possible (and if so, how)?
|
|
|
|
|
I just experimented with:
private void listBox1_Leave ( object sender , EventArgs e )
{
if ( System.DateTime.Now.Minute <50 )
{
((System.Windows.Forms.Control) sender).Focus() ;
}
}
See if that does what you want.
|
|
|
|
|
|
hi
does anybody take a refrence of how to use Sql Server 2005 Reporting Services in VC# 2005 ?
thanks
|
|
|
|
|
I've recently re-realized that the File Types editor for deployment projects is a POS. Associating an EXE with a file type instead of with individual commands makes no damn sense. So, to have two commands on one file type, each using a different EXE, I have to create registry entries for the second manually.
Problem is, I need to insure that the value dumped into that registry key is sensative to where they choose to install. I could swear that some time ago I saw a list of deployment project variables that could be used, like the [Manufacturer] variable. But I can't find it, and I don't know that they work in registry values.
Does anybody know what all the variables are? And if they can be used in a registry value?
|
|
|
|
|
Just in case anybody cares... Don't know what all is available, but [TARGETDIR] works. But it is case sensative.
|
|
|
|
|
hi
how to use callback to Update progressbar for long operation ?
|
|
|
|
|
Is the operation running in a background thread on the server? Then you can just make the operation store it's status in a database or something, so that you can send a request that will get the status and return it.
If the operation is the current request, then you can't use callback, as the server will only execute one request at the time for each user.
---
b { font-weight: normal; }
|
|
|
|
|
Hy, i have to create a xml from a single dll. I have to list all methods and properties from all classes from that dll, but i dont know how to do it. I know its with Instrospection, but dunno how to do this. Pls, help me
thx a lot
|
|
|
|
|
What do you mean by "create a xml"? An XML file? Containing what?
|
|
|
|
|
I need to create an xml file containing all specific dll methods and properties. Thats what i need.
thx a lot
|
|
|
|
|
|
You've asked this question twice before, and gotten the correct answer from Colin here[^], using Reflection. Asking the question again and again will not change the answer and noone is going to write the code for you.
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
|
Hi
Maybe xsd utility can help you do what you want to do.
There is a utility included in VS2003 (I think it should be in VS2005 too) name XSD.exe that can generate a xsd schema from a dll or a xml file and also it can generate classes according to a provided xsd schema.
Regards
|
|
|
|
|
I'm working on a hexeditor that uses 32bit and 64bit offsets (for files over 4GB), problem is the scrollbar only accepts int values, where I want each value to be a row of hex, so the maximum would be long.MaxValue / 0x10. What's the best option to deal with this? I'm thinking the only options are creating my own scrollbar, or shrinking the value, however if the value is shrunk I want to do it cleverly, so smaller files won't have massive steps in the scrollbar.
|
|
|
|
|
Thanks for your help at first!
Now I'm confusing about the directions which I should choose!
I'm a senior student and have some experieces about C++ language.
Recently Micorsoft produces the Visual Studio 2005,and the C++/CLI is extremely diffrent from the standard C++.And I also learned that the MFC is numbered her days! When I want to learn the Visaul Studio 2005 development,Which direction will be my best choice.C# OR Visual C++.NET?
And could you recommend some wonderful books that will lead me comfortable to the world of Visual Studio 2005(I have no experieces in windows programming!).
|
|
|
|