vb.net

Get the Integer value of an enumeration which is a generic

Here is the basic situation. Public Class MyEnumClass(of T) Public MyValue as T End Class This is vast oversimplification of the actual class, but basically I know that T is an enumeration (if it is not then there will be many other problems, and is a logical error made by the programmer) Basically I want to get the underlying int...

Why is a DataViewManager not sorting?

First off, a quick rundown of what the code is doing. I have two tables: Companies and Clients. There is a one to many relationship between Companies and Clients (one company can have many clients). In some processing logic, I have both tables loaded into a DataSet - each are DataTables. I have added a DataRelation to set the relationsh...

How do you make a copy of an Object

I have a collection of an object called Bookmarks which is made up of a collection of Bookmarks. This collection of bookmarks are bound to a treeview control. I can get the bookmarks back out that I need, but I need a copy of the bookmarks so I can work with it and not change the original. Any thoughts. Thanks. ...

Using WebRequest to save URL as Image thumbnail in VB.NET

I'm trying to write a simple routine where I pass it a URL and it goes and renders the content of the webresponse as a jpg. I found a solution somehwere in C# and ported it to vb.net, however when I run it, it throws an argumentexception "parameter is not valid" when trying to instantiate the image. Can someone take a look at the follo...

.Net WebServices and out/ref WebMethod arguments

I've received some documentation from one of our suppliers for a webservice they're publishing and they're very specific that on one of their WebMethods that an argument has the out modifier(? not sure if that's the right descriptor) for instance consider the following WebMethod signature: [WebMethod] public void HelloWorld(out string s...

Compiling with CodeDomProvider doesn't allow new features of C# or VB

I'm compiling some C# and VB code at run time using the CodeDomProvider, CompilerInfo, and CompilerParameters. It works great, and I really like being able to add scripting support to my application, but it only seems to support .NET 2.0 syntax. For example, the var keyword isn't supported in C#, and the If(bool, string, string) expressi...

Programmatic Navigation through a Context Menu in .NET WinForms Framework 2.0

I have a Windows Forms application, written in VB.NET framework 2.0. I have a grid that has an associated context menu with the following structure : MenuItem1 MenuItem2 --> SubMenuItem1 SubMenuItem2 --> SubSubMenuItem1 MenuItem3 ... I wish to display the context menu when a part...

C#'s edge over VB

What in C#.NET makes it more suitable for some projects than VB.NET? Performance?, Capabilities?, Libraries/Components?, Reputation?, Reliability? Maintainability?, Ease? Basically anything C# can do, that is impossible using VB, or vice versa. Things you just have to consider when choosing C#/VB for a project. ...

Run-Time Check Failure #0 vb.net callback from C dll

Hi all. I'm writing Add-inn Application A in VB.Net and DLL B in C language. Application A pass callback method to dll B. When certain event occur the dll invoke the callback from A. Whole works fine on my PC but when I move it to Notebook I get an error: Run-Time Check Failure #0 - The value of ESP was not properly saved across a func...

RegEx and matching codes right to left

Stuggling a little bit with the RegEx, I've got 4 codes in a string CODE4:CODE3:CODE2:CODE1 each code is optional apart from CODE1 So I could have ab:bc:de:fg or bc::fg of ab:::fg In each case of the above CODE1 = fg dnd for the dear life of me I can't work out the RegEX Would be easy to do as a standard string parse, but unfor...

Microsoft Office PIA and how to reference and build correctly from WebApp

All, I am currently trying to build on teamcity, which uses Microsoft.Office.Interop dll. This will build and work fine locally as I have office installed, however when trying to build it on TeamCity it fails as it has no reference. I can't install the PIA distributable as I get an error message saying the Office 2003 is required to ...

msaccess.exe opens while trying to release the object

I am opening a MS Access DB which is Password protected in vb.net using the folloing code: Try oDB = oDBEngine.OpenDatabase(Name:=strFullFileName, Options:=False, _ ReadOnly:=False, Connect:="") Catch ex As Exception strError = "File is password protected." Exit Function End Try But while rel...

Common programming mistakes for .NET developers to avoid?

What are some common mistakes made by .NET developers, and how can we avoid them? For example, trying to open a file without checking whether or not it exists, or catching an error unnecessarily. Please look in to the list before posting new Please justify your answer as well, if applicable and give examples. ...

Is there a wildcard expansion option for .net apps?

I've used the setargv.obj linking for Expanding Wildcard Arguments in the past for a number of C and C++ apps, but I can't find any similar mention for .net applications. Is there a standard way to have your app's command line parameters automatically wildcard expanded? (i.e. expand *.doc from one entry in args parameter to all that mat...

XML Parse error while processing the SOAP response

I am using C# .Net 2.0 to write a webservices client. The server's soap implementation is tested and is pretty solid. gSoap/C++ applications had no problem reading the responses. However the .Net implementation complains "There is an error in XML document" while calling one of the methods. Similar responses recieved from the server were ...

VB.net: What's the VB.net equivalent of this C# for loop?

After two years of C#, my VB.net is a bit rusty. I have two List. Let's call it originalList and targetList. Here is my C# code. for(int i = 0; i<originalList.Count; i++) { bool isMatch = false; foreach (string t in targetList) { if(String.Compare(originalList[i], t, true) == 0) { isMatch = true; break...

Handling multiple Change Events in FileSystemWatcher

I have the following sub: Private Sub Watcher_Changed(ByVal sender As System.Object, ByVal e As FileSystemEventArgs) If Path.GetExtension(e.Name) = ".p2p" Then Exit Sub Else Try ' multiple change events can be thrown. Check that file hasn't already been moved. Whi...

Somewhat strange .NET error involving datetime

I am getting this error on a remote server, but the same code executes fine locally. Please refrain from saying it sucks, or giving me your rant on dynamic sql, I didn't write it, just trying to figure out why it's throwing an exception. The highlighted error is line 56. Protected Sub drpDateRange_SelectedIndexChanged(ByVal sender As Ob...

ASP.NET Impersonation and SQL Server Trusted Connection Calls

I am working on an ASP.NET page that we, in code impersonate the requesting user. We are using the following code to start impersonating. Dim impersonationContext As System.Security.Principal.WindowsImpersonationContext Dim currentWindowsIdentity As System.Security.Principal.WindowsIdentity currentWindowsIdentity = CType(User.Identity,...

Compiling Massive VB.NET Project

To compile my current project, one exe with ~90,000 loc + ~100 DLL's it takes about a half hour or more depending on the speed of the workstation. The build process is one of running devenv from Powershell scripts. This works very well with no problems. The problem is that it is slow. I want to speed up this build process. MSBuild ...