|
Hi,
I am using property grid to allow user to set the property of the control
in a window form, but there are so many fields in the property grid
control, how can I save the all the settings of the property grid ?
Are there some serialization function for the property grid control ?
Thanks
|
|
|
|
|
You could use reflection to loop through every property on the control in question and persist the setting.
This could get pretty complex with collections etc EG the ListView controls column collection.
You may want to take a look at the article on this site entitled "Bending the .NET Property Grid To Your Will". This show you a way to limit the number of properties exposed in the property grid. This may be a more viable approach.
|
|
|
|
|
How do I, in ASP.Net pages, put the code on the same page, rather than in a .cs file?
|
|
|
|
|
Doing so throws away most of the benefits of asp.net, but just place the code in <% %> blocks.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Yeah, I am just using this to redirect.
|
|
|
|
|
Any of the functions that you would normally be put into the code behind can also be put into a section in the .aspx page. We do this for a launching page here at work and have it where we can just edit some of the arrays and data in that script section and put it out on the server and it does not need to be compiled.
Steve Maier, MCSD MCAD
|
|
|
|
|
I have been doin C# for quite some time. When i am doing some console apps for my course assignments i use
System.Console.Read();
as a replacement for the getch() that we used to do in C for making the cursor stop. so that the output window doesn close before i can see the output.
It works at times and at times it doesnt!
Please help me out folks cuz i have ended up using timers for a silly thing like that!!
Rahul
|
|
|
|
|
Remember that console input is buffered, so if there are character in the buffer that were not yet consumed by your app, Console.Read will return immediately, returning the first character in the buffer. Unfortunately, I don't know of any way to clear the buffer using managed code, fflush(stdin); works for C++.
Regards
Senthil
_____________________________
My Blog | My Articles | WinMacro
|
|
|
|
|
Starting the project without Debug in VS2003 will prevent the console from closing until you press return.
Also, have you tried Console.ReadLine()? This will only return when the user hits Return.
|
|
|
|
|
We are searching for a .net component for image transitions. You could find many solutions/board entries for alpha blending, but we could not find any article/module which consist a easy way to handle different transitions like XShow40.oca.
Many thanks for your help!
Volker
Volker Borm
www.frictionless.de
|
|
|
|
|
What do you mean ? Do my image processing articles help ? If not, what do you want ? I'm happy to help, and I'm also available for contract work...
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Dear Christian, we want to make a slideshow with images. The user can use different transition modes (blocks, stripes, fade, ...) The activXControl XShow40 from www.Softuarium.com offers 100 different transitions. We try to develop different transitions with matrixe operations in C#, but we have performance problems with large images. Please let me know if you can help us.
Volker
Volker Borm
www.frictionless.de
|
|
|
|
|
Hi again - I'm sure I can help you. In the first instance, matrix operations are pretty limited, although they can do some things very efficiently. I'd have to say that working smoothly on large images would be a challenge, I'd assume that you would create a control for this, so that you only draw the parts of the image that are changing, not creating a bunch of bitmaps for each step of the animation. If you did that, and used direct pixel access, as per my articles, then you should be able to do any transition you wanted, in my opinion.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Dear Christian! Thanks for your reply. We will try this!
Volker Borm
www.frictionless.de
|
|
|
|
|
Hi all,
I'm trying to write some sort of forum with "forumcode" like snitz. To quote some text, user can surround it with [quote]...[/quote]. To do this I have written this regex:
@"(?<quo_iniTag>\[quote\])(?<quo_text>.*)(?<quo_endTag>\[/quote\])"
and the handler is something like this:
if(m.Groups["quo_iniTag"].Value.Equals("") == false && m.Groups["quo_endTag"].Value.Equals("") == false)
return "####"+m.Groups["quo_text"].Value+"###";
But, sometimes (not always), it hangs forever on the method Replace.
Can you help me please ?
Thanks in advance !
----------------------
!happy coding!
|
|
|
|
|
Can you give an example of a string that causes the regex to hang?
Regards
Senthil
_____________________________
My Blog | My Articles | WinMacro
|
|
|
|
|
Not it is a big deal, but I would clean the code up a bit by using non-capturing groups for the [quote] and [/quote] because you just want to see if they are there, but don't need them. So the regex string would be:
@"(?:\[quote\])(?<quo_text>.*)(?:\[/quote\])"
if ( m.success )
{
return "####"+m.Groups["quo_text"].Value+"###";
}
then I would change the if statement to a while loop in case the user has more than 1 quote block in a line
string [] s = new string[];
int i = 0;
while ( m.success )
{
s [i] = "####"+m.Groups["quo_text"].Value+"###";
m.NextMatch();
}
return s;
But please send an example of the string that causes it to hang
|
|
|
|
|
my reg ex string did not post correctly it should be
@"(?:\[quote\])(?<quo_text>.*)(?:\[/quote\])"
|
|
|
|
|
I am trying to get the list of Serial ports available in windows system.
Appreciate, if you could lead me to some API's available in C# to retrive the existing ports in the system.
Thnx
SRB
|
|
|
|
|
Here's one:
http://msdn.microsoft.com/msdnmag/issues/02/10/NETSerialComm/default.aspx
Or you can get the .NET framework 2.0 (beta) and use the System.IO.Ports namespace which has everything you need bundled in one managed assembly
|
|
|
|
|
Thanks a bunch whizzs.
I am working on .NET 1.1, so the customized version of this code works for me.
cool
|
|
|
|
|
Hi
I have used one of the typed collection generator tools available for generating type safe .Net collection for my custom object (for example, say customer) . However, I had a question with the Indexof and Contains method. How is it normally implemented? If I pass in a customer object to the contains method or the Indexof method, then for it to function properly, do I need to override the ToString() method for the Customer object so that it returns the key of that object?
Any help is appreciated?
Thanks
|
|
|
|
|
tsramkumar wrote: Indexof and Contains
IIRC, both of them use Equals[^] method to determine equality. The default implementation of Equals in System.Object checks if both references refer to the same object, you might want to override it to define equality in whatever way you want.
If you override Equals, it's recommended to override GetHashCode also, as per this[^] recommendation.
For example,
class Customer
{
int id;
public override bool Equals(object obj)
{
if (obj == null) return false;
Customer b = obj as Customer;
if ((object)b == null) return false;
return this.id == b.id;
}
public override int GetHashCode()
{
return id;
}
}
Regards
Senthil
_____________________________
My Blog | My Articles | WinMacro
|
|
|
|
|
Thanks Senthil, that really helps. Btw, if the unique identifier of my custom object is a string (alphanumeric) rather than an int, I cannot override the GetHashCode method right? Can you give me the reason behind your recommendation for overriding this method and where it will be used?
Btw, I got around with this by making the custom object implement the IComprable interface and implement the compareto method which would compare the identifiers adn return if they are equal or not. I am wondering if this is something that is not normally done in this scenario?
Thanks.
|
|
|
|
|
tsramkumar wrote: Can you give me the reason behind your recommendation for overriding this method and where it will be used?
This will be used when you put your custom objects into a Hashtable, or in any associative container. You'd expect to get the same Customer, provided the id is the same, regardless of whether they are two different instances. What I mean is
Hashtable h = new Hashtable();
Customer c1 = new Customer(1);
h[c1] = "Senthil";
...
Customer c2 = new Customer(1);
Console.WriteLine((string)h[c2]);
Users of your class would expect "Senthil", right?
tsramkumar wrote: Btw, I got around with this by making the custom object implement the IComprable interface
I'm not sure if implementing IComparable is enough, does your code work correctly for standard .NET collections like ArrayList?
Regards
Senthil
_____________________________
My Blog | My Articles | WinMacro
|
|
|
|