Condition Property of CustomAction

ajeeshco

Well-known member
Joined
Sep 19, 2006
Messages
257
Location
Cochin, India
Programming Experience
3-5
Hi,
In a Setup and deployment project i added a dialog called Textboxes (A). In that dialog I have a textbox EDITA1. I would like to know How can I set the Condition Property so that if the user does not enter anything in that textbox the installation should not continue.

To try this from code I created a custom class inherited from Installer but its not working. The code I tried is given below.

VB.NET:
Imports System.ComponentModel
Imports System.Configuration.Install

<RunInstaller(True)> Public Class InstallerConfiguration
    Inherits Installer

    Public Overrides Sub Install(ByVal stateSaver As System.Collections.IDictionary)
        MyBase.Install(stateSaver)

        If Context.Parameters("MyTextBox") = String.Empty Then
            Throw New InstallException("Please enter a value!")
        End If

    End Sub

End Class

Thx in advance.
 
The problem was String.Empty!

The problem was with the comparison :eek:. Instead of String.Empty you will have use Nothing.

VB.NET:
        If Context.Parameters("MyTextBox") = Nothing Then
            Throw New InstallException("Value is Nothing!")
        End If
 
Back
Top