vb.net

How do I fix my Unit Test to have global access to everything?

Usually when you add one (in Visual Basic), it pops up a message asking if you want to enable an option that lets the test access things like private methods etc. However, I am editing a solution that does not have this enabled. I'd like to enable it so my unit tests will work, but I can't find the setting. Can anyone tell me how to en...

Specifying a DLL reference

I'm having trouble setting the path to a DLL that is not in the same directory as the executable. I have a reference to dllA.dll. At present, everything is just copied into the same directory and all is well; however, I need to move the executable to another directory while still referencing the DLL in the original directory. So, it's ...

Group by and order by

using LINQ to NHibernate does anybody know how to use group by and order by in the same expression. I am having to execute the group by into a list and then order this, seem that I am missing soemthing here ??? Example:- Private function LoadStats(...) ... Dim StatRepos As DataAccess.StatsExtraction_vwRepository = New DataAccess.Sta...

Looking for .NET Math method that will zero a negative integer

Similar in concept to Math.Abs() - I'm looking for a function that when given a positive integer will return the same integer. If given a negative, will return zero. So: f(3) = 3 f(0) = 0 f(-3) = 0 Yes, this is simple enough to write on my own but I'm wondering if the .NET Math class already has this built in or if the same can be a...

Regular expressions .net

I have the following function that I am using to remove the characters \04 and nulls from my xmlString but I can't find what do I need to change to avoid removing the \ from my ending tags. This is what I get when I run this function <ARR>20080625<ARR><DEP>20110606<DEP><PCIID>626783<PCIID><NOPAX>1<NOPAX><TG><TG><HASPREV>FALSE<HASPREV><H...

vb.net using SortedDictionary as combobox datasource

I have a combobox which i am binding to a sortedDictionary list, so it displays in ascending order. My question is, I need to display "--Select--" as the first option. Is there any way to either: 1) add another item besides for the datasource or 2) add an unsorted item to the top of the sortedDictionary any other ideas welcome as well :...

How do I get the path to the associated file used to launch a program?

I have a program with an associated file type. However, when I double-click a file to launch the program, I can't figure out where that path was passed to the program. Initially I thought the file path would be in Environment.CommandLine, but the command line only contained the program path. I specified the file association using the P...

Any suggestions as to why a .Net app looks for a different config file on a 64-bit machine?

We have a project management application written in VB.net. When running this application from a 32-bit machine or from within the Visual Studio IDE on a 64-bit machine, it looks for the correct configuration file (i.e. MyApp.exe.config). However, when running this app from outside the IDE on a 64-bit machine, it looks for MyApp.config a...

Not getting redirection to custom error page using custom errors - ASP.Net

Here's my Application_OnError event sink in global.asax.vb: Sub Application_OnError(ByVal sender As Object, ByVal e As EventArgs) Dim innerMostException As Exception = getInnerMostException(Me.Context.Error) If TypeOf innerMostException Is AccessDeniedException Then Security.LogAccessDeniedOccurrence(DirectCast(in...

Garbage collection of working environment?

Could anyone elaborate what work you are doing in garbage collection in daily corporate work? How much your considering garbage collection in your SDLC? ...

populating one checkedlistbox with another (checkedlistbox)

I am having difficulties populating a checkedlistbox (CLB) based on the selection(s) made in another. It should also be noted that I have a "Select All" checkbox at the top that checks/unchecks all of the items in the first CLB. Here's the code: Private Sub chkSelectAll_CheckedChanged(ByVal sender As System.Object, ByVal e As System.Eve...

Some languages don't work when using Word 2007 Spellcheck from Interop

I'm using the Word 2007 spellchecker via Interop in a VB.net desktop app. When using the default language (English), it works fine. If I set the language to French via LanguageId, it also works. But if I set it to French (Canadian) (Word.WdLanguageID.wdFrenchCanadian), it doesn't work. There's no error message, it simply runs and says t...

VB.net Saving an MetaFile / EMF as a bitmap ( .tiff)

Currently I have a third party control that generates a Metafile. I can save the .wmf file to disk with out issue. The problem is how do I render the Metafile as a Tiff file. Currently I have the following code to get my metafile and save it. Dim mf As Metafile = page.GetImage(TXTextControl.Page.PageContent.All) ...

VB.NET Use With keyword on existing object?

Is it somehow possible to use the 'With' keyword on an existing object? I would like to do the following using LINQ to objects and can't seem to find a way: From m as Product in Me _ Select m With {.Match = m.Name.IndexOf(query)} _ Where m.Name.IndexOf(query) > 0 ...

Do you gain any operations when you constrain a generic type using where T : struct?

This may be a bit of an abstract question, so apologies in advance. I am looking into generics in .NET, and was wondering about the where T : struct constraint. I understand that this allows you to restrict the type used to be a value type. My question is, without any type constraint, you can do a limited number of operations on T. D...

Merge Word Documents (Office Interop & .NET), Keeping Formatting

I'm having some difficulty merging multiple word documents together using Microsoft Office Interop Assemblies (Office 2007) and ASP.NET 3.5. I'm able to merge the documents, but some of my formatting is missing (namely the fonts and images). My current merge code is shown below. private void CombineDocuments() { object wdPageBr...

How to open a form in a determined tab? vb .net

I have a form with a tabcontrol and 4 tabs. I want to open a form with showdialog in a predetermined tab. I've tried OptionsForm.OPTS_TabControl1.SelectTab(1) OptionsForm.OPTS_TabControl1.ShowDialog() but it didn't work. Any help? thanks ...

Pivot Table in LINQ in VB.NET

Hi, I'm looking for doing a Pivot Table query in vb.net. I've found a lot of code in c# but not in VB.Net and i don't understand how to convert c# to VB. Can you help me? Thanks Ju ...

Backing Up Database from Remote Server to Local in VB.NET

Hi, I am making a VB.NET application that can download/backup the database that is currently on a remote server. I have Remote Server IP,Username,Password and Database name. I am also able to connect to it. But i don't know what to do after connecting to it. I don't know what all files are need to be backed up. ( i think database and ...

Perform a function at a specific time in VB.NET

I am writing a small app to automatically connect my PC to the internet at a certain time and I am using rasdial.exe for it... Private Sub SetIt_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SetIt.Click Dim windir As String = Environment.GetEnvironmentVariable("WINDIR") Shell(windir & "\system32\rasdi...