Ga Terug   Leerlingen.com Forum > Multi Media > Computers & Internet
FAQ Ledenlijst Kalender Berichten van vandaag

Computers & Internet Problemen met je computer, of weet je niet welke router nu te moeten installeren voor je breedbandje? Dit, en andere zaken vind je hier!

Antwoord
 
Onderwerpopties Stem op Onderwerp Weergavemodus
Oud 30 May 2009, 13:55   #1
the_darkness
F0rum God +
 
the_darkness's Avatar
 
Geregistreerd op: 12 December 2007
Berichten: 24.954
Standaard

gewoon met values?
gewoon een if/else met een waarde waar goed=1 en fout=0 en een >/<.
its not that hard.
voor woord totaal een gelijk aan commando gecombineerd met een And?
__________________
The GOD OF FAIL is here!
The FAIL God now officially has 429 worshippers.
Start worshipping me today and get a personal FAIL poem for free!
the_darkness is offline   Met citaat antwoorden
Oud 30 May 2009, 14:03   #2
Hellblazer
Lid
 
Hellblazer's Avatar
 
Geregistreerd op: 20 May 2009
Berichten: 585
Standaard

Ik heb nu dat als je niets invult of spatie dat ie foutmelding geeft. Als er nog geen woord is geeft ie foutmelding Bij meerde letters of fout woord geeft ie ook een foutmelding. Bij goed woord laat hij het woord zien.
Bij een letter moeten we van die vent for i = 1 to len(woord$) doen. En dan heel woord$ controleren op die goede letter. En dan moet(en) die letter(s) op de goede plaats komen te staan.
Het probleem is dan, hoe kan ik zorgen dat ie onthoudt waar dat ie een letter moet plaatsen of een _ (voor nog niet ingevuld). En hoe kan ik dan zorgen dat ie bestaande letters dan al laat staan.
Dat lijkt me iets meer dan alleen meer if, else, and, < en >.
Hellblazer is offline   Met citaat antwoorden
Oud 30 May 2009, 14:06   #3
the_darkness
F0rum God +
 
the_darkness's Avatar
 
Geregistreerd op: 12 December 2007
Berichten: 24.954
Standaard

even denken...
visual basic werkt met code strings right?
__________________
The GOD OF FAIL is here!
The FAIL God now officially has 429 worshippers.
Start worshipping me today and get a personal FAIL poem for free!
the_darkness is offline   Met citaat antwoorden
Oud 30 May 2009, 14:06   #4
Hellblazer
Lid
 
Hellblazer's Avatar
 
Geregistreerd op: 20 May 2009
Berichten: 585
Standaard

Voor zover ik weet wel.
Hellblazer is offline   Met citaat antwoorden
Oud 30 May 2009, 14:10   #5
the_darkness
F0rum God +
 
the_darkness's Avatar
 
Geregistreerd op: 12 December 2007
Berichten: 24.954
Standaard

probeer dit eens.
er zitten wel een aantal errors in, maar het geeft je een begin.

Private allPuzzles(1, 0) As String
Private allClues(0, 1) As String
Private LastPuzzle As Short
Dim btnTestNumButtons(26) As Button
Dim lbldisplayletters(0) As Label
Dim hangmanWord As String
Dim correctcounter As Integer = 0
Dim hangmanstage As String = "START"
Dim incorrect = False

Private Sub btnTestNumButtons_Click(ByVal sender As System.Object, ByVal e As EventArgs) Handles MyBase.Click
If sender.name = "" Then
For iIndex = 0 To hangmanWord.Length - 1
If hangmanWord.Substring(iIndex, 1) = sender.Text Then
lbldisplayletters(iIndex).Text = sender.Text
correctcounter += 1
incorrect = True
End If
Next iIndex

If incorrect = False Then
drawHangman()
End If

incorrect = False

sender.Enabled = False
sender.visible = False
If correctcounter = hangmanWord.Length Then
lblresult.Text = "YOU WIN"
lblGamesWon.Text = CInt(lblGamesWon.Text) + 1
lblGamesPlayed.Text = CInt(lblGamesPlayed.Text) + 1
disableconrols()
End If
End If

End Sub



Private Sub LoadGameData()

Dim puzzleno As Integer = 0
Dim outstream As New StreamReader(My.Application.Info.DirectoryPath & "\HMPuzz.dat")
Dim lineText As String
Dim puzzle() As String

Do Until outstream.EndOfStream
ReDim Preserve allPuzzles(1, puzzleno)
lineText = outstream.ReadLine()
If lineText <> Nothing Then
puzzle = lineText.Split(",")
allPuzzles(0, puzzleno) = puzzle(0)
allPuzzles(1, puzzleno) = puzzle(1)
puzzleno += 1
End If
Loop

outstream = New StreamReader(My.Application.Info.DirectoryPath & "\LastPuzz.dat")
Do Until outstream.EndOfStream
LastPuzzle = CShort(outstream.ReadLine())
Loop
outstream.Close()

Dim intFileNbr As Short
intFileNbr = FreeFile()
FileOpen(intFileNbr, (My.Application.Info.DirectoryPath & "\LastPuzz.dat"), OpenMode.Output)
If puzzleno - 1 < LastPuzzle Then
WriteLine(intFileNbr, 1)
FileClose(intFileNbr)
Else
WriteLine(intFileNbr, LastPuzzle + 1)
FileClose(intFileNbr)
End If



End Sub

