|
Hi,
Iam new to C# , can any one help me to create property within an property in propertygrid (ie) i should have Expandable symbol for a property that doesnt include category .
Thank you
Regards
Praveen
|
|
|
|
|
Hi Praveen,
In the Microsoft PropertyGrid, you can't create directly a property under another property. You must do it like a Font or a Pen does it. For example, if you have a Font property in your target instance, you will be able to see it in the grid and to expand it to see the published properties underneath. This trick is achieved by the FontConverter class. If you look its source code into Reflector you will see how GetProperties() returns a set of customized properties and how CreateInstance() reacreates a font instance with the values of these properties. Studying these classes can help you a lot understand how the propertygrid works. Hope that helps.
|
|
|
|
|
Hi Dear Respected Programmers
I want, suppress line in crystal report when my running balance becomes with minus.
kindly let me know the method that how may I solve this problem.
thank you in advance
(Riaz)
|
|
|
|
|
I am trying to update a VFP table with C# using code like the following:
OleDbCommand olecmd = new OleDbCommand(strcmd, oleconn);
olecmd.ExecuteNonQuery();
I do get an exception raised with 'Feature not Available' so my question is: is there anyway to update VFP data using C# or any .NET language?
i am using windows XP Pro SP2 with visual studio 2005 and VFP 7.0
Your response is greatly appreciated.
Bob Enein
|
|
|
|
|
HI
I am testing a piece of remoting code, I get the following exception message; “BinaryFormatter Version incompatibility. Expected Version 1.0. Received Version 1950887522.2017816692.”
Is the problem associated with my BinaryFormatter Version?
Please help me i tried everything but i cant figure it out
|
|
|
|
|
Hi,
Can anyone answer this question, Please?
How to minimize & zip the access DataBase file programaticaly using C#?
I mean, The size of Access DB file is growing in size rapidly while the Input data is small
Fahd Abo Aiad
|
|
|
|
|
There are zip classes in .NET 2.0, but is that really what you want ? Or do you want to compact the database ?
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
Hi,
I need to compact the database...
Fahd Abo Aiad
|
|
|
|
|
Hey all,
I need to describe what I'm doing before I can ask my question, so bear with me.
I have implemented a 'limited-heap' where N columns of my DataRow define unqueness.
And M different columns define the sort order so that I can discard rows beyond arbitary MaxRows.
I have a Dictionary<int64,datarow> (ie: a hash table with order(1) lookup)
and a SortedDictionary<int64,int64> (ie: a balanced tree on the key).
I make an Int64 Key from the N Columns in the row, If it exists in my heap I aggregrate some of the data and increment a counter. If it does Not exist I add it.
All this uses the Dictionary<>
Now the magic bit I need to remove the Least Significant row as defined by the M Columns.
So I need them sorted. So I add it to the SortedDictionary<>.
Then If I have More than MaxRows in there, I lookup the first row in my SortedDictionary and remove it from both. (Note that the Value section of the SortedDictionary is not needed).
Now my Question:
I implemented this twice. In the first one I put the Int64 key value from the Dictionary as my key value in my SortedDictionary, then I supplied a Comparer to lookup the Dictionary for the value to compare.
In the second I put the actual DataRow in the SortedDictionary and made sure the comparer used this instead.
Why would this be slower?
My Inserts and Removes from the SortedDictionary was were I lost performace, but I dont know why.
All I can think of is that the referene to the dataRow is bigger than the Int64 keyvalue. And therefore required more memory (but this is my c++ head thinking here, and I don't know if this applies in c#)
Thoughts anyone?
nb: Sorry to be so long.
|
|
|
|
|
Presumably, you have a huge list if you're using an Int64 ?
My guess would be that an int can be compared to an int, nice and easy. If you have two datarows, you need to look up a value in both before you can do a comparison. Or am I wrong, you're just checking if two datarows are references to the same object ? Either way, you've gone from POD to a complex type being passed around and compared.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
the Int64 is just a key, it does not reflect large amounts of data.
When I'm comparing DataRows I'm checking 3 columns (worst case), and I'm doing this to maintain
a sorted list. This is so I can drop the 'smallest' entry off.
You said that I'm now passing a complex type around - This is a DataRow, therefore its 'reference' is passed around only, surely this can not be much bigger than an Int64.
|
|
|
|
|
That's true, it's the cost of comparison that I was focused on.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
I am working with the new FlatAppearance class under the
System.Windows.Forms.Button control in 2.0 and am creating a flat button. I
set the button FlatStyle to Flat and the FlatAppearance.BorderSize to 1.
When I run the app the border is exactly 2 pixels and not 1.
Is there anolther property you are suppose to set on the control or is this
simply a bug?
Thanks,
Anton
|
|
|
|
|
Hi,
can anyone offer some pros as to why raise an exception?
Imagine Im developing a function. I can either account for errors by using a try...catch statment, or I can raise an exception.
But Im missing the point of an raising an exception. I can understand why it occurs, but not for reason in the real world.
If I development a function that requires a integer parameter to be less than 10, why would I need to create an exception if its greater? Surely Im going to be aware of that myself? Likewise, I would much rather the application deal with the problem using a try...catch, than throw an exception causing it to creash.
So therefore, raising exceptions is bad?
Can anyone offer any thoughts?
Mark
|
|
|
|
|
One of the best reasons to use exceptions is to make the method that is calling your method aware that something has gone wrong and needs to be dealt with.
Suppose you have written a method that writes a file to disk. Now let's assume that for whatever reason, the file can't be written to disk (disk is full, network error etc.).
Now how should your method handle these errors. You can of course pop up a messagebox explaining to user what has gone wrong, but your calling method will never be aware of the error (unless you return a status code of some kind). You could choose to try to handle the error in the called method, but it is possible that your method can't resolve the error. In that case it is better to make your calling method responsible for handling this.
So the best way to handle these situations is as follows (pseudo code)
try<br />
{<br />
}<br />
catch (ArgumentException e)<br />
{<br />
}<br />
catch (Exception e)<br />
{<br />
throw e;<br />
}
Regards,
Nico
p.s.
Which of the Code Project gurus around here can tell me how to make the tabs in my example code visible. It looks horribly unindented now...
|
|
|
|
|
Nico van der Plas wrote: p.s.
Which of the Code Project gurus around here can tell me how to make the tabs in my example code visible. It looks horribly unindented now...
Use the pre tag.
---
b { font-weight: normal; }
|
|
|
|
|
Mark06 wrote: Imagine Im developing a function. I can either account for errors by using a try...catch statment, or I can raise an exception.
You should only catch exceptions that you know how to handle within the function. A try/catch around all your functions is a bad idea.
Mark06 wrote: If I development a function that requires a integer parameter to be less than 10, why would I need to create an exception if its greater?
So the calling function knows why you couldn't process it's input.
Mark06 wrote: So therefore, raising exceptions is bad?
That depends, would you prefer the program to crash on your machine, or on your users ? When an exception occurs, it indicates that a situation has arisen in your code which you've not properly handled.
FWIW, any windows program I write handles exceptions at the top level and writes them to a log file, exceptions are also exceptionally useful at helping me to work out why code that runs fine here, doesn't always work in the real world. Code that swallowed exceptions would not give me that information, and would make my life a lot more difficult.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
Mark06 wrote: I can either account for errors by using a try...catch statment, or I can raise an exception.
They are actually two sides of the same coin. You use try...catch to handle a sitation where an exception has been raised.
Exceptions are used to handle error messages that can travel up through the call stack until there is some code that knows how to handle it. If you for example have a function that takes a string as argument, and someone sends a null to the function, you can throw an ArgumentNullException to flag that an error has occured as you can't do anything meningfull with the argument. The code that called the function may anticipate that this might happen and catch the exception, or it can let the excpetion continue through the call stack to be handled at a higher level.
Mark06 wrote: If I development a function that requires a integer parameter to be less than 10, why would I need to create an exception if its greater? Surely Im going to be aware of that myself? Likewise, I would much rather the application deal with the problem using a try...catch, than throw an exception causing it to creash.
Perhaps you are not aware of an error that causes some code to send a higher value, then throwing an exception is a good way of telling exactly what went wrong. You can of course choose to handle it some other way, like clipping the values that are larger, but that depends on what you want to happen. Sometimes you want an error to cause an exception, so that you can fix it, instead of silently changing the value or returning an incorrect value that will cause problems later in the code.
---
b { font-weight: normal; }
|
|
|
|
|
Exceptions are for that moron that will modify your code. Always raise good exceptions (your own type too) always use if checks if an exception can be avoided, Assertions are your friend.
90% of the cost is maintenance. Make your code easy to maintain and your code will be great.
On two occasions I have been asked [by members of Parliament], 'Pray, Mr. Babbage, if you put into the machine wrong figures, will the right answers come out?' I am not able rightly to apprehend the kind of confusion of ideas that could provoke such a question. - Charles Babbage
|
|
|
|
|
Hi All!
How can i get the duration of a song?
I have the Windows Media Player control in my Project but i do not know to get the duration, i found the curentMedia properity but it does not work.
Do you know?
Or is there another way to do so?
Thanks
|
|
|
|
|
There's a dll called dexter.dll in your system32 folder if you have DX. Import a reference to it. It contains a class called the MediaDetClass. You can create an instance of this class using the path to your video file, and it's properties will include a stream length. I have found no way to get the video size or length from the WMP classes.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
Hi,
Use This ......
[DllImport("winmm.dll")]
private static extern long mciSendString(string strCommand,StringBuilder strReturn,int iReturnLength, IntPtr hwndCallback);
public int Duration()
{
int ReturnSeconds;
sCommand = "status MediaFile length";
private StringBuilder sBuffer = new StringBuilder(128);
mciSendString(sCommand, sBuffer, 128, IntPtr.Zero);
ReturnSeconds = Convert.ToInt32((sBuffer.ToString()));
ReturnSeconds = ReturnSeconds/1000;
return ReturnSeconds;
}
It will return you the duration .....
Enjoy!!!!
<marquee>nishu
|
|
|
|
|
I am write code that print some lines and text.
In dialog box of printing , I am printing to file - "print to file".
how can I print this file now to the printer???
If i drag him to the menneger of printing it did not working
he write to me : "Can No Print this file,try to open with an apliction..."
when I save this file , what kind of extension I need to write ? ? ?
I mast an answer
Galigal156
|
|
|
|
|
I need your help guys. Thanks in advance.
Can you please teach me on how to create a string array property or give a snippet/sample code. I need this property to have a string editor for my custom web control.
|
|
|
|
|
Hello
Mark Anthony Sabado wrote: how to create a string array property
private string[] _myarray;
public string[] MyStringArray
{
get { return _myarray; }
set { _myarray = value; }
}
Was that what you were looking for?
Regards
|
|
|
|