DataTable detect column changed using ColumnChanged event

Background

Because of disconnected nature of VB.Net databinding I have users who have come from MS Access instant save who in .Net are concerned that they fogot to press save. Hence I added CheckForChangesAndPromptForSave. However this is firing too much. I have too much code and something must be changing a column but need to detect which and probably stop changing it.

Solution

Open Dataset and select table with changes. View Code. This generates new code window if not present. On table event use the ColumnChanged event.

Partial Class dsBusiness
    Partial Class QuoteDataTable

        Private Sub QuoteDataTable_ColumnChanged(sender As Object, e As System.Data.DataColumnChangeEventArgs) Handles Me.ColumnChanged
            MsgBox(e.Column.ColumnName)
        End Sub

    End Class
End Class

Windows Remote Assist – A program could not start

The client was using an XP machine inside a network. Tried to get them to send me a remote assist request, but on send or save invite got a message:

Title: Message from webpage
Message: A program could not start. Please try again.

I had several go’s myself with changing several functions, but then spoke to the people who set up the network who said that security would have to be changed. They suggested that we use: Join-Me instead. Join-Me seemed easy enough to use.

Visual Studio 2010 with Crystal Reports error ‘ The type initializer for ‘CrystalDecisions.Shared.SharedUtils’ threw an exception’

On a x64 PC

‘ The type initializer for ‘CrystalDecisions.Shared.SharedUtils’ threw an exception’

Project properties > Compile > Advanced Compile Options > Target CPU change to X86

Or on install of SAP Crystal Reports Version for Visual Studio 2010 tick box for running x64

With thanks to

http://www.logicaltrinkets.com/wordpress/?p=213

and for runtime

http://www.businessobjects.com/jump/xi/crvs2010/us2_default.asp

 

How to show XML Comments when using an assembly dll in another project

In the assembly to be redistributed ensure that

VB.Net

Properties > Compile > “Generate XML documentation file” is ticked

Build the project. When copying the dll to the place where you wish to use it, also copy the xml file

 

C#

Properties > Build > Output > “XML documentation file” tick

This may create a lot of warnings.

“Missing XML comment for publicly visible type or member ””

To suppress these XML comment missing warnings, then on same page “Suppress Warnings” add 1591

 

 

Error: Format of the initialization string does not conform to specification starting at index 0

The connection string is wrong

Add settings connection string to an existing Dataset

Scenario / Solution

Existing project with no settings file and related connection string

Do not start by creating the settings file. Instead start with the dataset.

Configure an existing table and retreat back through the wizard to:

“Do you want to save the connection string to the application configuration file?”

Tick Yes and give it a name.

This will generate the settings files and the app.config, but will also generate a lot of errors. The errors include

“‘et’ is not declared. It may be inaccessible due to its protection level”

“‘ype’ is not declared. It may be inaccessible due to its protection level”

Save and close the dataset. You then get additional errors:

“‘conStrApplication’ is not a member of ‘<namespace>'”

Navigate to the first error “‘ype’ is not declared…”

and after “Public ReadOnlyProperty conStrApplication() AsString” type a return and delete. This should clear all errors.

 

 

 

 

How do I … use Extension Methods in VB.Net and compile and use them in multiple projects

If you take the following example. Please note:

  • Import CompilerServices
  • Namespace
  • Public Module
  • <Extesion()> attribute

Compile as normal into a dll and reference this dll in another project.
Then to use this extension import the Namespace dll root namespace .NewFeatures to the top of the class/form that you wish to use it on. Should then work.

 

Imports System.Runtime.CompilerServices

Namespace NewFeatures
Public Module BindingSourceExtension

<Extension()> _
Sub RemoveFilterSort(ByVal aBindingSource As BindingSource)
If aBindingSource.Filter IsNot Nothing Then aBindingSource.RemoveFilter()
If aBindingSource.Sort IsNot Nothing Then aBindingSource.RemoveSort()
End Sub

End Module
End Namespace

 

 

SQL Synonym

During study for Exam 70-461 looked at Synonym

Could be useful. For instance could use synonym to point at a data table in linked “Live” database. Then restore your project to “Test” version, change the synonym to point at the linked “Test” database and you have changed what all objects now point at.

http://blog.sqlauthority.com/2008/01/07/sql-server-2005-introduction-and-explanation-to-synonym-helpful-t-sql-feature-for-developer/

 

How do I hide a table in Word using VB or VBA

See

http://social.msdn.microsoft.com/Forums/en-US/worddev/thread/3ce3285e-0993-4d82-9d9f-eac30a18e4a6/

MyTable.Range.Font.Hidden = True

or

With ActiveDocument.Tables(1).Range.Font
.Hidden = Not .Hidden
End With

Be careful there are options in word to show/print hidden items.
In Word 2003 see Tools > Options > Print > Section “Include with Document” for option “Hidden Text”

Also Show/Hide mark up will show the table for developers.

 

Unable to apply publish properties for item “ApplicationCode\SystemNames.xml”

Solved with thanks to:

http://stackoverflow.com/questions/9284375/unable-to-apply-publish-properties-for-item-x

“It appears that the issue is related to ClickOnce. Navigate to the project, right click on it and click on properties. Go to the Publish tab and click on Application Files. Check the ‘Show all files’ checkbox and scroll through the list of files. Eventually, you will come across the file that has a yellow exclamation point on it. This file is orphaned and needs to be removed. Right click on the file and there should be a remove option.

Now build the solution and the warning should be gone.”