vb.net

"The requested resource is in use" during Navigate in IE add-on

I've created an ID add-on that has a button. When I click the button I get an error that says, "System.Runtime.InteropServices.COMException (0x800700AA): The requested resource is in use. (Execption from HRESULT: 0x800700AA) at Interop.SHDocVw.IWebBrowser2.Navigate . . ." My code looks like this: Imports IE = Interop.SHDocVw ...

Is it possible to detect ASP Session State Type from code?

I'm trying to track down a problem on our test environment. Previously it was set to use InProc Session State Type, but I've added in the SQLServer type for one specific Web App. I did this because we use the SQLServer type in our production environment and I want our test env to match as closely as possible. However, after changing i...

How to share WinForms and code between 2 projects

Hi I have a working Windows Forms app (split into an EXE and a few DLLs). Now I've been asked to look at creating another app (MyAppLite) that has only a very small subset of the functionality. Think of it as similar to MS Word Viewer vs. MS Word. Everything that I need to build MyAppLite is contained in the main solution - essentially...

Declaring an object of a conditional type with a System.Type

I am attempting to launch a specific form depending on the selected node of a treeview on the doubleclick event. The code I need to use to launch the form is a little bulky becuase I have to ensure that the form is not disposed, and that the form is not already open, before launching a new instance. I'd like to have all of this checkin...

Reverse engineer Access macro from .NET

A co-worker has inherited a Microsoft Access macro that executes a series of SQL operations against a Sybase database by calling OpenQuery on a bunch of action queries, which use linked tables over ODBC. I would like to help him convert it to an SQL script that we can execute directly against the database. And since we have quite a few m...

VB.NET and linQ: How to delete entries from a dictionary using the value

I have a dictionary collection as bleow: mydic.addvalue(key1, val1) mydic.addvalue(key2, val1) mydic.addvalue(key3, val1) mydic.addvalue(key4, val2) mydic.addvalue(key5, val2) From the above dictionary I want to delete all the entries where value == "val1", so that the result would have only following entry: mydic.addvalue(key4, val2...

Calling Sub from EventHandler

I'm using the below to update controls from another thread (works great) How would I call a Sub (Named UpdateList)? The UpdateList updates a listview with a list of databases on a selected SQL instance, requires no arguments. Private Sub CompleteEventHandler(ByVal sender As Object, ByVal e As Microsoft.SqlServer.Management.Common.Server...

I keep getting a "System InvalidOperationException occurred in System Windows Forms dll" error in VB 9.0

I've just started learning VB.NET with VS 9.0; a small application I'm working on keeps returning an "A first chance exception of type System InvalidOperationException occurred in System Windows Forms dll" error from the Immediate Window. The application has almost zero functionality so far, it consists of a menu strip with: File About...

.NET Generate email text in Outlook from Word

I am attempting to generate the body of an email in Outlook 2007 from the text of a Word 2007 document in VB. I have access to both the Word and Outlook object libraries, and I can read from the Word document to get a string and write it to Outlook, but I need to keep the formatting from the Word document intact. The purpose will be to...

.NET - Very strange NullReferenceException?

How can I get a NullReferenceException in the following scenario? Dim langs As IEnumerable(Of SomeCustomObject) = //some LINQ query If langs Is Nothing Then Return Nothing If langs.Count = 1 Then //NullReferenceException here What am I missing here? Debug shows that langs is really just a LINQ queryresult without any results... ...

VB.net Unique Hardware ID ideas

I was wondering if there would be anything else I could use in my Hardware ID protection that would make it much more unique. I am currently using Processor ID Volume ID Mac Address Graphics Card Name If you guys can provide source codes to anything else that would make it even more unique please tell me. ...

TreeView Children

I have TreeView as below . Account Payable Address Customer Account Receivable Address Area If I will select Parent nodes then how I can display in ListView of particular child nodes? Also when I click on root node then how I can display only all parent nodes in ListView? Thanks . ...

Program skips code after trying to parse XML in VB.NET

I'm trying to parse some XML (html) I downloaded using WebRequest.Create() and then read it. However after loading the XML file using LoadXml(string), anything else I execute doesn't work. Setting a breakpoint on anything afterwards doesn't work and it doesn't break. I tried catching exception but none are occurring, so I'm not sure wha...

VB.NET Dock problem

Whenever I am adding New TableLayoutPanel programmatically in a Panel by setting DockStyle.Top, the last added TableLayoutPanel goes at the top most position of the Panel and the TableLayoutPanel added first comes down. Example: If I add like 1 2 3 4 5 It adds as 5 4 3 2 1 Please help me to fix the problem. The TableLayoutPanels sho...

Include code in ASP.net

I've got an ASP.net file, and I'm trying to include dynamic code which was easy in classic ASP. Here is what I have tried so far: <%@ Register TagPrefix="TagPre" TagName="header" Src="alg/classes.aspx"%> and <!--#include file="alg/classes.aspx"--> But neither of these seem to work. The content of classes.aspx is: <script runat=...

DateTime And ParseExact Problems

Hi There I wish to convert my string in format dd/mm/yyyy hh:mm:ss to a DateTime of the same format. Dim ukCulture As System.Globalization.CultureInfo = New System.Globalization.CultureInfo("en-GB") Dim myDateTime As DateTime myDateTime = DateTime.ParseExact("18/05/2010 23:42:10, "dd/MM/yyyy HH:mm:ss", ukCulture) When I step through t...

How do I get path of the Directory inside my WinForm app project

I have a directory named reports inside my winform project in .net. My project name is AccountingReports and inside that Directory reports exists. So i need the way to access this path via code. In Asp.net we use Request.PhysicalApplicationPath property. So is there any method or property exists that will give me the root of my project ...

Where is my mistake?

I have table which is connected to datagridview and I would like to enter new data by using text boxes. I have following code but it gives me error. Will be appreciated if you help me. Error Message is : Use the "new" keyword to create an object instance Dim meter As DataTable = Me.DataSet1.Tables.Item("tblmeters") ...

XPath when a root node and element have different Name Space attributes

hi, I got struck with a problem in VB.Net getting Xpath for an XML element as shown below: <Parent xmlns:"http://www.sample.com"&gt; <body> <Child xmlns:"http://www.notsample.com"&gt; <element type="xyz"> ghghghghghg </element> </Child> </body> </Parent> I need Xpath of the "element" in...

ASP.net VB Timers

I would like to be able to time a page load time in ASP.net (VBscript). Adding Trace="true" to the page directive is nice, but I need to actually time an event and store it in a variable. In ASP it was easy with the Timer object, but in .net I can't find anything on Google. I need something along the lines of: Dim startTime Dim endTi...