vb.net

.net - For Each Obj as MyObject in MyArray -- Is this doable without implementing anything?

I'm using VS2008. Is the following OK to do the following VB.NET with a very simple class (see below)? for each CurrentObject as MyObject in MyArray 'access current object next The "simple class": Class MyObject public I as integer end class I seem to remember that something about needing iEnumerable, but my compiler isn't com...

.NET - What is the best/correct way to iterator through a List and remove misc. members?

In C++ using std::list, this is a simple matter of erasing what an iterator is pointing to (the erase statement returns the next valid member of the list). What's the best way to iterator through a list and remove members that match a certain criteria? ...

.NET containers - when are members By Reference, By Value?

I migrate between C++ and VB.NET in my coding ventures... which leads to the occasional confusion about when something is by value or by reference in VB.NET. Let's say for example that I have an array of MyObject which is populated with a bunch of objects. dim MyArr(5000) of MyObject Now let's say that the information from this array...

How to start multiple process shell commands in VB.NET 2008

I need to open several pdf, word and excel files from process.start like command, but only open one file at time. ...

Portforward SQL Server?

Hello I haven't done SQL in a while, so I need to freshen up on things. I have a SQL Database running on my computer, and my server is localhost. I made an app in VB.Net that connects to this database. Everything works fine and all, until I distrubute my app to another person. When they try to connnect it doesn't seem to work for them....

Windows Media Player Device Sync in VB.NET using WMPLIB

The MSDN documentation for WMPLIB states that syncing to device is not supported in .NET programming, only C++. Is there, however, a simple wrapper class or DLL that can be used to interface between a .NET program and the nescessary C++ code? Or is there a better way to sync files to a device using VB.NET? Are all devices suited/compat...

Renaming Directory with same name different case

I am trying to rename a directory in c# to a name that is the same only with differing case. For example: f:\test to f:\TEST I have tried this code: var directory = new DirectoryInfo("f:\\test"); directory.MoveTo("f:\\TEST"); and I get a IOException - Source and destination path must be different. I have also tried Directory.Move()...

Using KeyValuePair in VB.NET for a reverse lookup capable dictionary (example hint in C# needs converting)

Hi, I'm currently on a VB.NET project and wish to use a KeyValuePair to facilitate a reverse lookup. I've found a great example in C# here: http://www.dreamincode.net/forums/showtopic78080.htm, however I am having a small problem converting to VB.NET (both manually and using a translator (online carlosag)). For example the syntax I woul...

VB.net Setup Issue

Hi, While creating the setup for VB.net application I am getting the following warning: "Warning 1 'msado15.dll' should be excluded because its source file 'C:\Program Files\Common Files\System\ado\msado15.dll" is under Windows System File Protection. Please suggest me how to over come this type of issue. Thanks, ...

Allowing only past date and today's date in VB.net

Hi, I am using VB.net as well as Jquery Datepicker for getting dates. In my VB.net code <tr> <td> DateOfReceiving: </td> <td colspan="3"> <asp:TextBox ID="DateOfReceivingTextBox" runat="server" CssClass="pastdatepicker" Text="DateOfReceiving" /> </td> </tr> I want to allow enter user only todays date ...

Convert a subnet mask into binary (octets) in vb.net

How can I convert a subnetmask into binary, so I'll end up with 32 digits? I can convert it into Binary, using Convert.ToString(Long-to-convert, 2) But a subnetmask of 255.255.255.0 returns(it returns it without the spaces though): 1111 1111 1111 1111 1111 1111 0 When I want it to be: 1111 1111 1111 1111 1111 1111 0000 0000 ...

Adding icons to application

Hello I am trying to add to my application some icons via the code. When i run my executable from debug / release compilation folder it works good . But when I move my executable files to other folders it tells me that it doesn't find the icon files . Any idea how/where I should tell the compiler to add those files to my final exec...

Dynamically changing the title of a SiteMapNode

We have a website that uses a bog-standard default sitemap with security trimming as follows: <siteMap defaultProvider="default" enabled="true"> <providers> <add siteMapFile="~/Web.sitemap" securityTrimmingEnabled="true" name="default" type="System.Web.XmlSiteMapProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToke...

VB.NET - problem with member's event handling

I discovered that an event raised (directly on indirectly) in the constructor cannot be handled outside the very class. To prove if that was the actual problem, I wrote a simple exemplary app. Class with the event: Namespace Utils Public Class A Public Event Test() Public Sub New() CallTest() En...

Quality of TFS 2008 merged code

Does the quality of code merged by TFS 2008 depend on the used programming language? I know merging in Java / Subversion, and merging a branch to its trunk usually does not create much conflicts. Now in my company, we use VB.NET. When I merge two files TFS does not always get code blocks right, e.g. does not find the right If..then / end...

uploading file to a sharepoint site from aspx page

Hellp, I am trying to upload a file to sharepoint document library. though I am passing right credentials I am getting "The remote server returned an error: 401 unauthorized" Public Function UploadDocument(ByVal localFile As String, ByVal remoteFile As String) As Boolean '// Read in the local file Dim status As Boolean =...

How to convert a List(of Long) into a string array? (VB)

I want to convert a List (of Long) into a string array. Reason: it's a list of database IDs and I want to make a comma delimited string to pass into a stored proc. I tried this: Dim commaDelimitedList As String = String.Join(",", itemIDList.Cast(Of String)().ToArray) but I'm clearly not using the Cast correctly since it throws an ex...

Getting "not defined" error even with import

So basically this code was working fine before. I had some computer issues and had to move the development folder around and when I reopened it, I am getting a "Type 'SqlConnection' is not defined" error on all of my pages, even though I am importing System.Data.SqlClient. Intellisense seems to see that its imported, but I get the erro...

Connect an SQL database to a DataGridView with separate command buttons?

Hi, I'm a bit puzzled here. I did a form containing a simple datagridview containing data from an MDB file. The connection was alltogether done by Visual Studios wizard so alot of stuff was created automatically. Then I databinded the textboxes to each column in the database and managed to update the database via my own command buttons s...

Would it be a good idea or bad idea to connect a VB.NET frontend with a Python backend using sockets?

I have some really nice Python code to do what I need to do. I don't particularly like any of the Python GUI choices though. wxPython is nice, but for what I need, the speed on resizing, refreshing and dynamically adding controls just isn't there. I would like to create the GUI in VB.NET. I imagine I could use IronPython to link the two,...