创建一个确认,该确认如果用户取消

发布于 2025-02-03 06:22:37 字数 3531 浏览 2 评论 0原文

因此,我目前有一个我有4个团队的表格,每个团队都有4个队友。这不会改变。

我的表格GUI

最初在程序启动时,它会自动选择“当前值”广播按钮带有空白数据的标签,您可以选择“编辑值”,可以通过按“大绿色应用”按钮来保存。这将数据存储在名为stteamname的2D阵列下,每当您再次选择“当前值”时,标签引用。

有4个无线电按钮可让您在团队之间切换。

我的问题是,当我更改无线电按钮时,将删除尚未保存的文本标签中的任何数据将被删除。

我通过添加a

但是,我唯一的问题是,在取消此消息后,单个按钮停留在当前选择中,这无济于事。

我通过使用rbteamname1.checked = true(rbteamname 1至4为名为1-4的无线电按钮)解决此问题,以切换回上一个状态。

当然,无论如何,这都只能返回到rbteamname1,因此我使用了1D数组并选择案例来帮助解决此问题。

“”“

Dim RadioCounter(1) As Integer 

下面的代码仅在负载上给出默认的无线电按钮值。

Sub DeclareRadio(RadioButton)
RadioButton(1) = 1

'结束sub

“”“

每当成功选择一个无线电按钮时,RadioCounter(1)分别设置为数字1-4。每当选择一个新的广播按钮时,RadioCounter(1)的值就会移动到RadioCounter(0),并且当前的无线电按钮的值是RadioCounter(1)。

如果用户选择否,则引用RadioCounter(0)的值,并且选择案例选择“单选”按钮。

