vb.net

Best way to pass a connection object among forms?

Background: I'm rewriting a VB6 app that used MS Access for data storage to one that uses VB.NET and MS SQL Server. I'm curious as to the best way to pass a connection among the different forms in my application that need a connection to the database. Right now I've built a class to manage the connection string to pass that between f...

Understanding CLS compliance and correct code

I've attempted to create an abstracted control to manage some of the state in our application, however have run a foul of some CLS issues and was hoping that someone could provide some insight. I have an Enumeration as such: <Flags()> _ Public Enum FormState Read = 1 Edit = 2 Insert = 4 End Enum And a class as such: Publ...

Send mail programmatically w/attachments is undeliverable

I am trying to send mail using vb.net from iis through a smart host (mailenable) and out through the internet. When I send mail without attachments it goes out just fine. When I send mail created the same way with an attachment the smart host gets an error sending the email. "mailenable the remote server appears to have failed or to h...

VB.NET Object Problem with Collections, Arrays and Lists

I have a small program where I have been trying to create collections of a particular object I have created (Job). Regardless of whether I am using an array, collection or list, each time I add a new instance of the object to the array/collection/list, it overwrites all previous items with the same object. For example, let's say Job ha...

Conditional compilation with automated builds in Visual Studio

Here's what I'm trying to do: A single build script That script builds two executables from the same Visual Studio project. The first compiled .exe has a small amount of code disabled. The other compiled .exe has everything enabled. I've been reading up on conditional compilation and that takes care of my needs as far as enabling/dis...

How can my WinForms app get the users MachineID or ProcessorID?

I'm looking for a way to retrieve the user's MachineID or ProcessorID using a VB.net WinForms app? Any thoughts? ...

vb.net countdown

Hi, I'm trying to make a countdown timer in my app. I already know the countdown time which is 4 minutes. I have a timer which ticks avery seconds. Now from that how can I update my textbox so that it shows the time remaining in the foirmat HHMMSS? EDIT: the problem I'm having is calculating the remaining time. What should I use? timest...

How can I take each array item and insert in a SQL database?

I have the following vb.net code to take the values out of a textbox on a webpage (actually space delimited tags) and split them with a space delimiter into an array. This works exactly how I want. mySample.Tags = tagsTextBox.Text Dim tags As String = mySample.Tags Dim tagarray() As String Dim count As Integer tagarray = tags.Split(" ")...

adding a tags field to an asp.net web page

I want to add a text field to a web page that lets users add space delimited tags. much like del.icio.us. I am more interested in how I get them off the page and into the database using VB.NET and SQL. Can anyone point me at any articles or code snippets on how I can achieve this using vb.net and sql 2005? ...

How to do filter (sorting) on Columns of excel file programmetically using vb.net?

we are generating a excel report and we need to sort the data programmatically before saving the file. Is it possible to implement filter on a specific column i.e. sorting of a excel file programmatically using vb.net? As per your suggetion, in order to generate excel report with sorting on specific column I just implemented the logic ...

How to do ORM for this situation?

I have the two following tables (SQL Server): **IndexValues** IdIndexValue int (PK) Value varchar(2000) IdIndex int (FK for Table Indexes) IdDocument int (FK for Table Documents) **IndexValuesLists** IdIndexValueList int (PK) IdIndexValue int (PK with IdIndexValueList, FK for Table Indexes) Explaining a little, the second table grou...

Problem getting type to appear in intellisense from project reference.

I'm getting a compiler error saying that "Acme.Business.User" is not defined. I have a class library project called "Acme.Business" that has "Acme.Business" as the assembly name and root namespace as well. None of the classes use the "Namespace" keyword, so they all should exist in the namespace "Acme.Business". I also have a class lib...

My summary information won't show up in Sandcastle using VB ''' syntax

I'm trying to take advantage of Sandcastle to help build out system documentation, but for some odd reason none of my <summary> data shows up in the chm ... has anyone had success w/ the latest build of Sandcastle and VS2008 using VB? ...

Add users to a Security Group in active directory

Using any .NET framework I am able to create security groups, however when I try to add users from within the same domain I get an error. Using System.DirectoryServices.AccountManagement: TheGroup = GroupPrincipal.FindByIdentity(SecurityContext, "GROUPNAME") TheGroup.Members.Add(SecurityContext, IdentityType.SamAccountName, "username"...

How do I override the error message on a databound control in WinForms?

I have a form in my application that uses a binding source to bind the controls to a model object. This works, and handles basic validation such as ensuring that the user doesn't enter text into a numeric field, for example. I am using an ErrorProvider, and setting its datasource = the binding source in order to display the error messag...

Looping through a request.querystring in VB.NET

I am trying to loop through a query string and pull out certain values as in: ?ProductID=1234&ProductID=4321&Quantity=1 For each value next to ProductID I want to execute some logic. But I am not sure how to get to the values. Any ideas? ...

How do you capture the text on the first page of a Microsoft Word document?

Using VB.NET how do you capture the text on the first page of a Microsoft Word document? I've imported the Word 12 interop library (for Word 2007), and I know how to use the document.range function, but how do you know which page you're on when you're selecting text? ...

How can I get artwork of a mp3 file in vb.net 2005?

Hi, I want to display an artwork in a picturebox which is associated with an mp3 file when I open the file in my audio player in vb.net 2005. An example would be appreciated. I've heard you can do it with ultraid3tags, but its in c# and I don't understand it :(. Help will be appreciated Thanks,sam ...

What is Environment.FailFast?

What is Environment.FailFast? How is it useful? ...

Reflection - SetValue of array within class?

OK, I've been working on something for a while now, using reflection to accomplish a lot of what I need to do, but I've hit a bit of a stumbling block... I'm trying to use reflection to populate the properties of an array of a child property... not sure that's clear, so it's probably best explained in code: Parent Class: Public Class ...