-2

dzien=0ボタンを無効にし、有効にする必要がありますdzien >0

アプリケーションを起動すると、日が 0 か 102938129038 かは関係ありませんが、ボタンは無効のままです。コードの何が問題になっていますか?

Imports System.IO.IsolatedStorage
Partial Public Class Page1
Inherits PhoneApplicationPage
Private dzien As Integer
Public Sub New()
    InitializeComponent()
End Sub

Private Sub Button1_Click(sender As System.Object, e As System.Windows.RoutedEventArgs) Handles Button1.Click
    IsolatedStorageSettings.ApplicationSettings("dzien") = dzien
    Try
        dzien = CInt(IsolatedStorageSettings.ApplicationSettings("dzien"))
    Catch ex As KeyNotFoundException
        dzien = 0
    End Try
    If dzien = 0 Then
        dzien = dzien + 1
    End If
    NavigationService.Navigate(New Uri("/2.xaml", UriKind.Relative))
End Sub
Private Sub Class_1_loaded(ByVal sender As Object, ByVal e As System.Windows.RoutedEventArgs) Handles Me.Loaded
    If dzien = 0 Then
        Button2.IsEnabled = False
    Else
        Button2.IsEnabled = True
    End If

End Sub
Private Sub Button2_Click(sender As System.Object, e As System.Windows.RoutedEventArgs) Handles Button2.Click

    dzien = dzien + 1

    NavigationService.Navigate(New Uri("/2.xaml", UriKind.Relative))
End Sub
End Class

かどうかわかりません

If dzien = 0 Then
    dzien = dzien + 1
End If

うまく機能し、

dzien = dzien + 1
4

2 に答える 2

3
Private Sub Class_1_loaded(ByVal sender As Object, ByVal e As System.Windows.RoutedEventArgs) Handles Me.Loaded
If dzien = 0 Then
   Button2.Enabled = False
Else 
   Button2.Enabled = True
End Sub
于 2012-10-10T12:59:22.207 に答える
0

よくわかりませんが、.ENABLED.ISENABLEDが同じでない場合、それが問題だと思います...

于 2012-10-11T10:43:00.947 に答える