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