You can't directly set the value to null but you can use the format and
parse events on the binding to translate a particular string ("(null)"
for example") to and from DBNull - something like:

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
        AddHandler CtlProducts1.DataBindings("MyUnitPrice").Format,
AddressOf Me.FormatUnitPrice
        AddHandler CtlProducts1.DataBindings("MyUnitPrice").Parse,
AddressOf Me.ParseUnitPrice
    End Sub

    Private Sub FormatUnitPrice(ByVal sender As Object, ByVal ev As
ConvertEventArgs)
        .....
    End Sub

    Private Sub ParseUnitPrice(ByVal sender As Object, ByVal ev As
ConvertEventArgs)
        .....
    End Sub

mark

-----Original Message-----
From: Mike McIntyre [mailto:[EMAIL PROTECTED]] 
Sent: Friday, July 19, 2002 4:10 PM
To: [EMAIL PROTECTED]
Subject: [ADVANCED-DOTNET] Setting textbox.text to NULL

Is it possible to set the text property of a textbox to a System or SQL
type NULL?

I can set a column in a dataset to NULL just fine, using coding.

Now I would like to set the value of textbox.text to NULL on a textbox
bound to the dataset.  This is so I can process the NULL value in the
textbox validate event.

Mike

You can read messages from the Advanced DOTNET archive, unsubscribe from
Advanced DOTNET, or
subscribe to other DevelopMentor lists at http://discuss.develop.com.

You can read messages from the Advanced DOTNET archive, unsubscribe from Advanced 
DOTNET, or
subscribe to other DevelopMentor lists at http://discuss.develop.com.

Reply via email to