.net-2.0

Mantain a control position fixed when scrolling a panel

Hello. I have a label label1 in the middle left of a large custom panel panel2 that is scrolled in a parent panel panel1. I would keep the label1 always in the visible left middle of the panel2, even when scrolling. In the real example, my panel is a user control that generates the some labels in its left side. The panel scrolls, b...

Is there a .Net 1.1 compatible String.GetHashCode implemented in .Net 2.0 code?

I have an existing app in which I made the mistake of using String.GetHashCode and persisting it to disk. Now that I'm upgrading the app to .Net 2.0 I find that that decision has come back to bite me in the butt. I'm interested to know if anyone knows about a .Net 2.0 implementation of a .Net 1.1 compatible string hashing algorithm. O...

Reordering items in an ASP.net Listbox on the client, and then recognizing this on the server.

I've got an administrative page with a listbox filled with values. A user can also change the order of the values via some jquery, and in theory we'll save that order and it will change the order of display in a listbox in some other, exotic, locale. The jquery works fine. When the user saves I use this code to process the listbox: i...

TCP Server and MemoryStreams/ByteArrays

I've got a TCP server written in C# that processes POST data sent to it. Currently it works fine unless a large amount of data (i.e. greater than 1GB) is sent to it then it runs out of memory (I store it all in memory as an array of bytes (with a intermediary of a List DTO)). For large files now I stream down to disk and then pass the fi...

Need I remove controls after disposing them?

.NET 2 // dynamic textbox adding myTextBox = new TextBox(); this.Controls.Add(myTextBox); // ... some code, finally // dynamic textbox removing myTextBox.Dispose(); // this.Controls.Remove(myTextBox); ?? is this needed Little explanation Surely, if I Dispose a control I will not see it anymore, but anyway, will remain a "Nothing"...

First 6 from a foreach .net 2.0

Hi I need to sort a list then take the first 6 in .net 2.0 for example the code below sorts but does not take the first 6 how can i do this? allFeeds.Sort(delegate(SimplifiedFeedItem p1, SimplifiedFeedItem p2) { return -p1.PublishDate.CompareTo(p2.PublishDate); }); allFeeds.ForEach(delegate(SimplifiedF...

Updating an ASP.NET iFrame without a page refresh using Actionscript 3

I would like to have a FLEX SWF Menu in .NET that is animated, and use button clicks to update an iFrame in an .NET 2.0 Ajax enabled application without a page update or refresh. If I use URLVaribles in Flex, The only way I've gotten to them to ASP.NET is via URL Page Navigation which always refreshes the screen. There is a LOADVARS fun...

ASP.NET 2.0 Custom Profile Class Question

Hi. I am attempting to design a custom profile class that allows me to access the aspnet tables in addition to my custom tables (all in the same DB). I have been following two online examples that describe how to wire up a custom profile class. In this example, I am asked to inherit from ProfileProvider How To Implement A Custom Pro...

Static reflection with Visual Studio 2008 targeting .net 2.0 ?

Is there a trick to use static reflection with Visual Studio 2008 targeting .net framework 2.0 ? ...

Howto determine order of displayed columns in a datagridview binded to a datasource

Is there a way to determine the order of the columns displayed in a datagridview when binding it to a datasource whitch contains an underlying IList ? I thought there was a specific property attribute for this purpose but can't recall what it actually was. eg: public void BindToGrid(IList<CustomClass> list) { _bi...

StringFormat flags : display the whole line

the StringFormat flags permits to differently represent a string in a rectangle. in this example was used string_format.FormatFlags = StringFormatFlags.NoClip one: Question having txt = "The quick brown fox jumps over the lazy dog." can I represent this text entirely as a single line (non-clipped and centered). I mean, I use ...

How to skip the loops coditions for getting functionality

Here is a bit of code foreach (DataModelObject dmo in allObjects) { if (dmo is IResourcePolicy) { if (string.Compare(dmo.Name, hostName, true) == 0) { IResourcePolicy irp = (IResourcePolicy)dmo; irp.ResourcePolicy = rp; irp.AgentPolicyVersion.Version = Convert.ToInt64(poli...

Return StreamReader to Beginning

I'm reading a file in line-by-line and I want to be able to restart the read by calling a method Rewind(). How can I manipulate my System.IO.StreamReader and/or its underlying System.IO.FileStream to start over with reading the file? I got the clever idea to use FileStream.Seek(long, SeekOffset) to move around the file, but it has no e...

Detect inserted row dataadapter

I'm trying to detect a new row in the database with a dataadapter, so I can trigger some events. It would be easy if I could use a timer(but I can't) ...

Reference a .net 3.5 assembly in a Script Task in SSIS 2005?

I've got this to work using a very basic example(outlined below) and I want to see if other SOers have experience doing what I'm attempting...using a 3.5 framework assembly in a Script Task in SSIS 2005. I've basically followed the page found here... except I targeted the 3.5 framework while in Visual Studio 2008. Write/compile your c...

Workaround for String.Contains() in C# .NetCF 2.0?

There is a string method called Contains. It allows you to quickly search a string for another string. I need to use this in a .netcf 2.0 application but per MSDN it does not come available until the 3.5 framework. Can anyone offer a work around (C#)? TIA Noble ...

Escape special characters

Hi, My code below seems to be encoding special charcters how do I get it to escape these? str1 += myGridView.Rows[idx].Cells[2].Text + ";"; When i check the grid view html source the table cell text is = 'http://news.google.co.uk/nwshp?ie=UTF-8&amp;hl=en&amp;tab=wn&amp;q=Clifford+Chance&amp;output=rss' But the value for str1 is 'ht...

Fastest way to find an item in a list?

I have an unsorted list of strings. I can place these items in an array, List, SortedList, whatever. I need to find the fastest way of looking up a string in this list. Am I better off dumping the list into an array, sorting it, then implementing binary search? Or does the framework provide a way to do this? Thanks P.S. Using VS200...

How can I format a value as a percentage without the percent sign?

float f = 0.479f; Console.WriteLine(f.ToString("p1")); The output: 47.9 % What should I pass to ToString() in order to remove the percentage sign for output like this: 47.9 EDIT. I should have mentioned that I am passing the mask to a 3rd party component that does it's thing with it. I can't perform any acrobatics with the num...

Programatically set margins in report viewer control

Hi, In onw of our application, we have some reports that need very specific margins that are dependant of the printer the user have. It is used to print into preformated paper with blanks to fill and depending of the printer, the printing is off by some margins. To make things worse, we don't actually control what printer is used becaus...