vb.net

Which is more efficient Cstr(value) or value.ToString()

I am wondering which is more efficient, using CStr() or object.toString(). The reason I ask this is because I though all that CStr() done was to invoke the .ToString() method on the object it was dealing with. But when recently using a generic method without any type constraints I had to use object.ToString() instead of CStr(object), th...

Unstructured Exception Handling in VB.NET 2005/2008

I have a few VB.NET programs to maintain, that have been ported from VB6 and use the old style Unstructured Exception Handling: On Error GoTo yyy My question is, can I still get a stack trace while using Unstructured Exception Handling, or do I have to convert them all to Structured Exception Handling (Try/Catch) in order to catch an ...

How to deploy my asp.net project in IIS ?

I have windows 2003 server , and a asp.net project developed in VS2008 developer edition how to deploy this website in the server? ...

Finding the Uptime of a server programatically

Does anyone know of a way to programatically find the uptime of a server running Windows 2000? We have a service running on the machine written in VB.NET, that reports back to our server via a webservice. ...

Custom multithreading loop

Hi, I am looking into using a producer\consumer threading pattern to run through a list of strings that i retrieve from a database and then am going to run powershell commands against. As the powershell commands can be quite intensive i only want to spawn 3 threads at a time and then wait for one thread to finish before doing anymore. I...

Convert C# to VB.Net - Using MVCContrib Blockrenderer to render a partial view to a string

I need to render a partialview to a string, and I am trying to convert a C# example to VB.Net, as I am stuck with that for this project. This is causing me a headache from these two problems: ObjectViewData - I can't figure out what that is RenderPartial is a sub, but seems to be used as a function - I don' get it I reference the MV...

Unexpected behavior between master page, Global.asax, server.transfer

In my Global.asax file, I have an Application_BeginRequest subroutine that ensures that a user's "Active" attribute is set to true on each request. This is simply to determine whether the user is enabled or disabled. If the attribute is set to false we transfer (using Server.Transfer) the user to an authorizationRequest page. This p...

How to post a file via HTTP post in vb.net

Hi all! Having a problem with sending a file via HTTP post in vb.net. I am trying to mimic the following HTML so the vb.net does the same thing. <form enctype="multipart/form-data" method="post" action="/cgi-bin/upload.cgi"> File to Upload: <input type="file" name="filename"/> <input type="submit" value="Upload" name="Submit"/> </form...

Lambda expression from C# to VB.Net

What would this line of C# using Lambda expression be in VB.Net? string s = blockRenderer.Capture(() => RenderPartialExtensions.RenderPartial(h, userControl, viewData)); Something with function of - but I can't figure out exactly how... ...

Is it possible to iterate over two IEnumerable objects at the same time?

If I have a List(Of x) and a List(Of y) is it possible to iterate over both at the same time? Something like for each _x as X, _y as Y in List(of x), List(of y) if _x.item = _y.item then 'do something end if next These lists may be of differing sizes. I am using .Net2.0 which I suspect is my downfall here as I ha...

How to Intersect two Arrays?

I'm working with VB.Net, and have two one-dimensional Arrays. Is there an Inbuilt function for finding the elements that are common to both of them? Or do I have to write one for myself? ...

Database connections work fine when application is run from localhost. Login fails from dev server.

I have an application which connects to a database, retrieves a username from a user's table and matches it against the username retrieved with System.Security.Principal.WindowsIdentity.GetCurrent.Name On my localhost, everything works fine. The database exists on the development server but the application lies on my localhost. All of...

LINQ to Objects - Does Not Contain?

I have a collection of Items that each have a collection of Relationships. I have a list of Groups that Items can have Relationships with. I can find all the Items that have a particular relationship but I now want to find all the Items that don't have a Relationship with any of my Groups. I can find the Items that have a relationship...

Webclient.Uploadfile

I have an app that uploads files to server using the webclient. I'd like to display a progressbar while the file upload is in progress. How would I go about achieving this? ...

VerificationException Operation could destabilize the runtime on Simple LINQ Query

Here's the problem. The code below works fine on my development PC, but when I deployed the app, it crashes. Here is the lines of code that are relvant Private TdsTypesList As List(Of TDS_Type) ... TdsTypesList = (From tt In db.TDS_Types Select tt).ToList This is the error I get Exception Source: Anonymously Hosted DynamicMeth...

Regex Extract html Body

How would I use Regex to extract the body from a html doc, taking into account that the html and body tags might be in uppercase, lowercase or might not exist? ...

Clearing DrawRectangle in Windows Forms

I am drawing a rectangle, sleeping for a few milliseconds--then I want to clear the rectangle, but I can't figure out how. (The rectangle is sitting over a graphic so I can't simply cover it up with another rectangle) graphics.DrawRectangle(p, innerRectangle) System.Threading.Thread.Sleep(75) ...

VB.Net Iniatialising a class using System.Reflection and System.Type to create a session based singlton extension method.

I have had several occasions recently to access a specific class several times over a relatively small time frame. So I've been storing the value of the class in Session and trying to access it on page load, if it's not available creating a new instance and storing that in session. So instead of constantly replicating the same code for...

Why does my form crash when I change my custom control?

I have created a custom control that is included in a control library that is referenced by a VB Forms application. When I modify the control, and have the application open in a VS window, VS usually asks me if I want to reload items that have changed. However, a couple of times, it has not asked me this, and when I go to open the form...

Exporting Excel Data into Oracle Table using VB.NET

I am trying to export an excel file directory into an Oracle table as opposed to looping through the range and executing a lot of insert statements. I would think that there are better ways to accomplish this in .NET but I can't seem to find any other answer besides convert excel to csv & load it using Sql Loader or External Table. Does ...