|
I have a custom class TableProperties which has properties for CSS table styles. I have a CustomColor property that has a UITypeEditor to display the ColorDialog control and then convert the color value to a hex string (e.g., ffffff). When I iterate through the PropertyInfo collection the GetValue method returns the property type rather than the value.
foreach (PropertyInfo pi in tableProperties.GetType().GetProperties())
{
name = pi.Name;
ListViewItem lvi = listView1.Items.Add(name);
theType = pi.PropertyType.ToString();
lvi.SubItems.Add(theType);
value = pi.GetValue(tableProperties, null).ToString();
lvi.SubItems.Add(value);
}
The PropertyGrid works fine with the custom properties.
Thanks,
Mark
|
|
|
|
|
There are a few ways to fix this. The poblem lies here:
pi.GetValue(tableProperties, null).ToString();
The ToString() method, unless overloaded will return the type. If you can modify the TblPropTest.CustomColor code, you should overload this method. The code below adds an extension method to the Color class to output the Hex RGB value:
public static class ColorExtensions
{
static string GetHex(byte value)
{
return value.ToString("X");
}
public static string ToRGBHexString(this System.Drawing.Color color)
{
return GetHex(color.R) + GetHex(color.G) + GetHex(color.B);
}
}
This should be of help. If you cannot use this, please post the code for the TblPropTest.CustomColor type, as this is the root of the problem.Dalek Dave: There are many words that some find offensive, Homosexuality, Alcoholism, Religion, Visual Basic, Manchester United, Butter.
|
|
|
|
|
Yes I have overloaded the ToString method. Below are the methods in my CustomColor class. My ToString method was incorrect!
public new string ToString()
{
return string.Format("{0:X2}{1:X2}{2:X2}", _Red, _Green, _Blue);
}
public override string ToString()
{
return string.Format("{0:X2}{1:X2}{2:X2}", _Red, _Green, _Blue);
}
Thanks for the help!
Markmodified on Monday, March 1, 2010 11:53 AM
|
|
|
|
|
Hello together,
i actually have big problems to describe the project I want to realize.
First of all:
I do not ask for any finished solutions, but just for some advice.
We have a resource management tool for managing the ressources of our applications (a ton of win- and web-applications)
in a database.
It works very well for years now, but we often have the (I think common) problem, that our translators translate
the resources without the application context, which leads to the fact, that often a resource does not fit into
the button/label in the application.
Of course, we trim the resources to fit into the according control, but that is not a satisfying solution.
You could also say, that our translators should open the applications and have a look, where each resource will be
displayed, but due to the fact, that we have many applications, none of them is really doing it
(because they would have to install every application).
That is why I thought about a form, where they could enter the translations "into" the form of the application.
Each developer could prepare "his" form and would provide a library, that would be included into the resource
management tool.
There, the translators have the ability to open the form, and enter the translation "right into the controls".
Once again, this is no request like 'please code that for me', I am looking just for suggestions (maybe a tool like this
exists? I did not found sth. on codeproject. Or maybe there is some code, to load forms from other dll's).
kind regards
|
|
|
|
|
Hi,
I'm quite new to the whole .NET/C# thingy (reading some books now) and I was thinking of something useful to build @ the office.
This is - basically - what I've got in mind:
We have a server on which we build our application. On the server, there should be an application running which accepts commands. The commands can be sent from an application every workstation has to run. If someone sends a command (like: start new build) this single person has to be notified if it was possible to start the command (perhaps there was a build already running?). If the command is executed, the app on the server has to broadcast a message to everybody who has the app running so they know a new build was started.
At the moment all programmers log in to the server (via remote desktop) and double clicks an icon on the desktop. We - obviously - want to limit the access so programmers don't need to log in on the server.
I am thinking of concepts like TCP/IP and/or WCF. Who can help me on my way? Where to start?
Thanks in advance for any information given!
Regards,
Ted- Life would be so much easier if I had the source code!
- If C# had true garbage collection, most applications would delete themselves upon execution
|
|
|
|
|
Message Closed
modified 23-Nov-14 7:07am.
|
|
|
|
|
I got that far :S I need help getting started up with the whole communication stuff in WCF.- Life would be so much easier if I had the source code!
- If C# had true garbage collection, most applications would delete themselves upon execution
|
|
|
|
|
Hi,
I have a need to screen scrape a legacy windows application. Can anyone give me some pointers as to how this can be done with C# .Net?
All guidance offered will be warmly appreciated.Regards,
Dave
|
|
|
|
|
Message Closed
modified 23-Nov-14 7:07am.
|
|
|
|
|
That's scraping of web pages rather than a Windows gui. Regards,
Dave
|
|
|
|
|
I am building a CAB file for a C# program under VS2005 which includes all of the dependent DLLs, but when I install it under Wince 5.0 it fails to run, claiming missing components. Any suggestions as to why this doesn't work?
TIA!
|
|
|
|
|
viaducting wrote: which includes all of the dependent DLLs
you might be missing some.
Example: when an EXE depends on A.DLL, and A.DLL depends on B.DLL, and B.DLL is missing, an error will appear as if A.DLL is missing (since it fails to load what it needs).
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]
I only read code that is properly formatted, adding PRE tags is the easiest way to obtain that. All Toronto weekends should be extremely wet until we get it automated in regular forums, not just QA.
|
|
|
|
|
Isn't C#/.NET supposed to detect dependencies and build them all in to the installer?modified on Monday, March 1, 2010 7:19 AM
|
|
|
|
|
That sounds right, yet you do have a problem.
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]
I only read code that is properly formatted, adding PRE tags is the easiest way to obtain that. All Toronto weekends should be extremely wet until we get it automated in regular forums, not just QA.
|
|
|
|
|
It's not the job of C# to do so. It's the job of the Setup Wizard. But, it does NOT look at .DLL's to find child dependancies of those .DLL's and children of those and so on and so on. There's no way to tell when it should stop. So, it'll only copy in the .DLL's that your project is dependant on. It will not look for what those .DLL's are dependant on.
|
|
|
|
|
I assume you've built on a standard Windows box. It sounds like you have a reference to a component in there that doesn't exist on WinCE 5."WPF has many lovers. It's a veritable porn star!" - Josh Smith As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.
My blog | My articles | MoXAML PowerToys | Onyx
|
|
|
|
|
Hello,
i want create MMS File ,
To Create mms file have to write some haders .
First one (X-Mms-Message-Type: m-send-req)
i write that string to file when i open that file i can just read that string as normal text
but when i open the mms files it in Binary Format Like
Œ€ک1267008088 چ’‰
پ…K…—ê0122555383/TYPE=PLMN –
êFW: Dodo „ ³‰application/smil
i use that code
01.FileStream stream = new FileStream("C:\\mysecretfile.mms", FileMode.Create);
02.BinaryWriter w = new BinaryWriter(stream);
03.w.Write("X-Mms-Message-Type: m-send-req");
04.w.Close();
thank youJavaScript - C# - MS Sql Server - asp.net 2
|
|
|
|
|
There is nothing wrong with your snipset. I get this in file: 'X-Mms-Message-Type: m-send-req'
|
|
|
|
|
Sorry for my bad languish
what i want is get that
Œ€ک1267008088 چ’‰
پ…K…—ê0122555383/TYPE=PLMN –
êFW: Dodo „ ³‰application/smil
not the normal text .
thnak you for your hellpJavaScript - C# - MS Sql Server - asp.net 2
|
|
|
|
|
In that case, write as a byte[]
|
|
|
|
|
hello,
thank you for you help .
i convert string ti byte[] and write it still get the string as normal text .
i use that code
FileStream stream = new FileStream("C:\\mysecretfile.mms", FileMode.Create);
BinaryWriter w = new BinaryWriter(stream);
System.Text.ASCIIEncoding encoding = new System.Text.ASCIIEncoding();
w.Write(encoding.GetBytes("X-Mms-Message-Type: m-send-req"));
w.Close();
JavaScript - C# - MS Sql Server - asp.net 2
|
|
|
|
|
mohamed antar wrote: i convert string ti byte[] and write it still get the string as normal text .
Of course it is behaving that whay. You need to write each byte manualy. You can't easly convert string to binary format.
example:
FileStream stream = new FileStream("C:\\mysecretfile.mms", FileMode.Create);
BinaryWriter w = new BinaryWriter(stream);
w.Write(new bytes[]{0x42, 0x49, 0x4B, 0x69, 0xED, 0x47});
w.Close();
|
|
|
|
|
hello and thank you for your hellp
how i convert my string to thsi format
"0x42, 0x49, 0x4B, 0x69, 0xED, 0x47"JavaScript - C# - MS Sql Server - asp.net 2
|
|
|
|
|
Use program like HEX editor or viewer. Open your file and you will get proper binary format. Simple convertion from Binary to string results in a broken string. And if you wanted to convert back, you get a non working file
|
|
|
|
|
is ther a way to convert string using code ? JavaScript - C# - MS Sql Server - asp.net 2
|
|
|
|