locked
BC30451: Select Case .. Name 'Rpttitle' is not declared RRS feed

  • Question

  • User-893002196 posted

    Dear All,

    Why i run script 1 is give me the Compiler Error Message: BC30451: Name 'Rpttitle' is not declared. But when run script 2 is working fine with output? Anybody have an solution about this issue?

     Thank you.

     

    Regards,

    Micheale

     

    Script 2: (Working fine)
    
    
    <script language="vb" runat="server"> 
    
    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
    Select Case ucase(session("language"))
     case "MALAY"
      Dim Rpttitle as String="Daftar Lengkap"
    
      response.write(Rpttitle)
     case else
       Dim Rpttitle as string="Full Registration"
    
       response.write(Rpttitle)
     end select
      
    
     
    
    Script 1: (Not Working)
    
    
    <script language="vb" runat="server"> 
    
    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
    Select Case ucase(session("language"))
     case "MALAY"
      Dim Rpttitle as String="Daftar Lengkap"
     case else
       Dim Rpttitle as string="Full Registration"
     end select
     response.write(Rpttitle)
    
     

     

     

    Wednesday, May 13, 2009 5:38 AM

Answers

  • User-46888941 posted

     Hi,

    You need to declare the variable before the select statement.

       

    Dim Rpttitle as string
    Select Case ucase(session("language"))
     case "MALAY"
      Rpttitle ="Daftar Lengkap"
     case else
       Rpttitle ="Full Registration"
     end select
     response.write(Rpttitle)
     
    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, May 13, 2009 7:34 AM