Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie
Hi there,
There is an issue with role permissions that is being worked on at the moment.
If you are having trouble with access or permissions on regional forums please post here to get access: https://www.boards.ie/discussion/2058365403/you-do-not-have-permission-for-that#latest

VISUAL BASIC HELP please !! block if without end if

  • 17-02-2011 2:10pm
    #1
    Registered Users, Registered Users 2 Posts: 255 ✭✭


    Can someone please help me everytime I try to run this program block if without end if appears... I dont know what to I am fairly bew to this so help would be much appreciated thanks.. Also it highlights Public Sub Updatelabel()

    Public Sub UpdateLabel()
    Dim Info
    ' Sound
    If chkSound.Value = 1 Then
    Info = "Sound: ON"
    Else
    Info = "Sound: OFF"
    End If
    ' Mouse
    If chkMouse.Value = 1 Then
    Info = Info + Chr(13) + "Mouse: ON"
    Else
    Info = Info + Chr(13) + "Mouse: OFF"
    End If
    ' Colors
    If chkColors.Value = 1 Then
    Info = Info = Chr(13) + "Colors: ON"
    Info = Info = Chr(13) + "Colors: OFF"
    End If
    ' Level
    If optLevel1.Value = True Then
    Info = Info + Chr(13) + "Level:1"
    End If
    If optLevel2.Value = True Then
    Info = Info + Chr(13) + "Level:2"
    If optLevel3.Value = True Then
    Info = Info + Chr(13) + "Level:3"
    End If
    lblChoice.Caption = Info
    End Sub


Comments

  • Registered Users, Registered Users 2 Posts: 2,859 ✭✭✭Duckjob


    Can someone please help me everytime I try to run this program block if without end if appears... I dont know what to I am fairly bew to this so help would be much appreciated thanks.. Also it highlights Public Sub Updatelabel()

    Public Sub UpdateLabel()
    Dim Info
    ' Sound
    If chkSound.Value = 1 Then
    Info = "Sound: ON"
    Else
    Info = "Sound: OFF"
    End If
    ' Mouse
    If chkMouse.Value = 1 Then
    Info = Info + Chr(13) + "Mouse: ON"
    Else
    Info = Info + Chr(13) + "Mouse: OFF"
    End If
    ' Colors
    If chkColors.Value = 1 Then
    Info = Info = Chr(13) + "Colors: ON"
    Info = Info = Chr(13) + "Colors: OFF"
    End If
    ' Level
    If optLevel1.Value = True Then
    Info = Info + Chr(13) + "Level:1"
    End If
    If optLevel2.Value = True Then
    Info = Info + Chr(13) + "Level:2"
    End If
    If optLevel3.Value = True Then
    Info = Info + Chr(13) + "Level:3"
    End If
    lblChoice.Caption = Info
    End Sub


    Adding the highlighted line should do the trick.


  • Registered Users, Registered Users 2 Posts: 255 ✭✭SellingJuan


    Now it says expected end sub .... Thanks for your help

    ' All variables Must be declared.
    Option Explicit
    Private Sub chkColors_Click()
    UpdateLabel
    End Sub
    Private Sub chkMouse_Click()
    UpdateLabel
    End Sub

    Private Sub chkSound_Click()
    UpdateLabel
    End Sub

    Private Sub cmdExit_Click()
    End
    End Sub
    Private Sub optLevel1_Click()
    UpdateLabel
    End Sub

    Private Sub optLevel2_Click()
    UpdateLabel
    End Sub

    Private Sub optLevel3_Click()
    UpdateLabel
    End Sub
    Public Sub UpdateLabel()
    Dim Info
    ' Sound
    If chkSound.Value = 1 Then
    Info = "Sound: ON"
    Else
    Info = "Sound: OFF"
    End If
    ' Mouse
    If chkMouse.Value = 1 Then
    Info = Info + Chr(13) + "Mouse: ON"
    Else
    Info = Info + Chr(13) + "Mouse: OFF"
    End If
    ' Colors
    If chkColors.Value = 1 Then
    Info = Info = Chr(13) + "Colors: ON"
    Info = Info = Chr(13) + "Colors: OFF"
    End If
    ' Level
    If optLevel1.Value = True Then
    Info = Info + Chr(13) + "Level:1"
    End If
    If optLevel2.Value = True Then
    Info = Info + Chr(13) + "Level:2"
    End If
    If optLevel3.Value = True Then
    Info = Info + Chr(13) + "Level:3"
    End If


  • Registered Users, Registered Users 2 Posts: 255 ✭✭SellingJuan


    Actually its ok I figured it out forgot to end sub and lbl choice thanks alot for your help tho it was much appreciated :)


Advertisement