|
I've implemented a custom UITypeEditor for a collection-based property (PropertyInfoCollection). In the GetEditStyle and EditValue methods, I check the type of the value passed (using ITypeDescriptorContext.PropertyDescriptor and value.GetType() in GetEditStyle and EditValue, respectively) and compare them against typeof( PropertyInfoCollection ) using Type.Equals to ensure that only the correct types are edited. Although the two sides of the comparison should be the same type (they do have the same names, versions, assemblies, public key tokens etc. but not the same hash codes...) the test for equality fails if I close the solution, reopen it and try to edit the property. Forcibly casting the property value in EditValue from object to PropertyInfoCollection also results in an InvalidCastException. The test succeeds again (and the cast works) if I rebuild the solution.
Should I be checking types differently? The different hash codes reported for (ostensibly) the same type suggest that the type is perhaps getting loaded twice, and the two different Type instances are not equated. Is this even possible?
|
|
|
|
|
Since this is a UITypeEditor related question i guess you are doing some sort of vs.net designtime support?
if so , have in mind that when you recompile , vs.net does not always (never?) unload the previously version of your assemblies.
I had a very similair problem when dealing with a designtime collectioneditor that cached types.
After a few recompiles , there was equally many different versions of the same classes in mem at the same time.. very annoying..
so maybe you can try to get the assembly from the type and check if the assemblys hashcodes differ aswell and maybe check verion numbers.
To make things a bit worse , I also never found a solution for this
//Roger
|
|
|
|
|
Hi Roger
Thanks for the response - you got it in one. A little reflection quickly established that the respective assemblies have different codebases Hopefully this won't be a problem when the component is being used, as it shouldn't be getting rebuilt under those circumstances...
shambulator
|
|
|
|
|
When I xml serialize a file, I want all the empty node should not appear. e.g.
Please ignore the format of the sample xml serialized file.
The below mentioned xml serialized file has empty region node.
[Application]
[Name]abc[/Name]
[Region/]
[/Application]
I want empty node should not appear in xml serialized file.
[Application]
[Name]abc[/Name]
[/Application]
I appreciate, if anyone has any solutions or suggestions to this, please share their knowledge.
Regards,
Shiby
|
|
|
|
|
Hi,
I want my app to make logfile(a textfile) that doesnt grows bigger than 100kb.
Is there anyway I can delete the first 6 entries (without 6 blank lines) of a textfile and add a new entry without reading the entire file in memory.
|
|
|
|
|
Nope. If you want to remove data from the beginning of a text file, you have to rewrite the entire text file, skipping the data at the beginning you want to drop.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
hi,
I am writting C# Application.
I want to disable ALT+F4 closing in windows Form?
regards,
pubudu.
|
|
|
|
|
Hi!
Alt+F4 results in your form firing a Form.Closing event.
You can cancel the closing progress there.
Regards,
mav
|
|
|
|
|
Catch the event handler Form_Closing and :
void MyForm_Closing(ClosingEvent e)
{
e.Cancel;
}
|
|
|
|
|
hi all,
I have a database in SQL server 2000. There are 5 tables with data..
Now I want to get SQL Script for Tables with DATA in the Tables..
How can I succeed this?
Whenever I run that SQL Script ,I want to attach the database with data.
thanks in advance..
|
|
|
|
|
|
hi,
No.. not that what I want..
Suppose that I have table with 70 rows data..Now How can I generate SQL Script for create Table with 70 rows data in a another database?
regards,
pubudu.
|
|
|
|
|
just select out all of the values from the first table, go through them row by row and add them to a query, then just write the generated sql to a file from your application.
select * from table_1;
in your code then begin a String query = "create table_2....;"
then for each record returned in your query add it to query like so
query+= "insert into table_2 values (" + value(s) from query + ....");"
Does this help? or am I missing what you are trying to do?
Brian Van Beek
My Blog is Awesome, ok maybe not, but is still fun!!
|
|
|
|
|
Hello guys...I have a problem in here...(Who doesn't??;))
How can we connect crystal report to database manually not via database expert??
Thanks before..
Best regards
|
|
|
|
|
hi,
1) You have to create Data Set using "Data Set" in the add New Item Dialog.
2) Add Teables what do you need to generate report.
3)after that you can add that data set to your crystal report using database expert-->project data-->Ado.NET datasets..
4)complete database expert wizard.
3) then write like code to generate report :
Dataset1 ds2=new Dataset1();--->This is instance of Dataset1 class.
System.Data.SqlClient.SqlDataAdapter oda=create adapter instance using ur Query..
oda.Fill(ds2,tablename); (Give tablename=Table name in the query)
Now use this dataset object (ds2) to fill report..
regards,
pubudu.
|
|
|
|
|
hi pubudu..
I knew those way..At ur step 3,u still use database expert to connect to database..and u still use dataset.What i want to know is how we can view data from blank field in crystal report and we can set that source data in code behind..of coz..we need to know how to connect the database too..
Dont use .net facility for this..just coding..How that can be done?
The main problem is how can we view our report properly when we want to change the server..
Thanks again..
|
|
|
|
|
Hello,
The below article might help you. Is this you want?
http://support.businessobjects.com/library/kbase/articles/c2010371.asp
|
|
|
|
|
I can't seem to find and use the Image.FromFile method.
MSDN states that there is this function available and I have already included: using System.Drawing
Can anyone help me please?
|
|
|
|
|
Os Sutrisno wrote:
find
Find?
See this.[^]
<italic>Work hard, Work effectively.
|
|
|
|
|
Find as in when I type Image myPic = new Image.
Intellisense doesn't list FromFile as one of the methods.
Anyways, I found out what was going on
.Net Compact Framework doesn't support Image.FromFile
|
|
|
|
|
Image class cann't be instantiated from,You must do it from Bitmap().
|
|
|
|
|
The FromFile method is a static method. Therefore, you do not call it from an instantiation of the object, you call it right from the Class itself.
Wrong:
<br />
Image myPic = new Image;<br />
myPic.FromFile("someFileName");
Correct:
<br />
Image myPic = Image.FromFile("someFileName");
|
|
|
|
|
I have MAC "52 08 29 0E D9 BF 0B 6D" and i can des encrypt it to "0E C7 55 E2 85 3D F8 93" but how to des decode it back to orginal MAC?
Key is "37 97 23 23 97 89 FD 9D" and initial vector is "00 00 00 00 00 00 00 00".
-Suortti
|
|
|
|
|
This code typed directly into the browser with no testing.
System.Security.Cryptography.DES des =
new System.Security.Cryptography.DES();
byte[] key =
new byte[] { 0x37, 0x97, 0x23, 0x23, 0x97, 0x89, 0xFD, 0x9D };
byte[] iv =
new byte[] { 0, 0, 0, 0, 0, 0, 0, 0 };
using ( des )
{
System.Security.Cryptography.ICryptoTransform dec =
des.CreateDecryptor( key, iv );
using ( dec )
{
dec.TransformFinalBlock( mac, 0, 8 );
}
}
Stability. What an interesting concept. -- Chris Maunder
|
|
|
|
|
didnt help much
|
|
|
|