vb.net

Connect to a map network drive

I Have a batch file in a server in my network. I maped that shared folder (that batch file exist in it) every time that I want to run that batch file first I should have to connect to that network drive(with username and password) How can I do it in my code . Is there any way? I want to connect to that network drive by code in my form_lo...

problem with lucene wildcard search at the end of search term

hello, i noticed a problem by searching, when i search for "myword" for example in textfiles (with lucene.net), but when i search for "myword*" myword isn't found! in the description of using wildcards it says: Multiple character wildcard searches looks for 0 or more characters.[...] 0 or more, but it doesn't work actually. my...

Why do nullable types behave this way

I was having trouble with a nullable type so I wrote the following program to demonstrate the issue I was having and am confused by the results. Here is the program: Module Module1 Public Sub Main() Dim i As Integer? = Nothing Dim j As Integer? = GetNothing() Dim k As Integer? = GetNothingString() If i.HasValue Then ...

imports java.util.zip in a vb.net project.

I need to import java.util.zip for my project to zip and unzip chosen files/folders in vb.net. But when i say imports java.util.zip, i get the error "Namespace cannot be found". I went in the add reference and checked in both .net and COM components bout found nothing for java. What dll would i need to make this work? thanks ...

vb.net error: pkey at System.Data.ProviderBase.FieldNameLookup.GetOrdinal(String fieldName)

'Dim dbReader As System.Data.IDataReader '******* Ordinal values******* '0: ClientKey '1: pkey '2: TeamName '3: Active While dbReader.Read If (IsDBNull(dbReader.Item(1))) Then Exit While End If If Convert...

ASP.NET (VB): GridView with ImageButton > Populate text box with comments

It has been so long since I have coded a page in VB. For the life of me I just cannot remember how to do this. I have a GridView on an ASP page. Each row has a comment ImageButton. I already have the gridview and text box wrapped in a UpdatePanel. The gridview shows all of the correct information. I just need to add some code to populat...

Merge multiple <Body> (xml) word documents to 1 document

I have multiple <body> tags from an word document. I do this with the open xml sdk. So the new document should generated with openxml The body's comes from WordprocessingDocument.Open("C:\Temp\Test.docx").MainDocumentPart.Document.Body.OuterXml I have so different body's in a list. With al different values. Changed some text in the x...

Monitoring a folder for new file creation without using FileSystemWatcher in .net

Hi I have to create a windows service which Monitors a specified folder for new files and does someprocessing on it and moves it to other location. I started with using FileSystem Watcher. But my boss doesn't like FileSystemWatcher and wants me to use polling on Timer or any other mechanism other than File System Watcher. I am confus...

VB to C# Translation

In VB (ASP.NET) Application("myapp")= Server.CreateObject("APP.Engine") aa = Application("myapp").myMethod(2) works. In C# I tried Application["myapp"]= Server.CreateObject("APP.Engine") but Application["myapp"].myMethod(2) fails with 'object' does not contain a definition for 'myMethod' How can I expose the public interf...

How to edit a Word Document (.docx) stored in a SQL Server Table?

How to edit a Word Document (.docx) stored in a SQL Server Table? Here is the tentative work flow: Read BLOB from SQL Table through Ideablade Write BLOB to disk as .docx Open .docx using Word User makes changes Save .docx using Word Read .docx into BLOB Write BLOB back to SQL Table through Ideablade All sample code is...

What is the preferred method for generating locally unique identifiers in VB.NET?

I'm looking for a method of generating unique identifiers for a record class being created locally and then persisted in various formats (XML, SQL, etc.) I've seen people using DateTime and GetHashCode, but that seems to lend itself to duplicate identifiers depending upon the sample size. GUID is a bit overkill, as I don't need anythin...

How to use #IF DEBUG in vb.net

Is it possible to assign a value to a class variable from inside a #IF DEBUG conditional? Basically what I want to do is conditionally execute some code from inside my main form load if I am running in DEBUG mode. I thought I would do something like: Public Class Form1 public DEB as Integer #if DEBUG then DEB = 1 #else DEB = 0...

ASP.net hyperlink in email

I'm pulling a hyperlink from a SQL db and trying to embed it in an email programmatically as follows: Dim dv As System.Data.DataView = CType(SqlDataSource2.Select(DataSourceSelectArguments.Empty), System.Data.DataView) ''Add Ticket URL and comments to answers dictionary Dim emailMessage As New MailMessage("donotr...

vb.net class organization

I've been struggling to get my mind around classes. Even after reading several websites and books, I still don't feel like I really 'get it'. The application that I'm working on has a sub that will control a few different pieces of test equipment over a USB to GPIB interface. So, I have: Laptop USB - GPIB Interface Power ...

Creating delegate to pass function with parameters (.net 2.0)

Forgive me if this is documented somewhere, but is there any nice way to create a MethodInvoker which will perform a specified function with specified arguments (capturing the argument values when the MethodInvoker is created)? I've sometimes done things by using a wrapper class, but wonder if that's the best approach. Should I be doin...

Uploading to Imageshack with VB.NET

I want to use the http://www.imageshack.us/upload_api.php API function to upload a picture onto ImageShack and then obtain the image_link. The only problem is, how do you place an image with its file name with the form-data along with the API key? This is what is stumping me in trying to implement the function. By the way, OpenDialog is...

How to dynamically set local XML namespace?

I have several xml namespaces that expose the same schema. I want to use a function that dynamically accepts a namespace and applies the attributes or the properties according to the specified namespace: Public Sub ProcessElement(element As XElement, [namespace] As XNamespace) element.<[namespace]:Property>.Remove() End Sub I actua...

Dealing With Different Coding Conventions/Styles In Visual Studio...

I'm working on two different projects - both in VB.NET/Visual Studio 2008 (as much as I'd like to move to 2010). I find I'm confusing the different coding standards that I'm supposed to follow. IE - Project1 wants variables named in a Hungarian-style notation like 'iSomeValue'; the does not want a prefix. One project requires an _ pre...

Infinite loop when Json serializing a Collection (VB ASP.NET)

I am trying to use a Web Service to return Json for a Collection of Users from a Database Table. I'm only new to .NET (< 1 week experience), and I don't want to use the UpdatePanel for AJAX. I have tried using the JavaScriptSerializer as well as Json.NET to serialize. Both cases seem to spawn an Infinite Loop. What am I doing wrong? Is ...

specified cast is not valid error on development but not on test server

I have a .Net 2 solution with some asp classic pages. I get a specified cast is not valid error when I access the page on my local. Below is the vb function where I get the Error: Public Function Retrieve(ByVal vntSeqId As String, ByRef vntPart As String, ByRef vntPartKey As String, ByRef vntEntDate As String _ , ByRef vntStat...