vb.net

Regular Expression puzzle

In (Visual Basic, .NET): Dim result As Match = Regex.Match(aStr, aMatchStr) If result.Success Then Dim result0 As String = result.Groups(0).Value Dim result1 As String = result.Groups(1).Value End If with: aStr equal to (whitespace is normal space and there is 7 spaces between "n" and "(" ): "AMEVDIEERPK + 7 Oxidat...

Calculate the next anniversary date after today.

What's the quickest/neatest way to calculate the next anniversary of someone's birthday. For example, if I knew a person was born on 31st January, 1990, and today is the 10th February 2000, their next anniversary will be 31st January, 2001. February 29th should roll onto March 1st (e.g. if they were born on February 29th 1990, their fi...

"Re-Raising" Custom Events in .NET (ASP.NET in this case)

Hello all, I'm working on an ASP.NET page, using VB.NET and I have this hierarchy: Page A   - Web User Control 1     - Web User Control A     - Web User Control B     - Web User Control C I need to raise an event from Web User Control B that Page A will receive (the event flow will be Web User Control B -> Web User Control 1 -> P...

Mass Insert Into Sql Server

I am attempting to insert a mass of records into SQL Server 2005 from Vb.Net. Although the insertion is working fine, I am doing my best to try to make it as fast as possible. Currently, it takes ~ 11 mins for 100,000 records. What would be the suggested approach to inserting a large number of records into SQL Server from an Applicati...

Question: VB.net coding standard regarding declaring variable

I've seen some variable declare in VB.net in several way like: print("dim _Foo as string"); and print("dim m_Foo as string"); and print("dim foo as string"); I will like to know what's the standard for VB.net coding. ...

DataGridView custom sort not on DataMember (Databound Grid)

I have a custom DataGridView column that uses an embedded control that pops up a search window for the value of that column. The important thing is that the databound column is a numeric ID, but the custom column cells display a text description. How do I get the column to sort on the text description rather than the numeric ID? I...

Porting VB.NET Winforms Application to C#

Are there any 'good' resources for porting a VB.NET winforms application to C#? I'm sure there are is software that just translates the code, but I'm looking to refactor the code at the same time. Keeping it in its current form is problematic, since it uses some of the 'bad design' practices that VB.NET allows, and would further compli...

Why catch an exception just to throw it again?

In an webservice I see this code: Whats the point of catch the exception and just throw it again? Do I miss something? <WebMethod()> _ Public Function dosomething() As Boolean Try If successful Then Return True Else Return False End If Catch ex As Exception Throw ex End...

How would I insert data into an Access table using vb.net?

I want to insert a new row into an Access database. I'm looking at doing something like: oConnection = new Connection("connectionstring") oTable = oCennection.table("Orders") oRow = oTable.NewRow oRow.field("OrderNo")=21 oRow.field("Customer") = "ABC001" oTable.insert Which seems to be a sensible way of doing things to me. However...

Accessing Windows Forms 2.0 combobox or AXComboBox

I have created a mutli-column combobox in VB.net 2008 using windows forms 2.0. I am having trouble accessing data once selected to use in the remainder of the form. There does not seem to be a selected event to use in conjunction with the winform 2.0 combobox. Does anyone have any experience using winforms 2.0? Also I guess a better que...

Handling ASP postbacks from Javascript Widget

I am trying to make a small, data-driven widget that is populated with data from a database on the fly. I can load it initially just fine, but when the index of an ASP DropDownMenu is changed, the widget returns a 404. This could be a symptom of how I am using the Javascript, or how I am using the ASP. I honestly don't know for sure. ...

Displaying a Second Form in WPF

I have a main form and as sub form. I need the main Form to display the sub Form and pass into the constructor an object. When the sub Form is done it needs to destroy itself so the cycle can be repeated. Currently I declared the sub form globaly Public GlobalWindowBookmark As WindowEditBookmark I then create the form and pass it ...

Forms in VB.Net

I am from a c# background and am converting a vb.net windows forms app to c#. I have a windows form called associateForm. In code the developer references associate form like so:- Private Sub NotifyIcon1_MouseClick(ByVal sender As System.Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles EMS.MouseDoubleClick If e.Button...

Programatically Break Apart a PDF created by a scanner into separate PDF documents

I have PDF documents from a scanner. This PDF contain forms filled out and signed by staff for a days work. I want to place a bar code or standard area for OCR text on every form type so the batch scan can be programatically broken apart into separate PDF document based on form type. I would like to do this in Microsoft .net 2.0 I c...

Trap Key Entries to Digits and Cap Alphas in Textbox

In WPF need to trap the keys entered in a textblock to keep the user from entering anything but digits,cap letters and navigation keys (Backspace, Arrows, etc). Thanks! ...

How does the tooltip control enhance all controls on the form with a new property?

When answering another question I started to wonder how I could Add new properties to all controls in a form just like the ToolTip-control does. For example I could use that to Add a "IsDirty"-flag to all textboxes just by adding the component to the form and it would handle this for every textbox. When adding the tooltip-control to th...

VB.NET and type inference using "Dim"

I'm coming from a C# background and I really like the type inference that C# 3.0 has. I'm trying to do similar things in VB.NET (some of which appear possible), but in some cases the compiler seems to be not nearly as good at inferring the type. For example, I have a method that returns an object of type System.Guid. In C# I'd do thi...

Suggestions for a cheap/free .NET library for doing Zip with AES encryption?

I'm trying to find an zip compression and encryption component with encryption suitable for use by the US Federal Government, so I can't use Zip 2.0 encryption, it has to be AES or the like. I've already found SharpZipLib (can't do AES encyrption), and Chilkat (can do AES encryption, but costs money). Am I missing any other options? ...

C# to VB.Net: Why does this fail to compile when converted to VB?

I have this C# extension method that will extend any dictionary where the Value type is an IList. When I write the equivalent code in VB.Net I get the following compile error: "Extension method 'Add' has some type constraints that can never be satisfied". I find this really puzzling as the same type constraints can be satisfied in...

Long to short pathnames without p/invoke

Does anyone know how to convert long to short pathnames in .net 3.5 without p/invoke? I can do it with p/invoke if I have to, but I'd rather not. ...