VB.NET - Method not found: System String System Web UI Web

Asked By sogi chan
15-Oct-05 09:36 AM
why it always show this error when I run it?
this is my coding, pls check wht is the problem?please!

Public Class InsAss
    Inherits System.Web.UI.Page
    Protected WithEvents txtnama As System.Web.UI.WebControls.TextBox
    Protected WithEvents txtsiri As System.Web.UI.WebControls.TextBox
    Protected WithEvents txtname As System.Web.UI.WebControls.TextBox
    Protected WithEvents txttarikh As System.Web.UI.WebControls.Label
    Protected WithEvents cal2 As System.Web.UI.WebControls.Calendar
    Protected WithEvents txtdateIns As System.Web.UI.WebControls.TextBox
    Protected WithEvents Image1 As System.Web.UI.WebControls.Image
    Protected WithEvents cbklab As System.Web.UI.WebControls.CheckBoxList

#Region " Web Form Designer Generated Code "

    'This call is required by the Web Form Designer.
    <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()

    End Sub
    Protected WithEvents Label1 As System.Web.UI.WebControls.Label
    Protected WithEvents Label4 As System.Web.UI.WebControls.Label
    Protected WithEvents LinkButton4 As System.Web.UI.WebControls.LinkButton
    Protected WithEvents Label6 As System.Web.UI.WebControls.Label
    Protected WithEvents lkInsAss As System.Web.UI.WebControls.LinkButton
    Protected WithEvents Home As System.Web.UI.WebControls.LinkButton
    Protected WithEvents installer As System.Web.UI.WebControls.LinkButton

    'NOTE: The following placeholder declaration is required by the Web Form Designer.
    'Do not delete or move it.
    Private designerPlaceholderDeclaration As System.Object

    Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init
        'CODEGEN: This method call is required by the Web Form Designer
        'Do not modify it using the code editor.
        InitializeComponent()
    End Sub

#End Region

    Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        'Put user code to initialize the page here

        Dim clbenefits As New BenefitsListVB.Benefits
        Dim bi As BenefitsListVB.Benefits.BenefitInfo

        For Each bi In clbenefits.GetBenefitsList()
            cbklab.Items.Add("<a href=" & bi.strPage & ">" & bi.strName & "</a>")
        Next

    End Sub


    Private Sub Home_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Home.Click
        Response.Redirect("Home.aspx")
    End Sub

    Private Sub lkInsAss_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles lkInsAss.Click
        Response.Redirect("InsAss.aspx")
    End Sub

    Private Sub installer_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles installer.Click
        Response.Redirect("installer.aspx")
    End Sub

    Private Sub cal2_SelectionChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cal2.SelectionChanged
        txtdateIns.Text = cal2.SelectedDate
    End Sub
End Class

On which  On which

15-Oct-05 09:38 AM
line?

that the whole point,  that the whole point,

15-Oct-05 09:53 AM
I din't know where.

the error is like this when I view in browser that form:

Server Error in '/BenefitsVB' Application.
--------------------------------------------------------------------------------

Method not found: System.String System.Web.UI.WebControls.ListControl.get_SelectedValue(). 
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. 

Exception Details: System.MissingMethodException: Method not found: System.String System.Web.UI.WebControls.ListControl.get_SelectedValue().

Source Error: 

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.  

Stack Trace: 


[MissingMethodException: Method not found: System.String System.Web.UI.WebControls.ListControl.get_SelectedValue().]
   BenefitsVB.InsAss.Page_Load(Object sender, EventArgs e) +0
   System.Web.UI.Control.OnLoad(EventArgs e)
   System.Web.UI.Control.LoadRecursive()
   System.Web.UI.Page.ProcessRequestMain()

Most likely-  Most likely-

15-Oct-05 11:47 AM
this is the offending code:

 Dim clbenefits As New BenefitsListVB.Benefits 
        Dim bi As BenefitsListVB.Benefits.BenefitInfo 

        For Each bi In clbenefits.GetBenefitsList() 
            cbklab.Items.Add("<a href=" & bi.strPage & ">" & bi.strName & "</a>") 
        Next 

Something about your ListControl is trying to access the SelectedValue property
through its get accessor, and it isn't finding the method.

How did you come up with this snippet of code?

If this control is on your web page, you would not want to create a NEW instance of it in your Page_Load event handler, since there should already be a protected instance of it on your page proper.
actualy,  actualy,
15-Oct-05 03:22 PM
I already created a class function at the classform. 

and my class look like this;

