Pulling array out of my own namespace!

Results 1 to 2 of 2

Thread: Pulling array out of my own namespace!

  1. #1
    Join Date
    Dec 1969

    Default Pulling array out of my own namespace!

    Hi there,<BR><BR>I&#039;m trying to figure out how to create and use an array in my own namespace, I&#039;ve got this far, but I&#039;m quite new to asp.net so I&#039;m not sure where to go from here:<BR><BR>Imports System.Data.SqlClient<BR>Namespace GamesExchange<BR> Public Class nameLists<BR> Public Sub consoles()<BR> Dim objConnection As New SqlConnection(ConfigurationSettings.AppSettings("C onnectionString"))<BR> Dim objCommand As SqlCommand = New SqlCommand("SELECT * FROM gx_consoles ORDER BY name", objConnection)<BR> objConnection.Open()<BR><BR> Dim objReader As SqlDataReader = objCommand.ExecuteReader(CommandBehavior.CloseConn ection)<BR> Dim consoleList As New ArrayList()<BR> While objReader.Read()<BR> consoleList.Add(objReader("name"))<BR> End While<BR> objReader.Close()<BR> End Sub<BR> End Class<BR>End Namespace<BR><BR>I&#039;m trying to target it like this:<BR><BR> Dim objConsoleList As GameExchange.nameLists<BR> yconsole.DataSource() = objConsoleList.consoles<BR> yconsole.DataBind()<BR><BR>This line: &#039;objConsoleList.consoles&#039; is underlined in blue in VS.NET and tells me this:<BR><BR>"Expression does not produce a value"<BR><BR>What am I doing wrong here?<BR><BR>TIA<BR><BR>G.

  2. #2

    Default RE: Pulling array out of my own namespace!

    "consoles" is a sub, it doesn&#039;t return a value (that can be assigned to the .DataSource<BR><BR>Look at the datagrid articles on the main site, it should help you.

Posting Permissions

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