vb.net

Converting a collection.foreach from c# to VB.Net

In C# i just put the method in the parentheses that i want to run on each row of the collection, but it isn't working in VB.NET. ex: SubSonic.PartCollection Parts; ... Parts.ForEach(TestMethod); I've tried this in VB.Net, but it's not compiling, and i'm not quite sure what I'm missing. Dim Parts as SubSonic.PartCollection ... parts....

How to code a button to get data from a table in database and display in datagrid view ?

I'm trying to code a button which has a SELECT statement to get information from one table but I want the information displayed in a data grid view. From the data grid view, this data will be stored in a different table within the same database. Previously i had used a list box to display the information but i could not save it in the ...

Access Pen Drive (MP3 Player) Via FileInfo ?

Hi I've got a Samsung Q1 attached to my computer, and I was hoping to use the FileInfo / DirectoryInfo objects to access the file on the device, however what I right click on a file in windows explorer I get a location of COMPUTER/Q1/DATACASTS/mine.mp3, and when I feed this into the DirectoryInfo object I get "Invalid network drive" So...

What does Setup Project do for .NET COM?

Ok, imagine the simplest solution in Visual Studio 2008 with framework 3.5 (OS = Win XP) where I have added a class library. Then I've added a COM Class. This COM Class is so simple, it only exposes 1 function: Public Function SayHello() As String Return " Hello." End Function I've build this class library, which produced the .dll and ...

Problem overriding methods in VB.NET (Error BC30284)

I have an overridable sub in my base class Project1: Public Class BaseClass Protected Overridable Sub MySub(ByVal Parameter as MyType) End Class Project2: Public Class DerivedClass Inherits BaseClass Protected Overrides Sub MySub(ByVal Parameter as MyType) End Class MyType is a type that comes from external COM library. W...

Change DNS Zone from secondary to Primary with WMI ChangeZoneType

Hi, Has anyone used the WMI ChangeZoneType DNS command in C#\VB.net before. I get an incorrect parameter exception when i try and invoke the changezonetype command. I get the dns zone that i want to change from the dns server (via query), set the zonetype to the appropriate uint value but am then getting the exception. I am trying to ch...

vs 2008 broken snippets functionality

Is there a way to reset to the original vb.net snippets that came along with visual studio 2008? I recently installed a purchased third party lib, that managed to break almost all the default snippets. I can see that the snippets do physically exist in C:\Program Files\Microsoft Visual Studio 9.0\VB\Snippets\1033 but only the followi...

Suppressing obsolete warnings in VB.Net

I have VB.Net code in VS 2008 using an obsolete method, and would like to suppress the warning. Unfortunately, following the recommendation is not a good solution, because it requires using a different class, which works differently, in important ways. I'm trying to suppress the warning using System.Diagnostics.CodeAnalysis.SuppressMessa...

With VB what does putting "()" after a word do?

what does putting "()" after a word do? sometimes it doesn't work ...

How to append one DataTable to another DataTable

I would like to append one DataTable to another DataTable. I see the DataTable class has two methods; "Load(IDataReader)" and "Merge(DataTable)". From the documentation, both appear to 'merge' the incoming data with the existing DataTable if rows exist. I will be doing the merge in a data access layer. I could could usa an IDataReader ...

Get table Id in code in .Net

I have two tables on a webform. On a button click I want to hide one and show the other. I gave them both an Id and I want to set the tables' style="display:" I tried this in javaScript using a function and document.getelementbyid(id).style.display='none' but it did not work. any ideas? Solution: OnClientClick="javascript: tbl2.styl...

how to convert this line into vb.net

from the free dinner book for asp.net MVC [AcceptVerbs(HttpVerbs.Post)] public ActionResult Edit(int id, FormCollection formValues) { Dinner dinner = dinnerRepository.GetDinner(id); UpdateModel(dinner); dinnerRepository.Save(); return RedirectToAction("Details", new { id = dinner.DinnerID }); } how to convert this line...

Detecting Installed Excel Version (and Service Packs)

Hi all I need to be able to detect which version of Excel I have installed in my machine from some .NET code I'm developing. I'm currently using Application.Version for that, but it doesn't give me information about Service Packs. I would preferably to steer away from something like this: http://www.mvps.org/access/api/api0065.htm Ma...

Beginning unit tests long after the project has begun?

I have taken on a project that has been underway for months. I've yet to ever do unit tests and figured it would be a decent time to start. However, normally unit tests are written as you go and you plan for them when beginning the project. Is it reasonable for me to start now? Are there any decent resources for setting up unit tests...

LINQ To XML Syntax for XML Element with Attributes

Hello, I'm a bit of a LINQ newbie and I was having some trouble with the following. I'm trying to perform a query using LINQ on an XML file and store the results in a list of DataClass objects that match the XML. I've got an XML file that is defined like this: <NewDataSet> <NewDataTable> <Field>Accepted ASNs</Field> <Va...

Get a listbox's selected items in javascript

I have two listboxes in asp.net. On the click of a button I want to load a list box with the elements of the selected items in the other box. The problem is that this has to be done on the client side because when the button is clicked I don't allow it to submit. I want to call a javascript function onselectedindexchange but that is serv...

C# Keywords as a variable

In VB.NET, you can surround a variable name with brackets and use keywords as variable names, like this: Dim [goto] As String = "" Is there a C# equivlent to doing this? ...

Want to enumerate Outlook folders

I'm looking for some code (C# or VB.NET preferred) to iterate through all folders in an Outlook mailbox and return the names of those folders. I'm not looking to pop up the Outlook folder dialog, but rather to return the folder names in a given mailbox from outside Outlook. Thanks ...

focusing textbox in the rightmost digit

how do i code this in vb.net: focus the textbox and get the cursor to the rightmost digit? ...

Fastest casting in VB.NET with a known type?

When I have many controls on a Form (i.e. Label, Button etc) that do almost the same thing, I often use one method to handle all the controls Click, MouseDown, MouseUp events. But to know which of the controls throwing the event and access the properties of that control I need to cast the "sender" object to the correct type. The thing ...