Nope, never did find a work around, ended up doing it a different way, can't remember exactly how right now.
Patricker
Posts
-
XML Serializing an Object that Inherits a List of itself -
XML Serializing an Object that Inherits a List of itselfI have an object, called Tag, which inherits List<Tag>. This works great code wise, I can add objects of type tag to my tag without issue. But when I try to serialize the object to XML it crashes with a "An unhandled exception of type 'System.StackOverflowException' occurred in System.Xml.dll" error when I try to initialize a new instances the XmlSerializer class, and pass in the type of Tag. If I remove the Inherts List<Tag> and just create a new property of type List<Tag> instead, then this serializes great, but does not give me quite the appearance I want. Is there someway to make this work without custom serialization, or maybe only minor custom serialization? Thanks, Peter
-
Writing Device Drivers in C#?I saw that there are some articles on writing device drivers using C++ but I can't seem to find anything on writing device drivers using C#, even on Google. Is doing this possible? Anyone know where I should look to start? Thanks in Advance :) --Peter
-
Read Large Files Into MemoryYou are awesome. That totally solved my problem and she works great now. Thanks a Million. --Peter
-
Read Large Files Into MemoryAhh. The problem wasn't int being big enough. The problem was making a byte[] that was big enough. My byte[]'s total size in memory was greater then 64kb. The other post though should solve my issues.
-
Read Large Files Into MemoryThis post does not make sense in the context of my question, or you didn't explain yourself well enough.
-
Read Large Files Into MemoryI am trying to decompress a file. To do this, with my current code which you can see below, I am reading the entire file into a byte[]. But if my file is big, I believe bigger then 64 KB, then I can't declare a byte[] big enough to hold the file. How do I fix this, work around this? ---------Code--------- public void GZipDeCompressStream(Stream InStream, Stream OutStream) { //Decompresser GZipStream gzDecompressed = new GZipStream(InStream, CompressionMode.Decompress, true); //Retrieve the size of the decompressed file from the compressed footer byte[] bufferWrite = new byte[4]; InStream.Position = (int)InStream.Length - 4; InStream.Read(bufferWrite, 0, 4); InStream.Position = 0; //Convert to int for using in declaring our Byte[] size int bufferLength = BitConverter.ToInt32(bufferWrite, 0); //Create our Buffer: size + 100 ------------//This is where my issue is. Buffer Lenght is WAY bigger then the 64 KB limit. byte[] buffer = new byte[bufferLength + 100]; int readOffset = 0; int totalBytes = 0; // Loop through the compressed stream and put it into the buffer while (true) { int bytesRead = gzDecompressed.Read(buffer, readOffset, 100); // If we reached the end of the data if (bytesRead == 0) break; readOffset += bytesRead; totalBytes += bytesRead; } // Write the content of the buffer to the destination stream OutStream.Write(buffer, 0, totalBytes); // Close the streams InStream.Close(); gzDecompressed.Close(); OutStream.Close(); }
-
StatusStrip HeightI know somebody just posted some code, that didn't quite make much sense... but it helped anyways. I saw in your code AutoSize set to true, well for some random reason this inspired me to turn off AutoSize. Once i turned off autosize then it let me change the size freely as I wished. So to make a StatusStrip taller you just need to turn off AutoSize. --Peter
-
StatusStrip HeightI am trying to increase the height of my StatusStrip... but it won't let me. Whenever I change the value from 22 to any other value, higher or lower, it automatically changes back to 22. Any ideas how to change this? I want to make it 32 high. Thanks in advance for any help. --Peter
-
More Advanced Tree ViewFor the application I am working on I need something with more power then a standard tree view, but with allot of the same functionality. I want to be able to multi-link nodes basically. So that a node is not a node of just a single parent, necessarily, but can be a child node of multiple parents, or other nodes. I would also like to represent this more graphically, using boxes to represent each node or parent and then using lines to show how they all connect. I can write this myself but I thought I would check and see if anyone knew of a Windows Forms control like this/that supports this. Or maybe not necessarily something that is exactly like this but that would at least save me allot of time because I could just modify it instead of starting from scratch. Thanks in advance for any replies. --Peter
-
Design Time Error, problems reading fileWorked Great, thanks. --Peter
-
Design Time Error, problems reading fileI have a UserControl. When I instantiate it the UserControl reads in an image that it uses, it draws it underneath the cursor. If I programmatically add the UserControl to a form and then run the program it works perfect. However if I try to do this via design time support I get an error screen instead of a design time screen, the error is: "One or more errors encountered while loading the designer. The errors are listed below. Some errors can be fixed by rebuilding your project, while others may require code changes." The reason for the error is that it can't find my image file, because instead of looking for it in my programs folder it looks for it in the Visual Studio IDE Folder. "Could not find file 'C:\Program Files\Microsoft Visual Studio 8\Common7\IDE\images\tileselect.png'. " Is the exact error I get. My original idea was to just remove design time rendering of the control, since it works just fine when I run it, but I couldn't figure out how to make it so that a control is not rendered when you use it in design time. Though design-time support is preferred. Any help on this would be great. I am actually using a combination XNA/Windows Forms but from what I can tell that should have no bearing on the issue. Source Code At Problem: tileSelect = Texture2D.FromFile(GraphicsDevice, "images/tileselect.png"); If I remove this line, and the line that draws the sprite, it will work fine in Design time, it even calls the On_Paint event and runs the XNA code to clear the screen, not shown. Is there maybe some way I could rewrite my path so that it would look in my programs directory... No idea, thats why I posted here :) Thanks in advance. --Peter
-
Update using DetailsView and DataSourceGreetings all, I have a DetailsView, and it works fine when it comes to displaying my details. I am databinding the DetailsView to a DataTable that I am building by combining parts of the MembershipUser and the Profile objects. Now my problem is that when I edit the information and tell the DetailsView to Update I have no idea how to actually retrieve programatically what the new values for the fields in the DetailsView are. The Event Arguments of the Update command contains a NewValues and OldValues properties but neither of them contains anything after an update. I'm really stuck here. Any Ideas? Thanks in advance. --Peter
-
Custom type castingSo inside Foo make a method, lets call it FillFoo(), you make this public and then you can now call it from anything that inherits from Foo. This function however will only fill the values you want to put in Foo. The values for bar and other derived objects can be filled with their own methods contained in their respective objects, such as FillBar(), etc... I think thats sort of what you are trying to do...
-
Debug web applications remotelyIt's always a pain... To type words into google... http://www.google.com/search?q=visual+studio+remote+debugger&start=0&ie=utf-8&oe=utf-8&client=firefox-a&rls=org.mozilla:en-US:official If your using VS2005 try the top one. If not try one of the next couple ones down or modify the search slightly.
-
XML ErrorFirst off does the account running ASP.Net have read/write permissions to that folder? And do you know what account is running ASP.Net? It might be ASPNET, or it might be the other one used on servers... that I can't remember off the top of my head. Its called something to do with Network Services. It's the one that runs those sorts of things.
-
on run timeI would do it something like this: Have a foreach statement. Inside that foreach statement create a new combobox. Then add the item to the combobox. You would need to make a method that was generic enough so that you could use it for all of your comboboxes that you make. This method would handle your On Selected Index Change Event. //thrown together, don't trust it to work without checking it over... foreach(datarow dr in table[0].rows) { ComboBox cb = new ComboBox(); //Make sure you give cb a unique name so that you can tell it apart from the other combos. cb.items.add("Pass in your value from the datarow here"); cb.WhateverThatChangeSelectedIndexEventIs += ThatEventITalkedAboutUpAbove(); //I'm sure you can manage to place the combobox on the form in a more exact way... this.controls.add(cb); } Should be something like that.
-
base class?When you say associated with the class ChannelInformation what do you mean by that? And why not just pass the StreamWriter by reference into Join when you call it?
-
Custom type castingWhat you've set your code up to do is the ability to cast a bar to a foo; but you can't cast a foo to a bar unless it was already a bar to begin with that you had previously cast as a foo.
-
Exception of type 'System.Security.SecurityException' occuredIf i use demand on either of them then it won't build anymore. I get the following build error: Assembly generation failed -- SecurityAction type invalid on assembly. So I guess I can't demand it... --Peter