Windows Script Host Object Model's Interop.IWshRuntimeLibrary.dll Referencing Same Directory As Executable
May 10, 2011
I have an application that creates desktop shortcuts. To do this I have to reference the Windows Script Host Object Model. When I add it as a reference, it always creates the DLL, Interop.IWshRuntimeLibrary.dll, in the objx86Debug directory, then references itself to it, rather than looking at wshom.ocx. Even if I add reference wshom.ocx it reverts to saving the file in the objx86Debug directory. The problem is if I move my application to another computer without that DLL being present, the program fails to run.
This may be simple but I have brain freeze on just nowIf I cd into a directory from a command line and then run my executable VB.net application, is there a way to detect the directory that it was launched from. I currently have the executable in my PATH however ideally the person would cd into the directory that they were wanting the executable to act upon.
how to write/read a file in the same directory as the executable? I know how to read and write files, I just need to know how to read/write files in the same directory as the EXE.
VS sets your project up with the default directory structure: ...indebug which also seems to contain some other files besides your dll (I assume these are related to the debug symbols, etc).So how do you set it up to copy your dll to another directory when debugging?Right now, I'm having to manually copy the built dll with every run and that's getting to be a bit annoying.I'm using VS 2008?
I need to get the host out of the Request object. Which property should I use and why?
From MSDN:Uri.DnsSafeHost Property A String that contains the unescaped host part of the URI that is suitable for DNS resolution; or the original unescaped host string, if it is already suitable for resolution.
vs
Uri.Host Property A String that contains the host name. This is usually the DNS host name or IP address of the server.
My testing has been with the ASP.NET Development Server. Both of these always return localhost. Even when I put in 127.0.0.1, both return localhost.Reading on, the DnsSafeHost property will handle IPv6 addresses, as well as Unicode to ASCII conversion if needed. It can also account for IRI and IDN. Even though I currently don't care about these things, should I just use the DnsSafeHost property to be safe?
I created a report using report document object model in visual studio 2008 with vb.net. But I found one error. When the user clicks export button in client side, the following error will show. But the first time is OK before the user clicks export button.
Logon failed. Details: ADO Error Code: 0x Source: Microsoft OLE DB Provider for SQL Server Description: Login failed for user 'zanhtet'. SQL State: 42000 Native Error:
This is calling report code.
Dim ReportDocument As New ReportDocument() Dim ReportPath As String = Server.MapPath("~/ReportDocumentOM/DBlogInRDOM.rpt")
Private mdbContext As PFModelContainer Private mdbTransactions As Object
Before I did it this way:
Private mdbContext As New PFModelContainer Private mdbTransactions As mdbContext.Transactions
Thinking maybe I was doing something wrong I changed it over to the first way, then I do:
Public Sub New() mdbContext = New PFModelContainer mdbTransactions = mdbContext.Transactions End Sub
Once I hit mdbContext = New PFModelContainer it takes me over to the PFModel.Designer.vb Where it steps through the following:
Public Sub New() MyBase.New("name=PFModelContainer", "PFModelContainer")
At which point it terminates execution of the code. This is the error it gives me on the Immediate window:
A first chance exception of type 'System.ArgumentException' occurred in System.Data.Entity.dll
Is there something I can do to make this error go away? I tried deleting the project and recreating it with my old .edmx model that I downloaded from Mozy from when it used to work. It stopped working (as far as I can tell) after I changed the .edmx model and updated it. Maybe I did something else in the other project too, but I'm not recalling anything.This is what is in the app.config:
Should I be referencing System.Data.EntityClient and System.Data.SqlServerCe.3.5 somewhere?The EDMX property Entity Container Name is PFModelContainer and the Namespace is PFModel.
I'm developing a business model for an application where I am representing physical entities. The hierarchy created from this is neat, but as I'm doing this, I'm beginning to think about things like, what properties should be included in one that may already be apart of another? Or what if some properties are expected to be in one object, but another object needs to return that value, how does it communicate that request through the hierarchical chain? And what is the best practice for this design?
[Code]...
But then I got to thinking, what if I have a ConnectionPoint entity and I want it to return which Panel it has? Should it have it's own Panel association as well? Or should there be a method/pattern for communicating the request up the chain? And again... what's typical best practice?
I have some data that is contained in HTML tables within a webpage. I need the simplest means of extracting the data for storeage in SQL tables. I am knowledgeable of how to add the data to SQL tables...this portion of the code is already written. I would like to pull the data into the VB.NET 2008 environment using the XML DOM or a more efficient option.
I am not sure where to post this as I didn't see a forum for SharePoint on here. I hope someone can help me with this.I have a form sitting on a webapp outside of the sharepoint server (which is why I am using the Client Object Model). To make a long story short the form is sending data to a SP list. This list is made up of regular string fields, date fields, lookup lists, choice lists and user data.
I am able to insert data that isn't part of a list with no issues. However, when I update any of the lookup lists i receive the following error:Invalid look-up value. A look-up field contains invalid data. Please check the value and try again. So I then wrote code that went to the list and got the entire item as follows (please bare in mind this is not very eloquent, but it gets the data)
Is there a way to basically merge a Windows Forms Application with a Windows Service Application and allow the passing of parameters on start up to determine if it should start the standard GUI or launch as a system service
If I am using with WebBrowser how I can add tags to source code of the page in runtime (Make a changes on site). For example: I have site with this <html><head> Test page </head><body> this is the text </body></html> Now how possible to add elements/tags to text in runtime?
I have a .net asp app that updates a SP form. I am using the Client object model. Currently when inserting a record the record is inserted using the App pool ID. Is it possible to somehow set the context to use the ID of the person logged into the webapp or a custom ID separate from the default. I can't find any data in this in the web or gong through the context methods.
It's probably the most basic of things, but all I can find is how to launch a program, and not with the interactions I desire. Any tips as to the terms to use to search for answers, or links to topics regarding questions similar to mine, would be very appreciated. I have a wealth of info to read through, but I could use your knowledge to save myself time.Here is what I am trying to do:
Use a Button (A) to Launch a Prompt where User Selects Directory Path to an executable Program. The Selection is to be Persistent after the initial selection (saved in a settings file i assume?), and the Selected Path (or just "programname.exe") is to be Displayed in a Text Field (B). Launch Selected and Indicated Program via a Launch Button (C)
Ive have a listview on my form and need to populate it with data from my Table called "tblCustomers". However I need to only retrieve records based on field that is populated with data called "Joe". In order for the SQL syntax to retrieve the name "Joe" then the SQL syntax needs to reference the Label on the form called "lblName" which will have the name "Joe" as the caption.
How can my dataset have SQL data that references my label object on my form?
I have a VB6 app that I'm updating to .Net. This app interfaces with PeachTree Accounting through there type library, which I have a reference. When I try to create a reference to Peachtree in .Net,
1. Select References from Myproject 2. Click "Add" 3. Select the "COM" tab 4. Select the "Peachtree Accounting 17.0 Type Library"
When I add the reference, the Path says "<The system cannot find the reference specified>".
There is something different about the way the path is listed. All the other paths are listed like "C:Program Files..." but the Peachtree library is listed like "C:PROGRA~1SagePEACHT~1PAWLegacy.dll"
This is how the old DOS use to list names longer than 8 characters. In my VB6 app the reference path is "C:Program FilesSagePeachtreePAWLegacy.dll"I tested other references with simular paths like "c:progra~1..." and they work fine. It's probably something else. I'm fairly new to .Net so can anyone point me in the right direction?
I have a simple .net program that would only require .net framework to run.There are no third party dll or references. This program does some work and creates a shortcut.To my knowledge , it requires IWshRuntimeLibrary to create a shortcut. Because its com based ( windows scripting host object model ), adding a reference to it creates an interop file in my bin folder.So when the application runs , it looks for Interop.IWshRuntimeLibrary. dll in the current location.It works correctly if interop file is there. But the file will not be present in the user system.
Referencing an object (class) within a thread fails
I have an object ("a vb class") that needs to run on a separate thread and communicate with the U/I.
Even using sample code, I cannot get the object to run within a thread. I demonstrate this problem with two examples. The first calls a function within the form and it works perfectly. The second creates an object and performs the same calls, but fails.
example #1 [working] (Called within a form) Private Delegate Sub FuctionToBeRunInThreadDelegate Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click
[Code]....
SUMMARY: When the thread creates the object, it appears that the object is not actually running inside of a thread or else form.InvokeRequired would be true. I have other more complex examples where this is strongly verified and evidenced, but I provided these two as a very simple demonstration of my problem.How can I have a thread "own" a series of individual objects so that the objects are run asynchronously and can independently report back to the U/I?
I have a customer which as a Visual Basic Project in single instance mode with a wired presentation logic.
The main form contains a TabControl with mutliple TabPages.If I click on TabPageA another form is shown in front of the Form and resized to have the same size as the TabPage.
If I click on TabPageB the first form is hidden and another form is displayed.So basically for the user it looks like you have a TabControl with different TabPages which is not the case.
I tried converting the Forms to UserControls and put them inside the TabPage, but, thanks to the SingleInstance app, this would take a whole lot of refactoring. I tried it but eventually gave up because of many many runtime errors and I don't want to put any more effort in this.
Often I have a list of object A, and I have another object type B that needs to hold a reference to one instance in that list. So, as far as I can imagine, it's three ways to hold such reference:
1. Make B hold the instance variable of type A 2. Make B hold some other key/ID of the A instance 3. Make B hold an integer of the list index of the A instance
I guess 3 is quite limited, and mostly suited for use locally inside a method, in a for-next loop etc. But with the other two I tend to have the feeling that I should use 2) over 1), as I believe I shouldn't "duplicate" the object.. But wonder if that is a mistake. I guess it's only holding a reference to the stack memory, so it doesn't really make any overload compared to holding just an integer key/ID..
Further my thought is that with 1), I don't have to loop through the list to get the correct instance, as it already holds it. However if A changes, it may not be reflected in B.A, if the A has been given a new instance, so then 2) would instead give access to the updated object A. So perhaps if A is a "dynamic" object that may have been reinitialized (if that's a word), I need to use method 2). However if it's a type of object that is only changed when for example the user opens a program settings form, and this setting form only changes value type variables, then perhaps 1) is appropriate?
This is kind of the case I have some times, and I wonder if I should then use 1), as it doesn't require me to loop through the list by key/ID. It makes other object hold the full reference, which is not really necessary, but maybe still more efficient? Although at the same time, maybe I shouldn't really care much about looping through an object list either, if the list is not very big.
I've found a lot of other references to this error using Google but I'm having trouble making sense out of how they apply to what I'm doing.
Here's the VBA error I'm getting at compile time: "Function or interface marked as restricted, or the function uses an Automation type not supported in Visual Basic."
VBA Code that causes the error:
'ftp is also a com object created in code not posted here Dim f() As wooxter.FTPFile f = ftp.GetFileList 'Returns an object array of type FTPFile
I have a VB6 program which calls a COM method, passing 2 arrays as parameters and expecting 2 arrays to be populated in response.The code is this, where ItemIDs and ItemClientHandles are the input array parameters and MyItemServerHandles and Errors are populated by the COM object.
Dim ItemIDs(2) As String Dim ItemClientHandles(2) As Long Dim Errors() As Long ' Array for returned Item related errors Dim MyItemServerHandles() As Long ' Server Handles for Items
I have a managed class that uses a COM that looks like this.
[Code]....
Since I am using an unmanaged dll through a COM-Interob dll I am wondering if I need free the innerobj manually or if the gc is smart enough to do it automagically if I call ReleaseObject() My class implements IDisposable and I do the following atm: Runtime.InteropServices.Marshal.ReleaseComObject(myobj) Do I need to take care of releasing all inner objects that are created by the COM Object or not? And If I do have to do it, does the order matter (first inner then parent vs parent then inner)?