(请注意,radioteam()用作存储团队名称和队友名称字符串变量在2D数组中正确的计数器:stteamname。我很可能会在解决此问题后立即将其与RadioCounter合并,一旦解决了此

问题 sub rbteamname1_checkedChanged(作为对象的发送者作为evensArgs)处理rbteamname1.CheckedChanged

    'note txtTeamName starts at 0, however RadioTeam starts at 1, RadioTeam = 0 has no team designated to it.

    'this function is for swapping teams via radio button, each time, a confirmation is given to make sure the user saves the current team, or risk deletion of the inputted data.

    RadioCounter(1) = RadioCounter(0)

    stTeamname(0, RadioTeam) = txtTeamName.Text
    stTeamname(1, RadioTeam) = txtMate1.Text
    stTeamname(2, RadioTeam) = txtMate2.Text
    stTeamname(3, RadioTeam) = txtMate3.Text
    stTeamname(4, RadioTeam) = txtMate4.Text



    Dim Dialog As DialogResult

    Dialog = MessageBox.Show("Are you sure you want to change team? Any unsaved changes will be lost. If this box shows on starting the program, just press no", "Change team?", MessageBoxButtons.YesNo)

    If Dialog = DialogResult.No Then

        'need to run function to check previous result of radio button'



        Select Case RadioCounter(0)
            Case 1
                rbTeamName1.Checked = True
            Case 2
                rbTeamName2.Checked = True
            Case 3
                rbTeamName3.Checked = True
            Case 4
                rbTeamName4.Checked = True
        End Select


    ElseIf Dialog = DialogResult.Yes Then

        RadioCounter(1) = 1 'this equals the respective number for each radio button'

        RadioTeam = 1

        txtTeamName.Text = stTeamname(0, RadioTeam)
        txtMate1.Text = stTeamname(1, RadioTeam)
        txtMate2.Text = stTeamname(2, RadioTeam)
        txtMate3.Text = stTeamname(3, RadioTeam)
        txtMate4.Text = stTeamname(4, RadioTeam)

        lblTeamName.Text = stTeamname(0, RadioTeam)
        lblMate1.Text = stTeamname(1, RadioTeam)
        lblMate2.Text = stTeamname(2, RadioTeam)
        lblMate3.Text = stTeamname(3, RadioTeam)
        lblMate4.Text = stTeamname(4, RadioTeam)

    End If


End Sub

“”“

....或应该这样做。但这不是。我不确定为什么,但是当我强迫它来检查特定的广播按钮时,通过删除选定案例,并且仅运行rbteamname4.checked = true它可以很好地工作根本不运行代码。

另外,尽管stteamname(0,radioteam)= txtteamname.text等。仍然不会保存这些参数,我觉得这很奇怪。

理想的解决方案是什么?

要澄清:

如果用户写下团队名称和队友,并且不按“应用按钮”保存,然后选择另一个广播按钮来更改团队,则应出现一个文本框,询问他们是否要切换团队并丢失数据(是)或停留在上一个广播按钮上进行编辑并应用数据(否)。

按下NO后,该程序会自动将当前的单调按钮切换到上一个选择,使其似乎首先选择了无线电按钮。

我不确定我是否必须使它变得明显,但我对Stackoverflow和VB.NET的新手很新。先感谢您。

So I currently have a form where I have 4 teams, each with 4 teammates. This cannot change.

my form GUI

Initially when the program starts, it automatically selects the "current value" radio button which displays labels with blank data, you can then select "edit values" which can be saved by pressing the big green apply button. This stores the data under a 2d array named stTeamName, which the labels reference whenever you select "current value" again.

There are 4 radio buttons which allow you to switch between the teams.

My problem is, when I change the radio buttons, any data put into the text labels that has not been saved will be deleted.

I solved this problem by adding a message box which will stop the data in the labels from changing unless the user gives confirmation to do so.

However, my only problem is that after I cancel this, the radio button stays at the current selection which does not help.

I solved this issue by using rbTeamName1.Checked = True (rbTeamname 1 to 4 being the radio buttons named team 1-4) to switch back to the previous state.

This of course only goes back to rbTeamname1 no matter what, so I employed an 1d array and select case to help solve this issue.

"""

Dim RadioCounter(1) As Integer 

the code below simply gives the default Radio button value on load.`

Sub DeclareRadio(RadioButton)
RadioButton(1) = 1

End Sub

"""

Whenever a radio button is successfully selected, RadioCounter(1) is set to the number 1-4 respectively. Whenever a new radio button is selected, the value of RadioCounter(1) is moved to RadioCounter(0) and the current radio button's value is to RadioCounter(1).

If the user selects no, RadioCounter(0)'s value is referenced and a select case selects the radio button.

(Please note, RadioTeam() is used as a counter to store Team name and Teammate name string variables correctly within the 2d array: stTeamName. I will most likely merge this with RadioCounter as soon as I get this problem fixed)

"""

Private Sub rbTeamName1_CheckedChanged(sender As Object, e As EventArgs) Handles rbTeamName1.CheckedChanged

    'note txtTeamName starts at 0, however RadioTeam starts at 1, RadioTeam = 0 has no team designated to it.

    'this function is for swapping teams via radio button, each time, a confirmation is given to make sure the user saves the current team, or risk deletion of the inputted data.

    RadioCounter(1) = RadioCounter(0)

    stTeamname(0, RadioTeam) = txtTeamName.Text
    stTeamname(1, RadioTeam) = txtMate1.Text
    stTeamname(2, RadioTeam) = txtMate2.Text
    stTeamname(3, RadioTeam) = txtMate3.Text
    stTeamname(4, RadioTeam) = txtMate4.Text



    Dim Dialog As DialogResult

    Dialog = MessageBox.Show("Are you sure you want to change team? Any unsaved changes will be lost. If this box shows on starting the program, just press no", "Change team?", MessageBoxButtons.YesNo)

    If Dialog = DialogResult.No Then

        'need to run function to check previous result of radio button'



        Select Case RadioCounter(0)
            Case 1
                rbTeamName1.Checked = True
            Case 2
                rbTeamName2.Checked = True
            Case 3
                rbTeamName3.Checked = True
            Case 4
                rbTeamName4.Checked = True
        End Select


    ElseIf Dialog = DialogResult.Yes Then

        RadioCounter(1) = 1 'this equals the respective number for each radio button'

        RadioTeam = 1

        txtTeamName.Text = stTeamname(0, RadioTeam)
        txtMate1.Text = stTeamname(1, RadioTeam)
        txtMate2.Text = stTeamname(2, RadioTeam)
        txtMate3.Text = stTeamname(3, RadioTeam)
        txtMate4.Text = stTeamname(4, RadioTeam)

        lblTeamName.Text = stTeamname(0, RadioTeam)
        lblMate1.Text = stTeamname(1, RadioTeam)
        lblMate2.Text = stTeamname(2, RadioTeam)
        lblMate3.Text = stTeamname(3, RadioTeam)
        lblMate4.Text = stTeamname(4, RadioTeam)

    End If


End Sub

"""

....Or it should do that. But it doesnt. Im not sure why, but when I force it to check a specific radio button, by removing the select case and only running rbTeamName4.Checked = True it will work perfectly fine, theres something about the select case that simply doesnt run the code.

Also, despite stTeamname(0, RadioTeam) = txtTeamName.Text etc. being given before the messagebox shows, if I do not press the apply button to save, press another team button, then press no, it will still not save those parameters, which I find extremely weird.

What is the ideal solution to this?

To clarify:

If a user writes team names and teammates and does not press the apply button to save and then changes team by selecting another radio button, a text box should appear asking whether they want to switch team and lose the data (Yes) or stay on the previous radio button to edit and apply the data (No).

Upon pressing no, the program automatically switches the current radio button to the previous selection to make it seem as if no radio button was selected in the first place.

And im not sure if I have to make it obvious but im new to both stackoverflow and VB.net in general. Thank you in advance.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

尘世孤行 2025-02-10 06:22:37

本质上,您要的是肮脏的检查。基本原则是您需要将价值与以前的价值进行比较。

因此:例如:

  1. 表单级别的布尔变量设置为trui
  2. 当文本框值更改时,在转到切换团队或当前/编辑时,将
  3. ,您将检查该级别级别的boolean变量是否为trui,如果变量为true,则您将显示提示 执行操作
  4. ,否则,只需在操作之后

,重置全局级别布尔变量会有一些警告,例如,当您在电流/编辑之间切换/编辑时,更改的检查将两次开火:一次用于当前的单个单选按钮,一次进行编辑。但是您只需要解决这些边缘案例即可。

这是一个未经测试的示例,您可以摆脱:

Imports System.ComponentModel
Imports System.Runtime.CompilerServices

Public Class Form1

    Private _team1 As Team
    Private _team2 As Team
    Private _team3 As Team
    Private _team4 As Team
    Private _isFormDirty As Boolean = False
    Private _selectedTeamRadioButton = RadioButtonTeam1

    Private Sub RadioButtonCurrent_CheckedChanged(sender As Object, e As EventArgs) Handles RadioButtonCurrent.CheckedChanged
        If (RadioButtonCurrent.Checked AndAlso _isFormDirty AndAlso MessageBox.Show("By doing this, you will lose all unsaved changes. Are you sure?", "Dirty Form", MessageBoxButtons.YesNo, MessageBoxIcon.Question) = DialogResult.No) Then
            RadioButtonEdit.Checked = True
            Return
        End If
        If (Not RadioButtonCurrent.Checked) Then
            Return
        End If
        TextBoxTeamName.Enabled = False
        TextBoxTeammate1.Enabled = False
        TextBoxTeammate2.Enabled = False
        TextBoxTeammate3.Enabled = False
        TextBoxTeammate4.Enabled = False
        ResetTeam()
    End Sub

    Private Sub RadioButtonEdit_CheckedChanged(sender As Object, e As EventArgs) Handles RadioButtonEdit.CheckedChanged
        TextBoxTeamName.Enabled = True
        TextBoxTeammate1.Enabled = True
        TextBoxTeammate2.Enabled = True
        TextBoxTeammate3.Enabled = True
        TextBoxTeammate4.Enabled = True
    End Sub

    Private Sub RadioButtonTeamChanged(sender As Object, e As EventArgs) Handles RadioButtonTeam1.CheckedChanged, RadioButtonTeam2.CheckedChanged, RadioButtonTeam3.CheckedChanged, RadioButtonTeam4.CheckedChanged
        If (_selectedTeamRadioButton IsNot DirectCast(sender, RadioButton) AndAlso _isFormDirty AndAlso MessageBox.Show("By doing this, you will lose all unsaved changes. Are you sure?", "Dirty Form", MessageBoxButtons.YesNo, MessageBoxIcon.Question) = DialogResult.No) Then
            _selectedTeamRadioButton.Checked = True
            Return
        End If
        If (_selectedTeamRadioButton IsNot DirectCast(sender, RadioButton)) Then
            Return
        End If
        _selectedTeamRadioButton = DirectCast(sender, RadioButton)
        ResetTeam()
    End Sub

    Private Sub TextBoxTeamValueChanged(sender As Object, e As EventArgs) Handles TextBoxTeamName.TextChanged, TextBoxTeammate1.TextAlignChanged, TextBoxTeammate2.TextAlignChanged, TextBoxTeammate3.TextAlignChanged, TextBoxTeammate4.TextAlignChanged
        _isFormDirty = True
    End Sub

    Private Sub ButtonApply_Click(sender As Object, e As EventArgs) Handles ButtonApply.Click
        Select Case True
            Case RadioButtonTeam1.Checked
                _team1 = New Team() With {
                    .Name = TextBoxTeamName.Text,
                    .Teammate1 = TextBoxTeammate1.Text,
                    .Teammate2 = TextBoxTeammate2.Text,
                    .Teammate3 = TextBoxTeammate3.Text,
                    .Teammate4 = TextBoxTeammate4.Text
                }
            Case RadioButtonTeam2.Checked
                _team2 = New Team() With {
                    .Name = TextBoxTeamName.Text,
                    .Teammate1 = TextBoxTeammate1.Text,
                    .Teammate2 = TextBoxTeammate2.Text,
                    .Teammate3 = TextBoxTeammate3.Text,
                    .Teammate4 = TextBoxTeammate4.Text
                }
            Case RadioButtonTeam3.Checked
                _team3 = New Team() With {
                    .Name = TextBoxTeamName.Text,
                    .Teammate1 = TextBoxTeammate1.Text,
                    .Teammate2 = TextBoxTeammate2.Text,
                    .Teammate3 = TextBoxTeammate3.Text,
                    .Teammate4 = TextBoxTeammate4.Text
                }
            Case RadioButtonTeam4.Checked
                _team4 = New Team() With {
                    .Name = TextBoxTeamName.Text,
                    .Teammate1 = TextBoxTeammate1.Text,
                    .Teammate2 = TextBoxTeammate2.Text,
                    .Teammate3 = TextBoxTeammate3.Text,
                    .Teammate4 = TextBoxTeammate4.Text
                }
        End Select
        _isFormDirty = False
    End Sub

    Private Sub ButtonDeleteTeam_Click(sender As Object, e As EventArgs) Handles ButtonDeleteTeam.Click
        If (MessageBox.Show("Are you sure you want to delete this team?", "Delete", MessageBoxButtons.YesNo, MessageBoxIcon.Question) = DialogResult.No) Then
            Return
        End If
        _isFormDirty = False
        Select Case True
            Case RadioButtonTeam1.Checked
                _team1 = New Team()
            Case RadioButtonTeam2.Checked
                _team2 = New Team()
            Case RadioButtonTeam3.Checked
                _team3 = New Team()
            Case RadioButtonTeam4.Checked
                _team4 = New Team()
        End Select
        ResetTeam()
    End Sub

    Private Sub ResetTeam()
        Dim selectedTeam As Team = Nothing
        Select Case True
            Case RadioButtonTeam1.Checked
                selectedTeam = _team1
            Case RadioButtonTeam2.Checked
                selectedTeam = _team2
            Case RadioButtonTeam3.Checked
                selectedTeam = _team3
            Case RadioButtonTeam4.Checked
                selectedTeam = _team4
        End Select

        If (selectedTeam IsNot Nothing) Then
            TextBoxTeamName.Text = selectedTeam.Name
            TextBoxTeammate1.Text = selectedTeam.Teammate1
            TextBoxTeammate2.Text = selectedTeam.Teammate2
            TextBoxTeammate3.Text = selectedTeam.Teammate3
            TextBoxTeammate4.Text = selectedTeam.Teammate4
        Else
            TextBoxTeamName.Clear()
            TextBoxTeammate1.Clear()
            TextBoxTeammate2.Clear()
            TextBoxTeammate3.Clear()
            TextBoxTeammate4.Clear()
        End If
    End Sub

End Class

Public Class Team
    Implements INotifyPropertyChanged

    Private _name As String
    Public Property Name As String
        Get
            Return _name
        End Get
        Set(value As String)
            If (_name <> value) Then
                _name = value
                NotifyPropertyChanged()
            End If
        End Set
    End Property

    Private _teammate1 As String
    Public Property Teammate1 As String
        Get
            Return _teammate1
        End Get
        Set(value As String)
            If (_teammate1 <> value) Then
                _teammate1 = value
                NotifyPropertyChanged()
            End If
        End Set
    End Property

    Private _teammate2 As String
    Public Property Teammate2 As String
        Get
            Return _teammate2
        End Get
        Set(value As String)
            If (_teammate2 <> value) Then
                _teammate2 = value
                NotifyPropertyChanged()
            End If
        End Set
    End Property

    Private _teammate3 As String
    Public Property Teammate3 As String
        Get
            Return _teammate3
        End Get
        Set(value As String)
            If (_teammate3 <> value) Then
                _teammate3 = value
                NotifyPropertyChanged()
            End If
        End Set
    End Property

    Private _teammate4 As String
    Public Property Teammate4 As String
        Get
            Return _teammate4
        End Get
        Set(value As String)
            If (_teammate4 <> value) Then
                _teammate4 = value
                NotifyPropertyChanged()
            End If
        End Set
    End Property

    Public Event PropertyChanged As PropertyChangedEventHandler Implements INotifyPropertyChanged.PropertyChanged

    Private Sub NotifyPropertyChanged(<CallerMemberName()> Optional propertyName As String = Nothing)
        RaiseEvent PropertyChanged(Me, New PropertyChangedEventArgs(propertyName))
    End Sub

End Class

Essentially what you are asking for is dirty form checking. The basic principle is that you need to compare the value to what it was previously.

So for example:

  1. When the TextBox values change, set a form level boolean variable to true
  2. When you go to switch teams or current/edit you would check if that form level boolean variable is true
  3. If the variable is true then you would display the prompt, otherwise just do the action
  4. After the action, reset the global level boolean variable

There are some caveats, for example, when you toggle between current/edit the check changed will fire twice: once for the current radio button and once for the edit. But you just need to work around those edge cases.

Here is a largely untested example for you to go off of:

Imports System.ComponentModel
Imports System.Runtime.CompilerServices

Public Class Form1

    Private _team1 As Team
    Private _team2 As Team
    Private _team3 As Team
    Private _team4 As Team
    Private _isFormDirty As Boolean = False
    Private _selectedTeamRadioButton = RadioButtonTeam1

    Private Sub RadioButtonCurrent_CheckedChanged(sender As Object, e As EventArgs) Handles RadioButtonCurrent.CheckedChanged
        If (RadioButtonCurrent.Checked AndAlso _isFormDirty AndAlso MessageBox.Show("By doing this, you will lose all unsaved changes. Are you sure?", "Dirty Form", MessageBoxButtons.YesNo, MessageBoxIcon.Question) = DialogResult.No) Then
            RadioButtonEdit.Checked = True
            Return
        End If
        If (Not RadioButtonCurrent.Checked) Then
            Return
        End If
        TextBoxTeamName.Enabled = False
        TextBoxTeammate1.Enabled = False
        TextBoxTeammate2.Enabled = False
        TextBoxTeammate3.Enabled = False
        TextBoxTeammate4.Enabled = False
        ResetTeam()
    End Sub

    Private Sub RadioButtonEdit_CheckedChanged(sender As Object, e As EventArgs) Handles RadioButtonEdit.CheckedChanged
        TextBoxTeamName.Enabled = True
        TextBoxTeammate1.Enabled = True
        TextBoxTeammate2.Enabled = True
        TextBoxTeammate3.Enabled = True
        TextBoxTeammate4.Enabled = True
    End Sub

    Private Sub RadioButtonTeamChanged(sender As Object, e As EventArgs) Handles RadioButtonTeam1.CheckedChanged, RadioButtonTeam2.CheckedChanged, RadioButtonTeam3.CheckedChanged, RadioButtonTeam4.CheckedChanged
        If (_selectedTeamRadioButton IsNot DirectCast(sender, RadioButton) AndAlso _isFormDirty AndAlso MessageBox.Show("By doing this, you will lose all unsaved changes. Are you sure?", "Dirty Form", MessageBoxButtons.YesNo, MessageBoxIcon.Question) = DialogResult.No) Then
            _selectedTeamRadioButton.Checked = True
            Return
        End If
        If (_selectedTeamRadioButton IsNot DirectCast(sender, RadioButton)) Then
            Return
        End If
        _selectedTeamRadioButton = DirectCast(sender, RadioButton)
        ResetTeam()
    End Sub

    Private Sub TextBoxTeamValueChanged(sender As Object, e As EventArgs) Handles TextBoxTeamName.TextChanged, TextBoxTeammate1.TextAlignChanged, TextBoxTeammate2.TextAlignChanged, TextBoxTeammate3.TextAlignChanged, TextBoxTeammate4.TextAlignChanged
        _isFormDirty = True
    End Sub

    Private Sub ButtonApply_Click(sender As Object, e As EventArgs) Handles ButtonApply.Click
        Select Case True
            Case RadioButtonTeam1.Checked
                _team1 = New Team() With {
                    .Name = TextBoxTeamName.Text,
                    .Teammate1 = TextBoxTeammate1.Text,
                    .Teammate2 = TextBoxTeammate2.Text,
                    .Teammate3 = TextBoxTeammate3.Text,
                    .Teammate4 = TextBoxTeammate4.Text
                }
            Case RadioButtonTeam2.Checked
                _team2 = New Team() With {
                    .Name = TextBoxTeamName.Text,
                    .Teammate1 = TextBoxTeammate1.Text,
                    .Teammate2 = TextBoxTeammate2.Text,
                    .Teammate3 = TextBoxTeammate3.Text,
                    .Teammate4 = TextBoxTeammate4.Text
                }
            Case RadioButtonTeam3.Checked
                _team3 = New Team() With {
                    .Name = TextBoxTeamName.Text,
                    .Teammate1 = TextBoxTeammate1.Text,
                    .Teammate2 = TextBoxTeammate2.Text,
                    .Teammate3 = TextBoxTeammate3.Text,
                    .Teammate4 = TextBoxTeammate4.Text
                }
            Case RadioButtonTeam4.Checked
                _team4 = New Team() With {
                    .Name = TextBoxTeamName.Text,
                    .Teammate1 = TextBoxTeammate1.Text,
                    .Teammate2 = TextBoxTeammate2.Text,
                    .Teammate3 = TextBoxTeammate3.Text,
                    .Teammate4 = TextBoxTeammate4.Text
                }
        End Select
        _isFormDirty = False
    End Sub

    Private Sub ButtonDeleteTeam_Click(sender As Object, e As EventArgs) Handles ButtonDeleteTeam.Click
        If (MessageBox.Show("Are you sure you want to delete this team?", "Delete", MessageBoxButtons.YesNo, MessageBoxIcon.Question) = DialogResult.No) Then
            Return
        End If
        _isFormDirty = False
        Select Case True
            Case RadioButtonTeam1.Checked
                _team1 = New Team()
            Case RadioButtonTeam2.Checked
                _team2 = New Team()
            Case RadioButtonTeam3.Checked
                _team3 = New Team()
            Case RadioButtonTeam4.Checked
                _team4 = New Team()
        End Select
        ResetTeam()
    End Sub

    Private Sub ResetTeam()
        Dim selectedTeam As Team = Nothing
        Select Case True
            Case RadioButtonTeam1.Checked
                selectedTeam = _team1
            Case RadioButtonTeam2.Checked
                selectedTeam = _team2
            Case RadioButtonTeam3.Checked
                selectedTeam = _team3
            Case RadioButtonTeam4.Checked
                selectedTeam = _team4
        End Select

        If (selectedTeam IsNot Nothing) Then
            TextBoxTeamName.Text = selectedTeam.Name
            TextBoxTeammate1.Text = selectedTeam.Teammate1
            TextBoxTeammate2.Text = selectedTeam.Teammate2
            TextBoxTeammate3.Text = selectedTeam.Teammate3
            TextBoxTeammate4.Text = selectedTeam.Teammate4
        Else
            TextBoxTeamName.Clear()
            TextBoxTeammate1.Clear()
            TextBoxTeammate2.Clear()
            TextBoxTeammate3.Clear()
            TextBoxTeammate4.Clear()
        End If
    End Sub

End Class

Public Class Team
    Implements INotifyPropertyChanged

    Private _name As String
    Public Property Name As String
        Get
            Return _name
        End Get
        Set(value As String)
            If (_name <> value) Then
                _name = value
                NotifyPropertyChanged()
            End If
        End Set
    End Property

    Private _teammate1 As String
    Public Property Teammate1 As String
        Get
            Return _teammate1
        End Get
        Set(value As String)
            If (_teammate1 <> value) Then
                _teammate1 = value
                NotifyPropertyChanged()
            End If
        End Set
    End Property

    Private _teammate2 As String
    Public Property Teammate2 As String
        Get
            Return _teammate2
        End Get
        Set(value As String)
            If (_teammate2 <> value) Then
                _teammate2 = value
                NotifyPropertyChanged()
            End If
        End Set
    End Property

    Private _teammate3 As String
    Public Property Teammate3 As String
        Get
            Return _teammate3
        End Get
        Set(value As String)
            If (_teammate3 <> value) Then
                _teammate3 = value
                NotifyPropertyChanged()
            End If
        End Set
    End Property

    Private _teammate4 As String
    Public Property Teammate4 As String
        Get
            Return _teammate4
        End Get
        Set(value As String)
            If (_teammate4 <> value) Then
                _teammate4 = value
                NotifyPropertyChanged()
            End If
        End Set
    End Property

    Public Event PropertyChanged As PropertyChangedEventHandler Implements INotifyPropertyChanged.PropertyChanged

    Private Sub NotifyPropertyChanged(<CallerMemberName()> Optional propertyName As String = Nothing)
        RaiseEvent PropertyChanged(Me, New PropertyChangedEventArgs(propertyName))
    End Sub

End Class
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文