|
But when I put the attribute of [assembly:AssemblyVersion("1.0.0.1")] outside the namespace declaration,it emits the error that duplicate AssemblyVersion.
I can implement the version declaration in the file of assemblyinfo.cs。
oh,I catch that。The file of assemblyInfo.cs is one of the sourcecode,but it is made by the IDE。
Thanks very much!
|
|
|
|
|
Hello,
I want to write a programm which includes a
Listview, that should work like the view in the explorer.
The problem is that i can not move the items (shown as LargeIcons) in the listview.
Every Item should be able to be placed everywhere within the Listview.
(e.g. it should be possible that one Icons is over an other Icon)
I also want do drag and drop Listviewitems between to ListViews,
i created a new DataObject wich includs the ListViewItem and send it with the DoDragDrop function.
But if i drop the item on the other ListView, i first have to clone the Item and then delete the one in the origin ListView.
Is there any simpler method to realise that ?
Thanks in advance
Robert
P.S.: I use VB.Net but i think it would't be so difficult to import a conlusion from C#.
|
|
|
|
|
Do we have a popup menu like we have in VB6? This would be nice if we don't.
Nick Parker
|
|
|
|
|
Nick Parker wrote:
This would be nice if we don't.
Why do you say that? What's wrong with popup menus?
Nish
Regards,
Nish
Native CPian.
Born and brought up on CP.
With the CP blood in him.
|
|
|
|
|
Nish - Native CPian wrote:
Why do you say that? What's wrong with popup menus?
Sorry Nish, I think I said that the wrong way, long day today.
I meant, if we don't have them, this would be a nice idea to implement. Are you aware of how to implement these in C# or VB.NET? I'll try to be more clear next time.
Nick Parker
|
|
|
|
|
Check out the ContextMenu class, you should find it in the Toolbox as well, toward the bottom.
James
Simplicity Rules!
|
|
|
|
|
Hey people...
I'm trying to use the UnhandledExceptionEventHandler to make a log of unhandled exceptions and fix them...
the problem is... when an unhandled error occurs the framework shows a debug dialog before running my custom UnhandledExceptionEventHandler, even in Release mode.
How can i avoid this dialog?
tnx
Vanclei Matheus
Brazil
MSN Msgr - vmatheus@msn.com
|
|
|
|
|
I wish we had a C#/.NET FAQ here at CodeProject. This link provides an answer you need.
New Window
|
|
|
|
|
Rama Krishna wrote:
wish we had a C#/.NET FAQ here at CodeProject.
You could always start one The thought had crossed my mind a couple of times; but I hadn't seen too many questions asked often; except for "Can I create a program in C# that doesn't require the .NET runtime?".
James
Simplicity Rules!
|
|
|
|
|
This sounds like a really, really, really good idea. I think I will compile a list of FAQ's that I have seen and try to put something together. That is unless someone else is already working on this, I would like to contribute though.
Nick Parker
|
|
|
|
|
You will want to use the try/catch method of handling errors by placing your process that is bombing out within this style. Note that you will want to place your custom error handler at the top above any generic handler.
Ex.
try
{
int i = 10/Int32.Parse(args[0]);
}
catch(IndexOutOfRangeException e)
{
Console.WriteLine(e.Message);
}
catch(FormatException e)
{
Console.WriteLine(e.Message);
}
catch(DivideByZeroException e)
{
Console.WriteLine(e.Message);
}
catch(OverflowException e)
{
Console.WriteLine(e.Message);
}
HTH
Nick Parker
|
|
|
|
|
The UnhandledExceptionEventHandler is an event on the Application object that is triggered when an application hasn't handled an exception.
If you execute some code and it throws an exception; normally you get a dialog box telling you that an exception wasn't caught and some debugging information; THEN it will fire the event handler. What the original poster wants to do is get rid of that dialog box so it only executes his event handler.
It is usually used in a last ditch effort to save some data or to do some error reporting.
The question you were answering was how to catch multiple exceptions from a block of code; his question is basically how to catch any unhandled exception from any block of code.
James
Simplicity Rules!
|
|
|
|
|
James T. Johnson wrote:
The question you were answering was how to catch multiple exceptions from a block of code; his question is basically how to catch any unhandled exception from any block of code.
The try/catch method should work, unless you are trying to write a generic error handler that all code will use, basically w/o implementation, is this what you are talking about? If so, is this something that is available in C# ?? We have something similar with the On Error Goto in VB6. I was only trying to show how you might catch different exceptions, however he could have just put his custom catch code at the top and then just used a generic one below it.
Nick Parker
|
|
|
|
|
Nick Parker wrote:
is this what you are talking about?
The original question was not on how to catch all exceptions. It was about how to write custom unhandled excepttion filter. Look at the link I sent him in my answer, that will make it clear.
|
|
|
|
|
Ok, Sorry to all (Rama, JTJ), I didn't see the link below. Thanks again, interesting article. How about that C# FAQ?
Nick Parker
|
|
|
|
|
Appreciated that if some one can tell me how to do it! Not multiple highlight rows in datagrid and do nothing, but rather can drag/copy those hightlighted rows to other places, so I need to get ids from those selected rows and put into array. Any one has thoughts?
Thanks!
|
|
|
|
|
I succeeded to serialize an object, my problem is to serialize another object that contains an ArrayList of objects. I want to save in the xml each of the objects that are kept in the ArrayList, how can I do it???
thank you very much,sharon
|
|
|
|
|
The collection must be strongly typed in order for the XML Serializer to work. Specifically the indexer must return the type and the IEnumerator implementation of Current must return the same type.
There are a couple different strongly typed generators out there, my favorite is CollectionGen from Chris Sells. There is another from Microsoft, which you can find on the GotDotNet website.
HTH,
James
Simplicity Rules!
|
|
|
|
|
thank you for your help.
sharon
|
|
|
|
|
I read in my book that I have to implement the functions in MY class... so... why just th´row that damn interface away and just make a method in MY class?!?!?!?
Help me explain it to me!!
Rickard Andersson@Suza Computing
C# and C++ programmer from SWEDEN!
UIN: 50302279
E-Mail: nikado@pc.nu
Speciality: I love C# and C++!
|
|
|
|
|
I am not a theory guy myself. So I can't give a comprehensive answer. But interfaces allow a sort of OOP way of multiple inheritance.
Plus they are very useful in remoting. Read my article on remoting [too lazy to dig out the link] where I show how interfaces are useful.
Nish
p.s. I hope someone gives you a more thorough answer
Regards,
Nish
Native CPian.
Born and brought up on CP.
With the CP blood in him.
|
|
|
|
|
An interface defines one set of related methods that can be implemented by any class to perfom some task.
Take the IComparable interface as an example. It is very simple but what it does means a lot. In this case IComparable has a single method, CompareTo, which compares the object with one that is passed in and returns an int debending on how it compares. Negative values means the instance is less than the one passed in, 0 means they are equal, and positive means the instance is greater than the one passed in.
The reason this is an interface is simple; it is easy to get an interface vs finding out of a class implements a method; then have to worry about what accessability modifiers (public/private/etc) it has. Some objects don't make sense to have a less-than/equal/greater-than operators so making it a method of Object is useless in those cases (for example, one Point is no less than or greater than another; only equal or not equal).
To find out what the required implementation of IComparable is you refer to the contract, in this case that is the MSDN entry for IComparable.
To get an instance of the interface, either cast to it or use the as keyword.
IComparable ic = (IComparable) myString; or IComparable ic = myString as IComparable .
I show a couple uses of interfaces in my article "Using reflection to extend .NET programs", though it discusses reflection more than interfaces you can see how I use an interface to load classes at runtime without needing to know about the class itself.
James
Simplicity Rules!
|
|
|
|
|
James T. Johnson wrote:
you can see how I use an interface to load classes at runtime without needing to know
Woah!!! Is that what your article was about?????
Blast!
Yesterday I was searching for dynamic loading of DLLs
I never thought that's what an article on reflection would be about, though it should have been obvious
Nish
Regards,
Nish
Native CPian.
Born and brought up on CP.
With the CP blood in him.
|
|
|
|
|
Check it out, I wrote it to support a plug-in arcitecture in a project; it may or may not be suitable for your purposes though
James
Simplicity Rules!
|
|
|
|
|
Hello all,
I am trying to create thumnails of web images stored in a database(gif, jpeg and png)
I ran into problems with palettes and transparency.
Does anyone have an idea on how to scale an 8 bpp (or other indexed color depth), gif or png, retaining the palette and transparency, using GDI+ and the .NET framework.
I tried the Graphics.DrawImage method and the Bitmap.GetThumbImage method, but they end up loosing the palette and the transparency. (They work fine for JPEG)
Any Graphics image drawing does not work on indexed colors images.
One way to do it would be to access the BitmapData through unsafe code with the LockBitmap method for the source and destination and apply a linear transformation to fill the palette indexes of the destination and copy the palette from the source to the destination. (As in Christian Graus's articles)
Another way would be to make the destination a 36 bits ARGB image, copy/scale the source with a bicubic interpolation and then reduce the color of the destination image using the palette of the source, letting the encoder use the alpha channel info to set the transparency.
None of that seems straight forward to me.
Thanks if anyone can help.
|
|
|
|