Avatar billede kris914g Nybegynder
09. august 2012 - 18:15 Der er 9 kommentarer og
1 løsning

hjælp ¨Select Case¨ must end with a matching ¨end select¨

hej jeg er ved at lave en game Launcher hvor jeg bruger VB men når jeg skal til at builde så kommer der error og skriver ¨Select Case¨ must end with a matching ¨end select¨ nogen der kan hjælpe mig koden er er så i kan se den kode:

Private Sub PictureBox3_MouseClick(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles PictureBox3.MouseClick
        PictureBox3.Image = My.Resources.OptionsClick
        REM This tells the PictureBox3 image to change to OptionsClick.png
        If Directory.Exists(My.Computer.FileSystem.CurrentDirectory & "/Cache") Then

        End If
        REM This tells the launcher to check its current directory for a folder named "Cache"
        Dim Cache As String = (My.Computer.FileSystem.CurrentDirectory & "/Cache")
        REM This tells the launcher to turn the directory location of the cache folder into a string.
            Select MsgBox("Do you want to delete the Cache folder?", MsgBoxStyle.Critical + MsgBoxStyle.YesNo, "WARNING")
            REM This tells the launcher to display a message box with a yes and no button
            Case MsgBoxResult.Yes
                REM What happens when you press the yes button
                Directory.Delete(Cache, True)
                REM Deletes the cache folder
            Case MsgBoxResult.No

                REM Tells the launcher to do nothing if the no button is pressed
    End Sub

pls nogen der kan hjælpe mig
Avatar billede claes57 Ekspert
09. august 2012 - 18:20 #1
nu er jeg ikke til C, men
---------
            REM This tells the launcher to display a message box with a yes and no button
            Case MsgBoxResult.Yes
                REM What happens when you press the yes button
                Directory.Delete(Cache, True)
                REM Deletes the cache folder
            Case MsgBoxResult.No

                REM Tells the launcher to do nothing if the no button is pressed
---------

kan det ikke bare være
---------
            REM This tells the launcher to display a message box with a yes and no button
            If MsgBoxResult.Yes Then
                REM What happens when you press the yes button
                Directory.Delete(Cache, True)
                REM Deletes the cache folder
            Else

                REM Tells the launcher to do nothing if the no
button is pressed
            End If

---------
Avatar billede kris914g Nybegynder
09. august 2012 - 18:31 #2
nej det virker desvære ikke så kommer den bare op med 6 andre errors
Avatar billede arne_v Ekspert
09. august 2012 - 18:46 #3
Fejl meddelelsen er vel ret klar: der er ingen END SELECT !
Avatar billede arne_v Ekspert
09. august 2012 - 18:47 #4
Syntaxen er:

SELECT variabel
    CASE envaerdi
          noget kode
    CASE enandenvaerdi
          noget andet kode
END SELECT
Avatar billede kris914g Nybegynder
09. august 2012 - 19:21 #5
kan du ikke få det til at virke men. kan du prøve at fikse koden ?
det kunne være fedt her er koden:

mports System.IO
Imports System.Net.Sockets
Imports System.Net

Public Class Form1



    Private Sub PictureBox1_MouseClick(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles PictureBox1.MouseClick
        PictureBox1.Image = My.Resources.PlayClick
        If File.Exists(My.Computer.FileSystem.CurrentDirectory & "/Wow.exe") Then
            REM This tells the launcher to check the current directory for Wow.exe
            Shell(My.Computer.FileSystem.CurrentDirectory & "/Wow.exe")
            REM If Wow.exe is found this tells the launcher to start Wow.exe
            Me.Close()
            REM This tells the launcher to close after it start Wow.exe
        Else
            MsgBox("Could not start Wow.exe", MsgBoxStyle.Critical, "Application Not Found")
            REM If Wow.exe is not found this tells the launcher to show an error message
        End If
    End Sub

    Private Sub PictureBox1_MouseEnter(ByVal sender As Object, ByVal e As System.EventArgs) Handles PictureBox1.MouseEnter
        PictureBox1.Image = My.Resources.PlayEnter
        REM This tells the PictureBox image to change to PlayEnter.png

    End Sub

    Private Sub PictureBox1_MouseLeave(ByVal sender As Object, ByVal e As System.EventArgs) Handles PictureBox1.MouseLeave
        PictureBox1.Image = My.Resources.PlayLeave
        REM This tells the PictureBox image to change to PlayLeave.png
    End Sub

    Private Sub PictureBox2_MouseClick(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles PictureBox2.MouseClick
        PictureBox2.Image = My.Resources.SupportClick
        REM This tells the PictureBox2 image to change to SupportClick.png
        Process.Start("http://YOUR WEBSITE HERE")
        REM This tells the launcher to open your servers website
    End Sub



    Private Sub PictureBox2_MouseEnter(ByVal sender As Object, ByVal e As System.EventArgs) Handles PictureBox2.MouseEnter
        PictureBox2.Image = My.Resources.SupportEnter
        REM This tells the PictureBox2 image to change to SupportEnter.png
    End Sub


    Private Sub PictureBox2_MouseLeave(ByVal sender As Object, ByVal e As System.EventArgs) Handles PictureBox2.MouseLeave
        PictureBox2.Image = My.Resources.SupportLeave
        REM This tells the PictureBox2 image to change to SupportLeave.png
    End Sub

    Private Sub PictureBox3_MouseClick(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles PictureBox3.MouseClick
        PictureBox3.Image = My.Resources.OptionsClick
        REM This tells the PictureBox3 image to change to OptionsClick.png
        If Directory.Exists(My.Computer.FileSystem.CurrentDirectory & "/Cache") Then

        End If
        REM This tells the launcher to check its current directory for a folder named "Cache"
        Dim Cache As String = (My.Computer.FileSystem.CurrentDirectory & "/Cache")
        REM This tells the launcher to turn the directory location of the cache folder into a string.
            Select MsgBox("Do you want to delete the Cache folder?", MsgBoxStyle.Critical + MsgBoxStyle.YesNo, "WARNING")
            REM This tells the launcher to display a message box with a yes and no button
            Case MsgBoxResult.Yes
                REM What happens when you press the yes button
                Directory.Delete(Cache, True)
                REM Deletes the cache folder
            Case MsgBoxResult.No

                REM Tells the launcher to do nothing if the no button is pressed

    End Sub




    Private Sub PictureBox3_MouseEnter(ByVal sender As Object, ByVal e As System.EventArgs) Handles PictureBox3.MouseEnter
        PictureBox3.Image = My.Resources.OptionsEnter
        REM This tells the PictureBox3 image to change to OptionsEnter.png
    End Sub

    Private Sub PictureBox3_MouseLeave(ByVal sender As Object, ByVal e As System.EventArgs) Handles PictureBox3.MouseLeave
        PictureBox3.Image = My.Resources.OptionsLeave
        REM This tells the PictureBox3 image to change to OptionsLeave.png
    End Sub



    Private Sub Label1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)

    End Sub
End Class
Avatar billede kris914g Nybegynder
09. august 2012 - 19:22 #6
har rettet det med mports System.IO
Avatar billede arne_v Ekspert
09. august 2012 - 19:27 #7
Private Sub PictureBox3_MouseClick(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles PictureBox3.MouseClick
        PictureBox3.Image = My.Resources.OptionsClick
        REM This tells the PictureBox3 image to change to OptionsClick.png
        If Directory.Exists(My.Computer.FileSystem.CurrentDirectory & "/Cache") Then

        End If
        REM This tells the launcher to check its current directory for a folder named "Cache"
        Dim Cache As String = (My.Computer.FileSystem.CurrentDirectory & "/Cache")
        REM This tells the launcher to turn the directory location of the cache folder into a string.
            Select MsgBox("Do you want to delete the Cache folder?", MsgBoxStyle.Critical + MsgBoxStyle.YesNo, "WARNING")
            REM This tells the launcher to display a message box with a yes and no button
            Case MsgBoxResult.Yes
                REM What happens when you press the yes button
                Directory.Delete(Cache, True)
                REM Deletes the cache folder
            Case MsgBoxResult.No

                REM Tells the launcher to do nothing if the no button is pressed
        End Select ' <----------------------------------------------- her
    End Sub
Avatar billede arne_v Ekspert
09. august 2012 - 19:27 #8
Og import af System.IO har ikke noget med den fejl at goere.
Avatar billede kris914g Nybegynder
09. august 2012 - 19:34 #9
mange tak are du skal nok få points
Avatar billede arne_v Ekspert
09. august 2012 - 19:38 #10
du tog da ellers selv point
Avatar billede Ny bruger Nybegynder

Din løsning...

Tilladte BB-code-tags: [b]fed[/b] [i]kursiv[/i] [u]understreget[/u] Web- og emailadresser omdannes automatisk til links. Der sættes "nofollow" på alle links.

Loading billede Opret Preview
Kategori
IT-kurser om Microsoft 365, sikkerhed, personlig vækst, udvikling, digital markedsføring, grafisk design, SAP og forretningsanalyse.

Log ind eller opret profil

Hov!

For at kunne deltage på Computerworld Eksperten skal du være logget ind.

Det er heldigvis nemt at oprette en bruger: Det tager to minutter og du kan vælge at bruge enten e-mail, Facebook eller Google som login.

Du kan også logge ind via nedenstående tjenester