Home All Groups Group Topic Archive Search About

Problem reading data into Maskedit box

Author
7 Nov 2006 9:10 PM
Kenneth Keys
I am writting a program for school using Visual Studio .Net 2003.  I am able
to load the data into a dataset and display it in a list box but when the
user double clicks on a line of data I receive an error.  The program works
when the line formatting the phone number is remarked out.  The error I get
is "An unhandled exception of type
'System.Runtime.InteropServices.COMException' occurred in axinterop.msmask.dll
Additional information: Exception from HRESULT: 0x800A017C
(CTL_E_INVALIDPROPERTYVALUE)."
It refers to this line of code:
mskPhone.CtlText = Format(Val(.Rows(I).Item("Phone")), "000-000-0000")

here is the sub function:
Private Sub lstNamePhone_DoubleClick(ByVal sender As Object, ByVal e
As System.EventArgs) Handles lbxAllData.DoubleClick
        Dim I As Integer
        I = lbxAllData.SelectedIndex
        With DataSet11.Directory
            tbxName.Text = CStr(.Rows(I).Item("Name"))
            mskPhone.CtlText = Format(Val(.Rows(I).Item("Phone")),
"000-000-0000")
            tbxAddress.Text = CStr(.Rows(I).Item("Address"))
            tbxCity.Text = CStr(.Rows(I).Item("City"))
            tbxState.Text = CStr(.Rows(I).Item("State"))
            tbxZipCode.Text = CStr(.Rows(I).Item("ZipCode"))
        End With
    End Sub

I don't know what I am doing wrong or how to correct this problem.

AddThis Social Bookmark Button