Private Sub CreateButtonArray()
Dim shtIndex As Integer
Dim position As Integer = 30
Dim position2 As Integer = 30
For shtIndex = 0 To 25
btnTestNumButtons(shtIndex) = New System.Windows.Forms.Button()
With btnTestNumButtons(shtIndex)
.Text() = Chr(shtIndex + 65).ToString
.Size() = New Size(40, 40)
.FlatStyle() = FlatStyle.Popup
.BackColor() = System.Drawing.Color.Red
AddHandler .Click, AddressOf Me.btnTestNumButtons_Click
If shtIndex < 13 Then
.Location = New System.Drawing.Point(position, 200)
position += 44
Else
.Location = New System.Drawing.Point(position2, 245)
position2 += 44
End If
End With
Next
Me.Controls.AddRange(btnTestNumButtons)
End Sub

Private Sub newGame()
Invalidate()
LoadGameData()
lblresult.Text = ""
lblGamesPlayed.Visible = True
lblGamesWon.Visible = True
rb_played.Visible = True
rb_gameswon.Visible = True
CreateButtonArray()
hangmanWord = allPuzzles(0, LastPuzzle - 1)
CreateLabelArray(hangmanWord.Length)
End Sub

Private Sub CreateLabelArray(ByVal length As Integer)
Dim position As Integer = 30
Dim position2 As Integer = 30
ReDim lbldisplayletters(length - 1)

For i = 0 To length - 1
lbldisplayletters(i) = New System.Windows.Forms.Label()
With lbldisplayletters(i)
If hangmanWord.Substring(i, 1) = " " Then
correctcounter += 1
.Visible = False
Else
.Visible = True
End If
.Text() = ""
.TextAlign = ContentAlignment.MiddleCenter
.Size() = New Size(40, 40)
.FlatStyle() = FlatStyle.Popup
.BackColor() = System.Drawing.Color.White
If i < 13 Then
.Location = New System.Drawing.Point(position, 50)
position += 44
Else
.Location = New System.Drawing.Point(position2, 95)
position2 += 44
End If
End With
Next
Me.Controls.AddRange(lbldisplayletters)
End Sub

Private Sub frmHangman_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
newGame()
End Sub


Private Sub drawHangman()
Dim hangman As Graphics = pict_hangman.CreateGraphics()
Dim pen As New Pen(Color.Black)


Select Case hangmanstage
Case "START"
pict_hangman.Refresh()
hangman.DrawLine(pen, 50, 200, 150, 200)
hangman.DrawLine(pen, 140, 20, 140, 200)
hangman.DrawLine(pen, 80, 20, 140, 20)
hangman.DrawLine(pen, 80, 20, 80, 40)
hangman.DrawLine(pen, 120, 20, 140, 40)
hangmanstage = "DRAW HEAD"
Case "DRAW HEAD"
hangman.DrawEllipse(pen, 70, 40, 20, 20)
hangmanstage = "DRAW BODY"
Case "DRAW BODY"
hangman.DrawLine(pen, 80, 60, 80, 110)
hangmanstage = "DRAW RIGHT HAND"
Case "DRAW RIGHT HAND"
hangman.DrawLine(pen, 80, 65, 100, 85)
hangmanstage = "DRAW LEFT HAND"
Case "DRAW LEFT HAND"
hangman.DrawLine(pen, 80, 65, 60, 85)
hangmanstage = "DRAW RIGHT LEG"
Case "DRAW RIGHT LEG"
hangman.DrawLine(pen, 80, 110, 100, 130)
hangmanstage = "DRAW LEFT LEG"
Case "DRAW LEFT LEG"
hangman.DrawLine(pen, 80, 110, 60, 130)
hangmanstage = "START"
lblresult.Text = "YOU LOOSE"
rb_played.Text = CInt(rb_played.Text) + 1
disableconrols()
End Select


End Sub

Private Sub cmdNewGame_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles cmdNewGame.Click
Dim ctl As Control

For Each ctl In Me.Controls
ctl.Enabled = True
If ctl.GetType().Name = "Label" Then

If Not ctl.Name = "lblplayed" And Not ctl.Name = "lblwon" And Not ctl.Name = "lblGamesPlayed" And Not ctl.Name = "lblGamesWon" Then
ctl.Text = ""
ctl.Visible = False
End If
End If
Next
newGame()
End Sub
Private Sub disableconrols()
Dim ctl As Control

For Each ctl In Me.Controls
ctl.Enabled = False
Next
cmdNewGame.Enabled = True
End Sub

Private Sub Button_exit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button_exit.Click
Me.Close()
End Sub
__________________
The GOD OF FAIL is here!
The FAIL God now officially has 429 worshippers.
Start worshipping me today and get a personal FAIL poem for free!
the_darkness is offline   Met citaat antwoorden
Oud 30 May 2009, 14:14   #6
Hellblazer
Lid
 
Hellblazer's Avatar
 
Geregistreerd op: 20 May 2009
Berichten: 585
Standaard

Ik zal is kijken wat ik er mee kan
Hellblazer is offline   Met citaat antwoorden
Oud 30 May 2009, 14:57   #7
~DoOsJ~
Just Somebody :)
 
~DoOsJ~'s Avatar
 
Geregistreerd op: 1 March 2009
Berichten: 2.924
Standaard

visual basic zuigt.. wij moesten mastermind maken en raad het getal.. ik ben nog nooit zo boos geworden op een leraar als toen
__________________
Ƹ̵̡Ӝ̵̨̄Ʒ
~DoOsJ~ is offline   Met citaat antwoorden
Antwoord


Berichting Regels
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is Aan
Smilies zijn Aan
[IMG] code is Aan
HTML code is Uit

Forumnavigatie


Alle tijden zijn GMT +1. De tijd is nu 02:30.


Forum software: vBulletin 3
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.