vb.net

How do you pass an array of string through an event in an Interop User Control to vb6

I have a VB.net control that has an event: Public Event PassNames(ByVal names() as String) When the event triggered in VB6, I get the following error: "Function or interface marked as restriced, or the function uses an Automation type not supported in Visual Basic" Here is the event in VB6: Private Sub IteropControl1_PassNames(ByV...

What is the maximum length allowed for window.returnValue property? (JavaScript)

Is there a maximum length when using window.returnValue (variant) in a modal? I am calling a modal window using showModalDialog() and returning a comma delimited string. After selecting a group of users, I am putting them into a stringbuilder to display in a literal. Dim strReturn As New StringBuilder strReturn.Append("<script type=...

How to add XML serialization instructions without modifying the class

Is there a clever way of adding XML serialization instructions without modifying the serialized class? I don’t like the default serialization and I can’t modify the class. I was considering inheriting the class, and using Shadows (VB.NET) to re-implement the properties (with the serialization instructions), but it results in a lot of du...

Sum and Group By in Linq to SQL?

Just getting started with Linq to SQL so forgive the newbie question. I'm trying to reproduce the following (working) query in Linq to SQL (VB.NET): Select f.Title, TotalArea = Sum(c.Area) From Firms f Left Join Concessions c on c.FirmID = f.FirmID Group By f.Title Order by Sum(c.Area) DESC (A Firm has many Concessions; a Conc...

C# and VB.NET operator precedence

Looking at the C# and VB.NET language specs I think it says that the logical Xor/Or/And operations have different precendence in the two languages. Am I reading that right? I was expecting them to have the same precendence. For example in C# 100 | 200 ^ 300 & 400 is the same as... 100 | (200 ^ (300 & 400)) But the equivalent VB.N...

COM class factory error

I've been testing an application using my machine as a server, and everything's going fine with it, but when I try to set it up to run on the test server, I get this error: Retrieving the COM class factory for component with CLSID {XXXX} failed due to the following error: 80040154. Any ideas? Thanks ...

VB.NET COMException Error

I have written an application in VB.NET using MS Visual Studio 2005. I am using .NET version '2.0.50727'. The application was running without errors until recently. After being used for a while it begins to produce a System.Runtime.InteropServices.COMException error (80080005). The error happens when I make a call to produce an instance ...

Is there a benefit to JUST a "throw" in a catch?

Been having a "heated debate" with a colleague about his practice of wrapping most of his functions in a try/catch but the catch has JUST a "throw" in it e.g. Private sub foo() try 'Do something' catch throw 'And nothing else!' End Try End Sub My thought was to not even bother (assuming you don't need to do...

How can tooltips be added to a vb.net winforms datagrid row(s)?

I'm looking to add a tooltip to each row in a bound datagrid in vb.net winforms. How can this be done? ...

Join arrays in VB.net

What's the simplest way to join one or more arrays (or ArrayLists) in Visual Basic? I'm using .NET 3.5, if that matters much. ...

Using 256 x 256 Vista icon in application.

Hi all, I have an application which I have made a 256 x 256 vista icon for. I was wondering how I would be able to use the 256x256 png in the ico file used as the application icon and show it in a picture box on a form. I am using VB.net but answers in C# are fine. I'm thinking I may have to use reflection. EDIT! Not sure if this ...

Finding Min and Max Vaules In an array using vb.net

Hey, I need to find the min and max vaule on an array. The .max function works but .min keeps showing zero. Public Class Program_2_Grade Dim max As Integer Dim min As Integer Dim average As Integer Dim average1 As Integer Dim grade As String Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As Syst...

Guidelines for using the ASP.NET Wizard efficiently

A web app our group has put together uses the ASP.NET Wizard control. Each step in the wizard contains a corresponding custom UserControl. The trouble is that as you go through the wizard steps, all the UserControls are loaded on each step, rather than just the one used in that step. That doesn't seem right to me. So...is there anybo...

Option Strict On and .NET for VB6 programmers

Hi, I'm preparing a class on Visual Basic 2005 targeting Visual Basic 6 programmers migrating to the .NET platform. I would like a word of advice about whether to recommend them to always enable Option Strict or not. I've worked exclusively with C-style programming languages, mostly Java and C#, so for me explicit casting is something I...

Scaling WPF content before rendering to bitmap

Background: I'm working on a silverlight (1.0) application that dynamically builds a map of the United States with icons and text overlayed at specific locations. The map works great in the browser and now I need to get a static (printable and insertable into documents/powerpoints) copy of a displayed map. Objective: In order to get a p...

handling dbnull data in vb.net

I want to generate some formatted output of data retrieved from an MS-Access database and stored in a DataTable object/variable, myDataTable. However, some of the fields in myDataTable cotain dbNull data. So, the following VB.net code snippet will give errors if the value of any of the fields lastname, intials, or sID is dbNull. dim ...

How to Persist Variable on Postback

I created a single page (with code behind .vb) and created Public intFileID As Integer in the Page load I check for the querystring and assign it if available or set intFileID = 0. Public intFileID As Integer = 0 Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load If Not Page.IsPostBack The...

How do I write objects for easy XML Serialization in VB.NET?

I'm writing a small application in VB.NET and I would like some of the classes to be able to write themselves out to XML to serve as a "save" feature. I have seen XSD files used to generate VB classes that can serialize themselves into and out of XML very easily. How would I do this if I do have any pre-existing XML format that I need ...

History of VB.NET Nullable syntax

I can't find a definitive answer. Since C# 2.0 you've been able to declare int? i = 125; as shorthand for Nullable<int> i = Nullable<int>(123); I recall reading somewhere that VB.NET did not allow this shortcut. But low and behold, I tried it in VS 2008 today and it works. Does anyone know whether it's been this way since .NET 2...

Update columns in one LINQ object with another LINQ object.

Hi all, I have two LINQ objects which have exactly the same columns and I would like to be able to update one with the fields from the other. I first create a new object from some data in a file, then I query the database for an existing item with the same ID. What I would like to be able to do is update the existing objects details w...