AnsweredAssumed Answered

Question asked by cdebruin on Mar 9, 2012
Latest reply on Mar 9, 2012 by rkelso
Sorry about the thread name, accidentally hit enter. Is there a way to edit that?

I'm attempting to save data fields in a form and it appears that when one field is emptied, none of the fields save properly.

Specifically the Rim Elevation field. When that is deleted by the user, all the other fields are deleted as well, but the feature still exists.
I've highlighted where I'm guessing the problem area is. Also, I apologize, the code sloppy as it's being written and edited by 3 different people.

Imports ESRI.ArcGIS.Geometry
Imports ESRI.ArcGIS.Geodatabase
Imports ESRI.ArcGIS.Editor

Public Class FormSanMHedit

Private Sub FormSanMHedit_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
'Debug.Print("Begin Load Formsanmhedit")
Dim pTablesort As ITableSort, pRow As IRow, i As Integer, rCount As Integer
Dim legacyID As String
rCount = ncSewerContractsTable.RowCount(Nothing)
'Debug.Print "Count in NC Sewer Contracts is " & rCount
If rCount <> 0 Then

'Sort ncSewerContractsTable
pTablesort = New TableSort
With pTablesort
.Fields = "CONTRACT"
.Ascending("CONTRACT") = True
.QueryFilter = Nothing
.Table = ncSewerContractsTable
End With


'Get the list from the table, add each to the userform
ncSewerContractsCursor = pTablesort.Rows
pRow = ncSewerContractsCursor.NextRow

i = 0

Do Until pRow Is Nothing
'cmbContract.Items.Column(0, i) = pRow.Value(ncSewerContractsCONTR_IDfld)
'cmbContract.Column(1, i) = pRow.Value(ncSewerContractsCONTRACTfld) & " - " & pRow.Value(ncSewerContractsDESCRIPTIOfld)
'Debug.Print Me.cmbContract.Column(1, i)
pRow = ncSewerContractsCursor.NextRow
i = i + 1
End If

If makeOrEdit = "Enter" Then
'Debug.Print("make mh")
Me.txtMhRimElevNGVD29.Text = ""
Me.txtLegacyMHnum.Text = ""
If Not sanmhLastContractUsed = Nothing Then
Me.cmbContract.ValueMember = sanmhLastContractUsed

Me.cmbContract.ValueMember = ""
End If

Me.txtFlushCount.Text = 0
Me.txtVentNum.Text = ""
Me.txtRemarks.Text = ""

legacyID = checkNullString(sanmhFeature, sanmhLegacy_IDfld)
'Debug.Print("legacyID = " & legacyID)
Me.txtLegacyMHnum.Text = checkNullString(sanmhFeature, sanmhLegacy_IDfld)
'Debug.Print("after reading mh#")
Me.txtMhRimElevNGVD29.Text = checkNullNumber(sanmhFeature, sanmhMHrimElevFld)
Me.cmbContract.SelectedValue = checkNullString(sanmhFeature, sanmhContrBuiltFld)
If Me.cmbContract.Text = Nothing Then
sanmhLastContractUsed = ""
sanmhLastContractUsed = sanmhLastContractUsed
End If
Me.txtFlushCount.Text = checkNullNumber(sanmhFeature, sanmhFlushCountFld)
Me.txtVentNum.Text = checkNullString(sanmhFeature, sanmhVentNumFld)
Me.txtRemarks.Text = checkNullString(sanmhFeature, sanmhMH_RemarksFld)

End If
End Sub

Private Sub btnCancel_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnCancel.Click
End Sub

Private Sub btnOK_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnOK.Click

Dim pPoint As IPoint = Nothing


If makeOrEdit = "Enter" Then
'Debug.Print("Create New Manhole")
sanmhFeature = sanmhFeatClass.CreateFeature
sanmhFeature.Shape = Point
sanmhFeature.Value(sanmhGIDfld) = GetNewGUID()
'Debug.Print "Edit"
End If

If Me.txtFlushCount.Text = Nothing Then
Me.txtFlushCount.Text = 0
End If

''//cdebruin 03/08/2012: Stores a null value to the database if Rim Elev field = "". Else stores the user entered value.
''//Prompts user if non-numeric values are entered in the Rim Elev field.
If Me.txtMhRimElevNGVD29.Text = "" Then
sanmhFeature.Value(sanmhMHrimElevFld) = DBNull.Value
ElseIf IsNumeric(Me.txtMhRimElevNGVD29.Text) Then
sanmhFeature.Value(sanmhMHrimElevFld) = Me.txtMhRimElevNGVD29.Text
MsgBox("Please enter only numeric values in the Rim Elevation Field.", MsgBoxStyle.Exclamation, "Invalid Data Entry")
Exit Sub
End If
sanmhFeature.Value(sanmhLegacy_IDfld) = Me.txtLegacyMHnum.Text
sanmhFeature.Value(sanmhContrBuiltFld) = Me.cmbContract.SelectedValue
sanmhLastContractUsed = Me.cmbContract.SelectedValue
sanmhFeature.Value(sanmhFlushCountFld) = Me.txtFlushCount.Text
sanmhFeature.Value(sanmhVentNumFld) = Me.txtVentNum.Text
sanmhFeature.Value(sanmhMH_RemarksFld) = Me.txtRemarks.Text
StoreNameAndTime(sanmhFeature, makeOrEdit)
End Sub

End Class