1

我需要将代码存储在一个字符串中,这样如果一个值为真,它就在代码行中,如果不是真的它不在代码行中。当我填充摘要文本框时,如果咨询金额为“”,那么如果确实有金额包含代码,则不要使用此代码。这可能吗?否则,我将不得不做一堆 if then 语句。当我在下面执行以下操作时,它无法转换为双倍。

Dim ConsultingFee As String 
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
    If Session("ConsultingFeeAmount") = "" Then

    Else
'Store the following line in a string????
        ConsultingFee = +Environment.NewLine + Session("ConsultingFee") + " Amount: " + Session("ConsultingFeeAmount")

    End If



    SummaryTextBox.Text = Session("TeachingHospital") + Environment.NewLine + Session("HospitalAddress") + Environment.NewLine + Session("HospitalCity") + Environment.NewLine + Session("HospitalState") + Environment.NewLine + Session("HospitalZip") + Environment.NewLine + Session("HospitalTIN") + ConsultingFee

End Sub
4

1 回答 1

1

您需要连接到ConsultingFee字符串变量,如下所示:

ConsultingFee = ConsultingFee & Environment.NewLine & Session("ConsultingFee") & " Amount: " & Session("ConsultingFeeAmount")

或者

ConsultingFee &= Environment.NewLine & Session("ConsultingFee") & " Amount: " + Session("ConsultingFeeAmount")
于 2013-06-28T16:13:11.613 回答