我编辑了这个应该计算业务连接和住宅连接的程序

时间:2015-04-07 15:41:50

标签: vb.net

对于住宅用户,它是4.50处理费,30基本服务费和每通道5。对于商业客户,处理费= 16.50,前10个连接的基本服务费为80,每增加4个,每个通道50个  我编辑了这个必须使用两个函数的程序。业务连接和住宅连接,我想显示3条错误消息,Premium Channels是必填字段,Customer Type是必填字段,如果选中business business复选框,则会显示错误消息,显示Business Business必须选择1或更多连接。“任何人都可以告诉我为什么只有商业客户必须选择1个或多个连接不显示。(其他两个确实显示)

listboximage

'创建一个函数,以便通过的所有数据都是有效的

Private Function Data_Validated_ok() As Boolean



    Dim intErrCount As Integer
    Dim strErrMessage As String = String.Empty
    Dim ctrlError As New Collection




    ' make sure Premium channel is selected

    If Me.lstPremium.SelectedIndex < 0 Then
        intErrCount = intErrCount + 1
        strErrMessage &= intErrCount & ". Premium Channels is a required field." _
        & vbCrLf
        ctrlError.Add(lstPremium.SelectedIndex)
    End If
    ' make sure a customer type is selected in the Radioboxes

    If radBusiness.Checked = False And
                radResidential.Checked = False Then
        intErrCount = intErrCount + 1
        strErrMessage &= intErrCount & ".Customer Type is a required field." _
         & vbCrLf
        ctrlError.Add(radBusiness.Checked, CStr(radResidential.Checked))
    End If

    ' make sure a business customer checks at least one option in the listbox

    If radBusiness.Checked = True And Me.lstConnections.SelectedIndex < 0 Then
        intErrCount = intErrCount + 1
        strErrMessage &= intErrCount & ". Business Customers must select 1 or more Connection." _
        & vbCrLf
        ctrlError.Add(lstConnections.SelectedIndex)
    End If

    'if any errors display a message box with the list of errors
    If intErrCount > 0 Then
        MessageBox.Show(strErrMessage, "Validation Rule(s)", MessageBoxButtons.OK, MessageBoxIcon.Information)



        Return False
    Else
        Return True
    End If

End Function

0 个答案:

没有答案