vb.net

VB.NET - Is there a way to utilize optional parameters in delegates? (Or Plans to Allow this?)

It is my understanding that it is not possible to have an optional parameter in a delegate in the version of VB that ships with VS2008. However, I am wondering if there are any workarounds or plans for incorporating this feature into VB.NET in the future? What I'd like to do: Public Delegate Function Deserializer(Of T)(ByRef Buffer()...

Object reference not set to an instance of an object with a class with an array of classes as a member

Here is the structure that I have: Friend Class StandardFormatFile Friend fileType As String Friend numberOfSeries As Integer Friend standardSeriesData As New ArrayList End Class Friend Class StandardFormatFileSeries Friend standardNumOfElements As Integer Friend standardSeriesName As String Friend standardDat...

Good way to format data in a large DataTable

I have a large data.DataTable and some formatting rules to apply. I'm sure this is not a unique problem. For example, the LASTNAME column has a value of "Jones" but my formatting rule requires it be 10 characters padded with spaces on the right and uppercase only. Like: "JONES " My initial thought is to loop through each row and...

Disable copy/paste menu popup on textbox?

Using winform w/vb.net. When I have form w/a textbox and one right-clicks on the textbox a context menu pops up w/copy/paste options. How do I disable this from poping up (I want to use the right-click for my one function)? ...

How to disable caching in the .NET WebBrowser Control?

I have been googling for hours and trying to figure this out, and I just can't. I have 1 webbrowser control on a form, webbrowser1. Once I load a page, say google.com, if I use webbrowser1.refresh() or webbrowser1.navigate("google.com"), it's not reloading the page, it has it cached so it's just reloading the cache. This is terribly appa...

play video in silverlight?

How do yo play a video with silverlight? does Visual Studio come with a video player component build in? or do I need to make a video player? ...

C equivalent getevn/setenv in VB.NET

Hello EveryOne Is there equivalent for getevn/setenv functions in VB.NET. I have looked at system.Environment.GetEnvironmentVariable but it gives the system environment variables like USERNAME, COMPUTERNAME etc. I need to get the variables that are stored in config.user file. Is there any way to do that in VB>NET. Please help me out. Th...

Why is Date1.CompareTo(Date2) > 0 faster than Date1 > Date2?

Another "unimportant" performance question. Unimportant because mostly code-readability is much more important than a few milliseconds, but interesting anyway. I noticed that there are differences between different DateTime Comparisons. I checked 3 alternatives: Dim clock As New System.Diagnostics.Stopwatch Dim t1, t2, t3 As Lo...

How Can I Create a PDF Quotation File from Winform?

Assuming i have a winform that has a button called "Create a Quote". Once user clicks it, a PDF File gets created on desktop. The PDF File has a fixed design/structure e.g. the logo is at the top left corner, the headers are fixed, etc. However, the data it self is pulled from a database. As you see above, Quotation #, Description, Qt...

VB.NET Remove user from active directory

Hi I am trying to create a VB.NET application which will (hopefully) reduce some time spent on some of my departments helpdesk calls. The part that I am stuck with is how to use VB.NET to remove a user from a group. The following is code that I have been playing with: Public Shared Sub RemoveUserFromGroup(ByVal deUser As String, ByVal...

Enum value not serializing correctly when converting a Generic.List(Of CustomClass) to XML

I have a Generic.List(Of ImportedVehicle) - ImportedVehicle being a simple class as below. There is an enum property which is marked as public. When I serialize to XML using an XMLSerializer, the enum's value is just set to it's default value (which is NotAllocated) and doesn't actually represent the value that is set in code. Any ide...

Should I use (otherwise optimal) class names that conflict with the .NET BCL's names?

This situation probably is not entirely uncommon to some of you: you have some functionality to put in a class but the perfect name (*) for that class is taken by one of the classes in the System namespace or other namespace/class that's not yours but you're using/importing. (*) By perfect I mean small, concise and clear names. For ins...

Generating/registering client-side scripts on ASP/VB.NET

I am currently in the process of converting old "Web 1.0" code to meet current standards. Is there a better way to generate and append a client-side script other than appending a plethora of lines to a StringBuilder and then registering it to the page via ClientScript.RegisterStartupScript(Me.GetType(), "startUpScript", strScript)? Is ...

Custom HTTP error page

In asp.net, I can define a custom error page like this: <configuration> <system.web> <customErrors mode="On"> <error statusCode="404" redirect="/servererrors/404.aspx" /> </customErrors> </system.web> </configuration> Now my question: If I replace, say 404.aspx with AnyHTTP.aspx, and want to get...

Quick clarification about when I have to remove handlers in .Net, VB.Net

If I have a class with a couple of event handlers inside of it which are attached to an object that is defined within the class, am I right in thinking that I don't need to implement IDisposable to remove said handlers, even if I explicitly added the handlers myself? Also, can anyone point me in the direction of an article that explains...

vb.net linq to xml syntax for documents with xml namespace

I'm trying to grasp the linq to xml 'inline query syntax' features of VB.Net First I tried with this simple xml file: <?xml version="1.0" encoding="utf-8" ?> <Root> <Child Name="somename"> <SomeAttribute>SomeValue</SomeAttribute> </Child> </Root> This xml, when loaded in an XDocument, can be loaded...

NPOI Excel number format not showing in Excel sheet in asp.net

I am trying to create double and number format cells in excel using NPOI library. I used code like Dim cell As HSSFCell = row.CreateCell(j) cell.SetCellValue(Double.Parse(dr(col).ToString)) In excel numbers are aligning right but when I check format it is showing in "General" then I changed my code to like below Dim cell As HSSFC...

Advice on entering the world of Visual Studio 2010 (vb) and SQL Server

I'm looking for specific and current advice from professional .NET + SQL Server developers on: best way to get up to speed best reference materials or books to use any pitfalls to watch out for I'm starting a new position next week in which I will be developing advanced accounting software (LAN software) using Visual Studio 2010, Vis...

How do I reference Session.Contents form a class?

This is an ASP.NET 2010 web app written in vb. I use several Session variables. I want to pass them all to a central class and let the class manage them. However, I am having some trouble. Here is the code on the calling page: Dim arrGoodSessions() As String ={"nameofsession1", "nameofsession2", "nameofsession3"} Utilities.ManageSessi...

Is there a performance benefit to explicitly using System.IO instead of importing it?

I have a VB file that imports System.IO, but only uses it is a couple of places. My co-workers and I were wondering if there is a small performance boost if we just use System.IO explicitly were we need it (IE., System.IO.MemoryStream) instead of importing it. ...