vb.net

Initialising object variables in VB.Net

In VB.Net is there any difference between the following three ways of initialising object variables Method 1 Dim commandObject As SqlCommand commandObject = New SqlCommand("MadeUpCommand") Method 2 Dim commandObject As SqlCommand = New SqlCommand("MadeUpCommand") Method 3 Dim commandObject As New SqlCommand("MadeUpCommand") Is...

Try catch in assert statement

I am doing regression testing using NUnit, WatiN and VB.net. What i am doing is opening an IE page, seleting some data, making a registration and then on view registration page testing the registration by assertion. I want to ask is it a good way to use try and catch on every assert. i am using it because if some assert fails it will st...

Add XML Namespace attribute to 3rd party xml?

Hi there I'm using VB 2008 and I'm trying to add a xmlns="mynamespace" attribute to an XDocument's root element. The XML document is created by a 3rd party, and I have loaded it into a VB XDocument object. As it comes, it has no namespaces. I have been working on a local copy and I added in a namespace in a text editor, so that I can u...

A recursive way to display Exception Messages in ASP.NET

Hello, I have started to make heavy use of exceptions, I'm sure I'll grow out of it as a learn the advantages and disadvantages the hard way, but until I've become an exception guru I'd like to know if this technique is acceptable. I intend to wrap, say a database exception in my own 'SorryFailedToSaveYourData' exception and then recur...

VB.NET Single statement across multiple lines

Is there any way to have a statement across multiple lines without the underscore character? It is really annoying in multi-line strings such as SQL statements, and especially LINQ queries. Beside from the ugliness and difficulty when changing a line (nothing lines up anymore) you can't use comments in the middle of the multi-line sta...

What is the best VB.NET control (standard/custom) for displaying list of files?

I'm developing a Desktop Search Engine in VB.NET and I'm looking for a powerful, flexible and feature-rich control for displaying the search results i.e. list of files. ...

Get File Icon used by Shell

In .Net (C# or VB: don't care), given a file path string, FileInfo struct, or FileSystemInfo struct for a real existing file, how can I determine the icon(s) used by the shell (explorer) for that file? I'm not currently planning to use this for anything, but I became curious about how to do it when looking at this question and I thought...

VS2008 targeting ASP.net 2.0: Project-level imports warning

I have a web app built against asp.net 2.0, but keep getting the following warning: Namespace or type specified in the project-level Imports 'System.Xml.Linq' doesn't contain any public member or cannot be found. Make sure the namespace or the type is defined and contains at least one public member. Make sure the imported element name d...

What is the best way to stream video via a website built with ASP.NET?

I am looking for everyone's opinion on what is the best way to stream video from a website built with ASP.NET. Some notable items include: The ability to stream .avi, .mpg, and possibly .wmv files The ability for someone to upload a video directly to a shared server and have it stream without any additional work needed (no compression...

Shadows vs. Overrides in VB.Net

Would some OO guru mind explaining the significance of these two keywords--what they do and for which context is one or the other preferable? ...

Delete Single Message MSMQ

Hi Is it possible to delete a single message from a MSMQ message queue ? I have a Queue object, a message (object) that I have got to by peeking and the ID of the message, I can see a way of deleting (or purging) the entire queue, but I can't see a way to delete the message on it's own, I've tried receiving the message once I have found...

add AxWEBBrowser in my toolbox

How can I add AxWEBBrowser in my toolbox? I tried to customized my toolbox by TOOLS -> Customized toolbox -> Com components - > but i didnt found any AxWEBBrowser. I also include in my reference the AxInterop.SHDocVw and Interop.SHDocVw. What else i need to do to add AxWEBBrowser? Thanks.. ...

Workaround to see if Excel is in cell-edit mode in .NET

I have an application written in VB.NET that interacts with Excel via interop. I eventually ran into the known issue of Cell-edit mode (see MSDN and stackoverflow for some background). I have been trying to convert the suggested code to VB.NET but keep getting the following error: Reference required to assembly 'office, Version=11.0....

Getting Error System.Runtime.InteropServices.COMException

Hey All, I am using Vb.Net to Create Labels in Microsoft. For that i am using below mantioend Code. Public Sub CreateLabel(ByVal StrFilter As String, ByVal Path As String) WordApp = CreateObject("Word.Application") ''Add a new document. WordDoc = WordApp.Documents.Add() Dim oConn As SqlConnection = New SqlConnection(con...

[VB.NET] What is the best way to display HTML content on a Windows Form?

I want to display an HTML formatted content in my application preferably inside a Web Browser control. I could create an HTML document first and then load it in the Web Browser control, but that is just too clumsy. Is there any way I can load a string that contains HTML code directly into the Web Browser? String = "<b>Hello</b> World" ...

What is the best way to parse Microsoft Office and PDF documents?

I'm developing a Desktop Search Engine using VB9 (VS2008) and Lucene.NET. The Indexer in Lucene.NET accepts only raw text data and it is not possible to directly extract raw text from a Microsoft Office (DOC, DOCX, PPT, PPTX) and PDF documents. What is the best way to extract raw text data from such files? ...

is it a good idea to create an enum for the key names of session values?

instead of doing session("myvar1") = something session("myvar2") = something session("myvar3") = something session("myvar4") = something is doing enum sessionVar myvar1 myvar2 myvar3 myvar4 end enum session(sessionVar.myvar1.tostring) = something session(sessionVar.myvar2.tostring) = something session(sessionVar....

How do display the Integer value of an IPAddress

I was looking at the System.Net Namespace and it has an IPAddress instance you can use. This has a Parse method which you can use to parse a string into an IPInstance then use the Address property to give you the long value. However... The number returned is NOT the true conversion. e.g. For IP 58.0.0.0 , the System.Net namespace give...

VB.NET Queue constructor Error: Queue grow factor must be between 1 and 10.

First some background: VB.NET 2005 Application that accesses a MS-SQL back-end, using multiple Web Services for data gathering/publishing. On to the error: Our application mysteriously crashes on one of our clients computers, it works fine on the other computers in their office, but not on the big whigs' computer, which now makes it my...

Getting row index from an ImageButton click in a GridView

I have a Gridview with ImageButtons added to a column via a templatefield. I've attached a function to the "OnClick" event. Once in this function, how can I get the index of the row that has the button that has been clicked. It appears that all I have is the mouse coordinates on the page. ...