|
Maybe a little misunderstanding:
I'm using the Property Grid in my application (i.e. at run time).I have a custom (dereived-from-nothing) class with application settings I want to allow my end users to adjust.
"Der Geist des Kriegers ist erwacht / Ich hab die Macht" StS
sighist | Agile Programming | doxygen
|
|
|
|
|
Hi
i'm trying to create a structure in C# that look something like this
struct TEST
{
byte t[100];
};
As i come to learn this is nothing that is supported in C#. I have tried a bunch of diffrent approaches in (using unsafe, Managed C++ etc. ) without any success.
What i want to be able to accomplish is something simmilar to this c++ snippet.
struct TEST
{
char t[100];
};
int* i=new int[100];
TEST* p=(TEST*)i;
Any suggestions appriciated
Thanks
Mikael
|
|
|
|
|
Mikaelr wrote:
As i come to learn this is nothing that is supported in C#. I have tried a bunch of diffrent approaches in (using unsafe, Managed C++ etc. ) without any success.
Amazing statement.
(C world)
byte t[100];
(C# world)
byte[] t = new byte[100];
|
|
|
|
|
Yes i know this but i'm NOT looking for creating a reference to an byte array.Which i thought it was obvious in my mail.
I want to create a fixed size array that the compiler maps to offset in the structure. So that I can cast diffrent structs on a buffer and access the data accordingly.
I have not managed to do this in C# as doing "int k[100]" is illegal.
|
|
|
|
|
Mikaelr wrote:
I want to create a fixed size array that the compiler maps to offset in the structure
Ok. I recommend to build an array of object, instead of a specialized array :
object[] m_objecttable; // declaration
m_objecttable = new int[100]; // creation of an int array
m_objecttable = new String[100]; // creation of a string array
And then use reflection to get the type at run-time,
Type objectype = System.GetType( m_objecttable[0] );
Mikaelr wrote:
So that I can cast diffrent structs on a buffer and access the data accordingly
C terminology.
|
|
|
|
|
I'm using System.Uri and System.UriBuilder with .NET Framework 1.0 SP3. It seems to be the case that the "escape string" functionality doesn't work as I'd expect a normal Uri class to work -- it doesn't escape special characters such as ' ' or '"' at all, and I don't see a way to do that in the system classes. Anyone?
Also, I just noticed that System.Uri.ToString() and System.Uri.AbsoluteUri produce different output, which is something I didn't expect.
|
|
|
|
|
Arun Bhalla wrote:
it doesn't escape special characters such as ' ' or '"' at all, and I don't see a way to do that in the system classes
They are escaped! How it works is as follows : for these characters to be escaped they must be such that IsExcludedCharacter() below returns true. Ascii code for space is 32, and ascii code for the quote is 34. Which is ok.
internal static string System.Uri.EscapeString(string rawString,
bool reEncode, ref bool escaped) {
...
do {
...
if (Uri.IsExcludedCharacter(rawString.get_Chars(local6))) {
local1 = Uri.HexEscape_NoCheck(rawString.get_Chars(local6));
break;
}
...
local6++;
} while (local6 < rawString.Length);
...
}
protected static bool System.UriIsExcludedCharacter(char character) {
if (character > 32 && character < 127)
if (character != 60 && character != 62 && character != 35 &&
character != 37 && character != 34 && character != 123 &&
character != 125 && character != 124 && character != 92 &&
character != 94 && character != 91 && character != 93)
return character == 96;
return 1;
}
A few hints :
- make sure to double quotes, instead of doing \"
- all non-ending spaces are escaped. Ending spaces are not escaped, just trim them before you pass the string to be encoded.
Arun Bhalla wrote:
Also, I just noticed that System.Uri.ToString() and System.Uri.AbsoluteUri produce different output, which is something I didn't expect
Different implementations indeed.
|
|
|
|
|
How I can add a tooltip text with explanation in my code - so when I try to call some function/propertie the tooltip automaticly generated by C# will be with my text ? For example - when you type somthing like this:
String.CompareTo (
Tooltip at the bottom will show the return type and a little info about this function. How I can make something like this in my program ?
|
|
|
|
|
|
Hey,
I want to create streamreader object by using xml like this
StreamReader sr = new StreamReader(xmlNode.InnerXml);
But it is showing the following error -
Illegal characters in path.
Can anybody tell how to do this,
Thanks,
Chito
|
|
|
|
|
chito wrote:
StreamReader sr = new StreamReader(xmlNode.InnerXml);
Try instead:
StringReader sr = new StringReader(xmlNode.InnerXml);
Hope this helps,
Nathan
---------------------------
Hmmm... what's a signature?
|
|
|
|
|
I have a form which is set as the MdiParent and I open a modal form which is a login form. I want to open a MdiChild form if login is successful.
I would usually set the MdiChild as below but as the login form is not the MdiParent how do I set the parent of the new Mdi form since I can't use the this keyword.
fManagerChild ChildForm = new fManagerChild();
ChildForm.MdiParent = this;
ChildForm.Show();
The forms are called: fManager (MdiParent), fLogin (Modal Form), fManagerChild (MdiChild)
Thanks
Neil
|
|
|
|
|
Is this what you are after?
ManagerChild ChildForm = new fManagerChild();
ChildForm.MdiParent = this.Owner;
ChildForm.Show();
|
|
|
|
|
Has anyone seen any articles on how to do this:
For example, the ASP.NET Validator Controls allow you to select a ControlToValidate in the property table. It's stored as a string, but if you click the drop down button, you get a list of all your controls that support the ValidationPropertyAttribute.
How does it do this? Does it use the attribute somehow?
What I'd like to do is show a list of all MenuItems, so if the concept requires the attribute then I could be onto a non-starter. But it would be a nifty feature for what I'm trying to do.
Paul
We all will feed the worms and trees So don't be shy - Queens of the Stone Age, Mosquito Song
|
|
|
|
|
I think those are refered to as TypeDescriptors in design mode. Frankly, I wish I could figure out how to debug designer code could within VS.NET.
HTH
I rated this article 2 by mistake. It deserves more. I wanted to get to the second page... - vjedlicka 3:33 25 Nov '02
|
|
|
|
|
leppie wrote:
I think those are refered to as TypeDescriptors in design mode
leppie,
Never found chance to thank you for this reply.
Did it help me? Well, it gave me something new to learn about... and then I discovered that you could just define the property as type MenuItem and it gives you a DropDownList of MenuItems in the form automatically, so learning it was completely useless but cool anyway
Paul
We all will feed the worms and trees So don't be shy - Queens of the Stone Age, Mosquito Song
|
|
|
|
|
When a Socket got data , I receive it and save it to a *.wav file , play it immediately., my code is under next line .
-------------------------------------------------------
byte[] receive = _server.GetReceiveData();
ff++; // just a counter
statusBar1.Text = "Receive!!!" + receive.GetUpperBound(0) +" "+ff ;
FileName = "receive.wav";
CreateRIFF(); // A function to Create a RIFF, do not look this
Writer.Write(receive);
count = receive.Length ;
Writer.Seek(4, SeekOrigin.Begin);
// Seek to the length descriptor of the RIFF file.
Writer.Write((int)(receive.Length + 36));
// Write the file length, minus first 8 bytes of RIFF description.
Writer.Seek(40, SeekOrigin.Begin);
// Seek to the data length descriptor of the RIFF file.
Writer.Write(receive.Length);
// Write the length of the sample data in bytes.
Writer.Close(); // Close the file now.
Writer = null; // Set the writer to null.
WaveFile = null; // Set the FileStream to null.
//----------------------------------------------------------
//!!!!Problem , when program run to here , yes , it can create a buffer,
//but it just play three times and then can't play anymore !!
//mind that this case is a OnReceiveEvent called when Socket got data.
//The Frequention perhaps ten times a second.
Buffer p = new Buffer("receive.wav",applicationDevice_buffer);
p.Play(0, BufferPlayFlags.Default);
//----------------------------------------------------------------
textBox1.Text = "Receive and played!!!" + receive.GetUpperBound(0) "+(ff) ;
Something happened let I can't receive the data since ff > 3 , can anyone solve this problem ?
|
|
|
|
|
hi peoples.... i need to find away to get the count of event handlers prescribed to a Timer.Tick method. Is there away ? or as a alternitive but working just as well.....is the best way just to re-initialize the variable agian?
thanks....
Jesse M
The Code Project Is Your Friend...
|
|
|
|
|
To do that, you would need access to the delegate the Timer uses. In both Timer classes, System.Timers.Timer and System.Windows.Forms.Timer, this is marked as private. So in short, no.
Why would you need to know this?
Hawaian shirts and shorts work too in Summer.
People assume you're either a complete nut (in which case not a worthy target) or so damn good you don't need to worry about camouflage...
-Anna-Jayne Metcalfe on Paintballing
|
|
|
|
|
well i have a timer that performs a calculation.... i can add as many events to it as i want (say i add five... Timer.Tick += ect) but i want to remove all the previous Tick Eventhandlers to ensure that i have no more then 5 attached to it. (the reason i want so many is that they will all be pointed to the same method, thus doing the calculation X times per cycle as aposed to one).
Any ideas / suggestions ?
Jesse M
The Code Project Is Your Friend...
|
|
|
|
|
While doing a stupid class project* I paid a visit to WindowsForms.net and ran across this little gem:
RegionMaster Controls[^]
I just glanced through the documentation and it looks pretty cool, though I haven't got a chance to dive into the source yet. Back to my proj. I've got less than two hours to include a bunch of garbage
*The project was actually ok until I read through the requirements and found I needed to include a sample of every little feature of powerpoint...
James
"It is self repeating, of unknown pattern"
Data - Star Trek: The Next Generation
|
|
|
|
|
Interesting...
Thanks for telling us about them.
"Do unto others as you would have them do unto you." - Jesus
"An eye for an eye only makes the whole world blind." - Mahatma Gandhi
|
|
|
|
|
You don't do blogging do you James? That was circulating around the blogging world a couple of weeks ago.
Hawaian shirts and shorts work too in Summer.
People assume you're either a complete nut (in which case not a worthy target) or so damn good you don't need to worry about camouflage...
-Anna-Jayne Metcalfe on Paintballing
|
|
|
|
|
David Stone wrote:
You don't do blogging do you James?
Nope, I pretty much stick to CP; though I have started reading Chris Brumme's blog. Maybe one of these days I'll get into the whole blog thing
David Stone wrote:
That was circulating around the blogging world a couple of weeks ago.
Then why didn't you post it
James
"It is self repeating, of unknown pattern"
Data - Star Trek: The Next Generation
|
|
|
|
|
James T. Johnson wrote:
Nope, I pretty much stick to CP; though I have started reading Chris Brumme's blog.
I was going to mention him to you...my head swims when I read that stuff.
Hawaian shirts and shorts work too in Summer.
People assume you're either a complete nut (in which case not a worthy target) or so damn good you don't need to worry about camouflage...
-Anna-Jayne Metcalfe on Paintballing
|
|
|
|