vb.net

404 page that displays requested page

I recently migrated a website to a new CMS (Umbraco). A lot of the links have changed, but they can be easily corrected by searching for patters in the url, so I would like to write something that will redirect to the correct page if the old one is not found. That part isn't a problem. How can I obtain the requested URL after the brows...

Generating an Excel file in ASP.NET

I am about to add a section to an ASP.NET app (VB.NET codebehind) that will allow a user to get data returned to them as an Excel file, which I will generate based on database data. While there are several ways of doing this, each has its own drawbacks. How would you return the data? I'm looking for something that's as clean and strai...

Getting the GUID of a VS 2008 tool window

Does anybody have a short code sample that can be run in the VS macro editor on how to enumerate the tool windows in VS 2008 and show the GUID for each one? Or do you know another way to find this out? ...

AddHandler/RemoveHandler Not Disposing Correctly

I have heard that calling AddHandler, but not calling RemoveHandler doesn't remove the handle to the event under certain conditions, leaving the control/object as active and not diposed, and thus leading to memory leaks. Is there any truth to this? Are there other causes to memory leaks that are solely available in VB as opposed to C#?...

(.net) How to support implicit type conversion as well as custom equality

Fixed: See notes at bottom I am implementing a generic class that supports two features, implicit type conversion and custom equality operators. Well, it supports IN-equality as well, if it does that. 1) if ( "value" = myInstance ) then ... 2) Dim s As String = myInstance 3) Dim s As String = CType(myInstance,String) The problem I ...

Linq to XML for KML?

I'm a LINQ to XML newbie, and a KML newbie as well; so bear with me. My goal is to extract individual Placemarks from a KML file. My KML begins thusly: <?xml version="1.0" encoding="utf-8"?> <Document xmlns="http://earth.google.com/kml/2.0"&gt; <name>Concessions</name> <visibility>1</visibility> <Folder> <visibility>1</visib...

Are there any 'ok' Image Recognition libraries for .NET?

I want to be able to compare an image taken from a webcam to an image stored on my computer. The library doesn't need to be one hundred percent accurate as it won't be used in anything mission critical (e.g. Police investigation), I just want something 'ok' I can work with. I have tried a demonstration project for Image Recognition fr...

DataReader within try block causing potential null reference error

There is probably is simple fix for this but I currently have code similar to dim dr as dbDataReader try dr = connection.getDataReader(sql_str) Catch ex as sqlClientException log.error(ex) finally if not IsNothing(dr) then dr.close end if end try However Visual Studio still warns me that the if not IsNothing(d...

Best way to get data from a DataReader into a Farpoint Spreadsheet?

I need to move data from a datareader into a Farpoint Spreadsheet component in a Windows form. The DataSource of an fps sheet can't be set to a datareader. I don't want to change my app to use ADO just for this purpose. Right now I'm looping through the query data and pushing it into the sheet cell-by-cell. That's ugly, and I am sure...

How to analyse 'noisiness' of an array of points

Have done fft (see earlier posting if you are interested!) and got a result, which helps me. Would like to analyse the noisiness / spikiness of an array (actually a vb.nre collection of single). Um, how to explain ... When signal is good, fft power results is 512 data points (frequency buckets) with low values in all but maybe 2 or 3 ar...

Can you use Java libraries in a VB.net program?

I'm wondering if a Java library can be called from a VB.net application. (A Google search turns up lots of shady answers, but nothing definitive) ...

How can I get an XElement's innertext in Linq to XML?

I'm trying to extract the polygons from placemarks in a KML file. So far so good: Imports <xmlns:g='http://earth.google.com/kml/2.0'&gt; Imports System.Xml.Linq Partial Class Test_ImportPolygons Inherits System.Web.UI.Page Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load Dim ...

Create MSBuild custom task to modify C# code *before* compile

I want to create a custom MSBuild task that changes my .cs files before they are compiled by csc.exe (but, of course, that doesn't modify them in place - I don't want actual source files touched). I am aware of PostSharp and other AOP frameworks for .NET and they are not an option for this particular project, plus I'd like to learn how ...

Custom Compiler Warnings

When using the ObsoleteAtribute in .Net it gives you compiler warnings telling you that the object/method/property is obsolete and somthing else should be used. I'm currently working on a project that requires a lot of refactoring an ex-employees code. I want to write a custom attribute that I can use to mark methods or properties that w...

minOccurs="0" on required parameters in WSDL on ASP.NET web service

I'm writing a simple web service using Microsoft Visual Web Developer 2005 (Express Edition), and the dynamically generated WSDL has a minOccurs="0" for all the parameters. How do I get minOccurs="1" for the required parameters without resorting to creating a static WSDL file? I need to do this using a ASP.NET Web Service (.NET v2). S...

I need help executing a bat file from asp.net 2.0

I have an web application using asp.net 2.0 and vb.net I wrote a bat file to use GPG to encryt a file and call it whithin asp.net shell(pathname & filename). when I double click on the bat file from cmd windows it works fine but when I call it in the application everything command that I pass is executed perfectly except the gpg command....

FIPS compatible password encryption for .NET

I've working on a WinForms in VB.NET (3.5) application that requires the user to enter domain administrator credentials. To make things easier on the user, they should only have to enter the user name and password once, and then just rely on my app to save these credentials. I'd like to save these credentials with the other user settings...

MyClass in VB.Net

What is a realistic use for VB.Net's MyClass keyword? I understand the technical usage of MyClass; I don't understand the practical usage of it in the real world. Using MyClass only makes sense if you have any virtual (overridable) members. But it also means that you want to ignore the overridden implementations in sub classes. It app...

Business Entity Loading Pattern

The project I'm working is using n-tier architecture. Our layers are as follows: Data Access Business Logic Business Entities Presentation The Business Logic calls down into the data access layer, and the Presentation layer calls down into the Business Logic layer, and the Business entities are referenced by all of them. Our busine...

VB.Net MessageBox.Show() moves my form to the back

I have an MDI application. When I show a message box using MessageBox.Show(), the entire application disappears behind all of my open windows when I dismiss the message box. The code is not doing anything special. In fact, here is the line that invokes the message box from within an MDI Child form: MessageBox.Show(String.Format("{0} sa...