我需要将代码存储在一个字符串中,这样如果一个值为true,它就在代码行中,如果不是,则它不在代码行中。当我填写summarytextbox时,如果咨询金额是“”,那么如果确实有金额包括代码,则不要使用此代码。这可能吗?其他明智的是,如果当时的陈述,我将不得不做一堆。当我在下面执行以下操作时,它无法转换为double。
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
答案 0 :(得分:1)
您需要连接到ConsultingFee
字符串变量,如下所示:
ConsultingFee = ConsultingFee & Environment.NewLine & Session("ConsultingFee") & " Amount: " & Session("ConsultingFeeAmount")
OR
ConsultingFee &= Environment.NewLine & Session("ConsultingFee") & " Amount: " + Session("ConsultingFeeAmount")