방금이 응용 프로그램에 대한 내 코드를 일부 변경했지만 어떤 이유로 여전히 작동하지 않습니다. 내 재시작 버튼이 양식을 다시 시작하지 않고 점수 수치가 표시되지 않고 결과 결과가 표시되지 않고 주사위가 굴러 가지 않습니다. https://imageshack.com/i/kpdOTIAQp주사위 버튼으로 주사위를 굴릴 수 없습니까?
기본적으로 인간의 플레이어가 VB의 난수 발생기에 내장을 사용하여 컴퓨터에 재생 : 여기
내 GUI에 대한 링크입니다. 게임의 목적은 상대방이 1에서 최대 99의 일치 형식 (1, 3, 5, 7, 9, 11 등의 최상의 홀수)으로 게임에서 이기기 위해 상대방보다 높은 점수를 갖는 것입니다. 13 등).문제는 버튼을 클릭 할 때 주사위 이미지가 나타나지 않는다는 것입니다.
Public Class DiceBattleForm
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
End Sub
Private Sub ExitButton_Click(sender As Object, e As EventArgs) Handles ExitButton.Click
Dim RESPONSE As MsgBoxResult
RESPONSE = MsgBox("Do you want to exit?", MsgBoxStyle.YesNo Or MsgBoxStyle.Question)
If RESPONSE = MsgBoxResult.Yes Then
Me.Dispose()
End If
End Sub
Private Sub RollButton_Click(sender As Object, e As EventArgs) Handles RollButton.Click
If GameTextBox.Text <= "0" Then
MsgBox("Number of Games > 0", MsgBoxStyle.Critical)
Application.Restart()
End If
If GameTextBox.Text > "0" Then
GameTextBox = Convert.ToInt32(GameTextBox.Text)
End If
DisplayDie(PCDice1)
DisplayDie(PCDice2)
DisplayDie(PCDice3)
DisplayDie(YouDice1)
DisplayDie(YouDice2)
DisplayDie(YouDice3)
End Sub
Sub DisplayDie(diePictureBox As PictureBox)
'GENERATE random integer in range 1 to 6
Dim face As Integer = randomObject.Next(1, 7)
'retrieve specific die image from resources
Dim pictureResource = My.Resources.ResourceManager.GetObject(String.Format("die{0}", face))
'Convert pictureResource to type Image and display in ImageBox
diePictureBox.Image = CType(pictureResource, Image)
End Sub ' DisplaDie
Private Sub GameTextBox_Validating(sender As Object, e As EventArgs) Handles GameTextBox.TextChanged
If GameTextBox.Text > "0" Then
Do
MsgBox(GameTextBox.Text + " round(s) will be played enjoy!")
Loop While GameTextBox.Text = "STOP"
End If
GameTextBox.Enabled = False
End Sub
Private Sub RestartButton_Click(sender As Object, e As EventArgs) Handles RestartButton.Click
' Reset or clear any controls (recommended)
DiceBattleForm.Clear()
' NOT recommended:
' Application.Restart()
End Sub
End Class
어쩌면 다시 시작할 때입니다. 언젠가 당신은 코드에서 caugh를 얻고 어떤 출구가 보이지 않습니다. 처음부터 다시 시작하고 응용 프로그램을 빌드/테스트 할 것을 제안합니다. 한 번에 모든 것을 만들지 마십시오. –
좋아요, 우선 먼저 나가기 버튼이 작동한다는 것을 압니다. 그래서 제가 한 부분입니다. 내가 고치고 자하는 문제는 주사위를 굴리는 것이다. 내 코드를 보면 제 문제가 어디에 주사위를 굴려서 the_lotus를 굴리는 것을 막을 수 있습니까? – Anonymous
귀하의 원래 질문은 너무 광범위하게 보류되었습니다. 이 질문은 더 이상 집중하지 않습니다. 보류중인 질문으로부터 배우고보다 명확한 질문을 제시하십시오. 이것은 말하기를, 당신의 어플리케이션은 당신이 성취하려는 것을 복잡하게 생각합니다. – djv