1

私はこれをそのように機能させていました....

 Dim AnnEnt As Label = FormView1.FindControl("Holiday_RemainingLabel")

    txtNoofDays.Text.ToString()
    AnnEnt.Text.ToString()

    If txtNoofDays.Text >= AnnEnt.Text Then

        lblHolRequestResponse.Text = "Your holiday could not be saved"
    Else

最近これに変更しましたが、機能しなくなりました

    Dim remain As TextBox = FormView1.FindControl("Holiday_RemainingTextBox")



    txtNoofDays.Text.ToString()
    remain.Text.ToString()

    If txtNoofDays.Text >= remain.Text Then

        lblHolRequestResponse.Text = "Your holiday could not be saved"

    Else

これが機能しないようにするために、フォームビューのテキストボックスとフォームビューのラベルの違いは何ですか?

私はそれ以来試しました...

  Dim days = txtNoofDays.Text

    days.ToString()
    AnnEnt.Text.ToString()
    remain.Text.ToString()
    If remain.Text.ToString < days.ToString Then
        lblHolRequestResponse.Text = "Your holiday could not be saved"
4

1 に答える 1

3

文字列の数値を比較する場合は、それらを数値にキャストします。

例(それらが であると仮定ints):

Dim remain As TextBox = FormView1.FindControl("Holiday_RemainingTextBox")
Dim remaining = Int32.Parse(remain.Text)
Dim numOfDays = Int32.Parse(txtNoofDays.Text)

If numOfDays  >= remaining  Then
    lblHolRequestResponse.Text = "Your holiday could not be saved"
End If

Int32.Parse方法

それ以外の場合は、アルファベット順に比較しています。

String.CompareTo方法

于 2012-04-08T21:59:12.647 に答える