vb.NET如何在sub中获得更多输入

时间:2013-11-29 20:10:33

标签: vb.net vb.net-2010 subroutine

首先感谢您的时间。

我正在编程风险(我知道它没用,我17岁并且需要一个项目)并且我点击一个按钮结束轮到我,现在我的程序将执行以下操作:

计算补给的部队数量 - >让你选择你想要的地方 - >调整我的数据库

我的问题是我希望能够再次点击我的表格上的按钮(并执行他们的潜水艇),而我的另一个潜水艇被“暂停”,并且一旦我没有更多的部队补给就重新开始。

我知道这个问题并不符合规则所以我也会给你一些代码:p

If MsgBox("Beurt beëindigen?", MsgBoxStyle.OkCancel, "Are u sure?") = MsgBoxResult.Cancel Then

        Exit Sub

    End If

    Replenishment = 0

    For i = 0 To 39

        If Me.Controls(ds.Tables("Map").Rows(i).Item("Regio").ToString).Tag = User Then

            Replenishment += 1

        End If

    Next i

    Replenishment /= 2

    RecruteerPanel.Visible = True
    MRecruten.Text = Replenishment
    RTroepen.Maximum = MRecruten.Text

    While MRecruten.Text > 0

'this is where my sub should pause and allow me to interact with my form again
'I used the while loop because I'm used to programming with my calculator and that would be the way to do it

    End While

    For i = 0 To MaxRows - 1

        MapRegion = ds.Tables("Map").Rows(i).Item("Regio").ToString
        'naam regio bepalen

        ds.Tables("Map").Rows(i).Item("Eigenaar") = Me.Controls(MapRegion).Tag
        'tag opslaan
        ds.Tables("Map").Rows(i).Item("Troepen") = Me.Controls(MapRegion).Text
        'Troepen opslaan

    Next i

    For i = 0 To 3

        MsgBox(ds.Tables("Players").Rows(i).Item("Turn") & ds.Tables("Players").Rows(i).Item("Players"))

        If ds.Tables("Players").Rows(i).Item("Turn") = True And i < 3 Then

            ds.Tables("Players").Rows(i).Item("Turn") = False
            ds.Tables("Players").Rows(i + 1).Item("Turn") = True

            Exit For

        ElseIf ds.Tables("Players").Rows(i).Item("Turn") = True And i = 3 Then

            ds.Tables("Players").Rows(i).Item("Turn") = False
            ds.Tables("Players").Rows(0).Item("Turn") = True

        End If

    Next i



    sql = "SELECT * FROM Map"
    da = New OleDb.OleDbDataAdapter(sql, con)
    Dim cb As New OleDb.OleDbCommandBuilder(da)

    da.Update(ds, "Map")

    sql = "SELECT * FROM Players"
    da = New OleDb.OleDbDataAdapter(sql, con)
    Dim cb2 As New OleDb.OleDbCommandBuilder(da)

    da.Update(ds, "Players")

End Sub

再次抱歉,如果我不能这样问问题

0 个答案:

没有答案