Public Class Benefits
    Structure BenefitInfo
        Dim strName As String
        Dim strPage As String
    End Structure

    Public Function GetBenefitsList() As BenefitInfo()
        Dim arBenefits(11) As BenefitInfo
        arBenefits(0).strName = "Final"
        arBenefits(0).strPage = "Final.aspx"
        arBenefits(1).strName = "Database"
        arBenefits(1).strPage = "Database.aspx"
        arBenefits(2).strName = "AlKhawarizmi"
        arBenefits(2).strPage = "AlKhawarizmi.aspx"
        arBenefits(3).strName = "Kejuruteraan1"
        arBenefits(3).strPage = "Kejuruteraan1.aspx"
        arBenefits(4).strName = "Kejuruteraan2"
        arBenefits(4).strPage = "Kejuruteraan2.aspx"
        arBenefits(5).strName = "Master"
        arBenefits(5).strPage = "Master.aspx"
        arBenefits(6).strName = "Multimedia1"
        arBenefits(6).strPage = "Multimedia1.aspx"
        arBenefits(7).strName = "Multimedia2"
        arBenefits(7).strPage = "Multimedia2.aspx"
        arBenefits(8).strName = "Network"
        arBenefits(8).strPage = "Network.aspx"
        arBenefits(9).strName = "SistemPerisian"
        arBenefits(9).strPage = "SistemPerisian.aspx"
        arBenefits(10).strName = "PcLecture"
        arBenefits(10).strPage = "PcLecture.aspx"
        arBenefits(11).strName = "PcOffice"
        arBenefits(11).strPage = "PcOffice.aspx"
        Return arBenefits
    End Function

End Class

my GetBenefitsList will get the list from this class;

Dim clbenefits As New BenefitsListVB.Benefits 
        Dim bi As BenefitsListVB.Benefits.BenefitInfo 

        For Each bi In clbenefits.GetBenefitsList() 
            cbklab.Items.Add("<a href=" & bi.strPage & ">" & bi.strName & "</a>") 
        Next 


so, what do you think, that coused the error?
I've check whole day but still can't find it.
pls help me...
I copied your code into a web project  I copied your code into a web project
16-Oct-05 01:32 PM
When I use the following code it works:

     Dim cbklab As New Collection


        Dim clbenefits As New Benefits
        Dim bi As Benefits.BenefitInfo

        For Each bi In clbenefits.GetBenefitsList()
            Response.Write(("<a href=" & bi.strPage & ">" & bi.strName & "</a>"))
            Response.Write("<BR>")

        Next

I am able to get a list back of all your items as links.
Create New Account
help
working on remote site I have the config below in my web.config <customErrors defaultRedirect = "error / error.aspx" mode = "On"> <error statusCode = "500" redirect = "error / error.aspx" / > <error statusCode = "404" redirect = "error / error.aspx" / > < / customErrors> I have changed the mode to RemoteOnly with no success Initially i didn
complete, as it keeps stopping. The only clue in the event log is a 5014 error - The DFS Replication service is stopping communication with partner <server> due to an error. The error in question is 1722 (The RPC Server is unavailable). If I restart the DFS service 4CA5-93D3-9923AC11D640} csName:Production updateType:remote 20081001 08:32:57.251 2748 DOWN 5186 [ERROR] DownstreamTransport::RdcGet Failed on connId:{F33E154B-B106-4CA5-93D3-9923AC11D640} csId:{81BF2885-1DE4-4F26-8E2B 00000000-00000000-00000000 + similarity 00000000-00000000-00000000-00000000 + name {066AED9B-313E-4D28-A0C6-4A144863E7C5}-v1075 + Error: + [Error:9027(0x2343) RpcFinalizeContext downstreamtransport.cpp:1096 2748 C A failure was reported by the remote partner] + [Error:9027(0x2343) DownstreamTransport::RdcGet downstreamtransport.cpp:5124 2748 C A failure was reported by the remote partner] + [Error:170(0xaa) DownstreamTransport::RdcGet downstreamtransport.cpp:5124 2748 W The requested resource is in use
Reserved error (Error 3000) DataBase Does anyone know what is causing this error? Reserved error <Item> ; there is no message for this error. (Error 3000) An unexpected error occurred. The specified code identifies the conditions under which this error can occur. Please contact Microsoft Product Support Services for more information. Here's SQL: INSERT
Mapping .NET Framework Hello, I am mapping a class Error to another class YError: YError ToY(Error error) { return new YError { Id = error.ErrorId, CreatedAt = error.CreatedAt, Description = error.Description, HttpCode = error.HttpCode, }; } / / ToY Now I am trying a new version that does the mapping for many errors: IQueryable<YError> ToY(IQueryable<Error> error) { return error.Select(e = > e = <YError> ToY(error)).AsQueryable(); } / / ToY But I get the