Monday, January 18, 2010

This is the title

oct07-08-1024

Thursday, December 17, 2009

VB6 Ceiling Function

Ceiling - The integer equal or higher than a given value ' Returns the integer equal or higher than its argument

Function Ceiling(Number As Double) As Long
    Ceiling = -Int(-Number)
End Function
Originally from [Link]

Labels: ,

Thursday, November 12, 2009

VB - base64 encode/decode

A Colleague was working on removing a 3rd party component from an old ASP website. The only function still being provided by the 3rd party component was Base64 encoding. He was trying to get Base64 working directly in vbscript. We eventually decided to go with a VB6 DLL that would expose Encode/Decode functions which in turn would use the MSXML library to create a Base64 encoded string.

Here's the code...

Option Explicit

Public Function Encode(ByRef StringToEncode As String) As String

   Dim lobjXML As MSXML2.DOMDocument
   Dim lobjNode As MSXML2.IXMLDOMElement
   Dim lConvertedString() As Byte
 
   Set lobjXML = New MSXML2.DOMDocument
   Set lobjNode = objXML.createElement("b64")
   lobjNode.dataType = "bin.base64"
 
   ConvertedString = StrConv(StringToEncode, vbFromUnicode) ' Convert to ByteArray
 
   lobjNode.nodeTypedValue = ConvertedString
   Encode = lobjNode.Text
 
   Set lobjNode = Nothing
   Set lobjXML = Nothing

End Function

Public Function Decode(ByVal EncodedString As String) As String

   Dim lobjXML As MSXML2.DOMDocument
   Dim lobjNode As MSXML2.IXMLDOMElement
   Dim lDecodedString As String
 
   Set lobjXML = New MSXML2.DOMDocument
   Set lobjNode = objXML.createElement("b64")
   lobjNode.dataType = "bin.base64"
   lobjNode.Text = strData
 
   Decode = StrConv(lobjNode.nodeTypedValue, vbUnicode) 'Convert it back into a string to return
 
   Set lobjNode = Nothing
   Set lobjXML = Nothing

End Function

Wednesday, October 21, 2009

Compare two worksheets using VBA in Microsoft Excel

When shared workbooks fail....

and you need to merge the two different copies (if the automatic merge won't work) you can use the VBA code at this site to get the differences between two worksheets and then manually (or write some more VBA code) merge the changes back into the original.

[Link]

Labels: ,

Wednesday, October 14, 2009

Windows service marked for deletion...

Getting the following error when trying to install a service?

"The specified service has been marked for deletion"

See the following blog entry http://weblogs.asp.net/avnerk/archive/2007/09/05/windows-services-services-msc-and-the-quot-this-service-is-marked-for-deletion-quot-error.aspx

(hint: close all services windows down and kill mmc.exe via task manager if necessary)

Friday, October 09, 2009

.net University

Mentioned today on Visual C# Headlines...

From the website....

What is .NET University? Welcome to .NET University! Our mission is very simple. We want to give you a good developer-oriented overview of new and existing Microsoft technologies, and empower you to help others learn about .NET-related technologies.

Contains slides, demos, downloadble videos and hands on labs....

[Link]

Tuesday, September 29, 2009

SQL Server - Turn FOREIGN key constraint OFF/ON

To turn the constraint off...

ALTER TABLE <table name> NOCHECK CONSTRAINT <constraint_name>

and to turn it back on...

ALTER TABLE <table name> CHECK CONSTRAINT <constraint_name>

Labels: ,

More information

About this site

@ndyRobinson.com is the online home of Andy Robinson, a recovering vb6 developer (now doing C#), living and working in the UK (Brighton).

My del.icio.us