Results 1 to 12 of 12

Thread: Select Case error

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Feb 2004
    Location
    in the heart of the Mediterranean
    Posts
    1,143

    Select Case error

    Can someone please tell me why I get an error ??

    Select Case check

    Case "1"
    DDdisability1.SelectedValue = "Please Select"
    DDdisability1.SelectedValue = Nothing
    Case "2"
    DDdisability2.SelectedValue = "Please Select"
    DDdisability2.SelectedValue = Nothing


    .......................................etc
    Case "10"
    DDdisability10.SelectedValue = "Please Select"
    DDdisability10.SelectedValue = Nothing
    End Select
    Last edited by angelica; Mar 2nd, 2006 at 05:48 PM.

  2. #2
    Shared Member
    Join Date
    May 2005
    Location
    Kashmir, India
    Posts
    2,277

    Re: Select Case error

    What kind of error are you getting. You will need to provide more information. Which line does it show error on?
    Use [code] source code here[/code] tags when you post source code.

    My Articles

  3. #3
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170

    Re: Select Case error

    1. DDdisability1.SelectedValue.ToString = "Please Select"
    DDdisability1.SelectedValue = Nothing

    Remove the 'ToString'

    2. Why set the selectedvalue to nothing after setting the selectedvalue to 'please select'?

    3. Could it be the **** ?

  4. #4

    Thread Starter
    Frenzied Member
    Join Date
    Feb 2004
    Location
    in the heart of the Mediterranean
    Posts
    1,143

    Re: Select Case error

    hi,

    What Im trying to do is this:

    these 10 dropdownlists are populated by a field. The first record to show is "Please select". Now if the user does not need to have information from all dropdownlist then the field is left empty.


    My error is on the name of the Select Case Check saying

    name is not declared.

    If there is a better way to check all 10 dropdowns please tell me, or else please tell me where is my mistake.

    Many many thanks

  5. #5
    Shared Member
    Join Date
    May 2005
    Location
    Kashmir, India
    Posts
    2,277

    Re: Select Case error

    What is sAccessID ID?
    I think this has not been declared anywhere!
    Use [code] source code here[/code] tags when you post source code.

    My Articles

  6. #6
    C# Aficionado Lord_Rat's Avatar
    Join Date
    Sep 2001
    Location
    Cave
    Posts
    2,497

    Re: Select Case error

    Place a break point on the SELECT line and then when the system breaks there, start pointing your cursor at variable names. One will come up undefined. It is the offender.
    Need to re-register ASP.NET?
    C:\WINNT\Microsoft.NET\Framework\v#VERSIONNUMBER#\aspnet_regiis -i

    (Edit #VERSIONNUMBER# as needed - do a DIR if you don't know)

  7. #7
    Shared Member
    Join Date
    May 2005
    Location
    Kashmir, India
    Posts
    2,277

    Re: Select Case error

    Quote Originally Posted by Lord_Rat
    Place a break point on the SELECT line and then when the system breaks there, start pointing your cursor at variable names. One will come up undefined. It is the offender.
    It will not compile first of all with this kind of error. So there is no case of debugging it.
    Use [code] source code here[/code] tags when you post source code.

    My Articles

  8. #8
    C# Aficionado Lord_Rat's Avatar
    Join Date
    Sep 2001
    Location
    Cave
    Posts
    2,497

    Re: Select Case error

    Well for sake of what she is trying to do, this might be a good place to start:
    (This is the C# version, it needs to be adapted to VB and I am not quite up on my VB enough to do it)
    Code:
    int iCheckID = /*Fill the ID with the number some how*/;
    System.Web.UI.WebControls.DropDownList oDDL = (System.Web.UI.WebControls.DropDownList)Page.FindControl("DDdisability" + i.ToString());
    oDDL.SelectedIndex = 0; //Where the first item in the list is "Please Select"
    Need to re-register ASP.NET?
    C:\WINNT\Microsoft.NET\Framework\v#VERSIONNUMBER#\aspnet_regiis -i

    (Edit #VERSIONNUMBER# as needed - do a DIR if you don't know)

  9. #9

    Thread Starter
    Frenzied Member
    Join Date
    Feb 2004
    Location
    in the heart of the Mediterranean
    Posts
    1,143

    Re: Select Case error

    hi,

    Someone give me a version of VB.NET please cos I need it badly. Urgent if anyone can help. 10 xx

  10. #10
    Frenzied Member Fishcake's Avatar
    Join Date
    Feb 2001
    Location
    Derby, UK
    Posts
    1,092

    Re: Select Case error

    There's a nice fast online convertor here
    and it gives this output.
    VB Code:
    1. Dim iCheckID As Integer = 2 'A number i entered to make conversation work.
    2. Dim oDDL As System.Web.UI.WebControls.DropDownList = CType(Page.FindControl("DDdisability" + i.ToString), System.Web.UI.WebControls.DropDownList)
    3. oDDL.SelectedIndex = 0

  11. #11

    Thread Starter
    Frenzied Member
    Join Date
    Feb 2004
    Location
    in the heart of the Mediterranean
    Posts
    1,143

    Re: Select Case error

    hi,

    But how am I gona loop through all 10 DDdisability ....Selectedvalue = "Please Select ?? Im no expert on programming!!

  12. #12
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170

    Re: Select Case error

    Alright, and?

    Can't you modify fishcake's code? Where exactly are you confused? What is your question?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width