Wrox Home  
Search P2P Archive for: Go

  Return to Index  

aspx_beginners thread: vb.not


Message #1 by "Dan McKinnon" <mddonna@q...> on Tue, 30 Apr 2002 03:14:04
The things that seemed easy to do with VBScript are more difficult for me 
with vb.net.

I'm having a devil of a time just trying to retrieve a querystring 
variable. I have a code behind vb page that is getting a variable 
called 'date' from a querystring from another page and I'm just trying to 
get it into a variable on the code behind page so I can use it.

Here is some of my code, which I'm just putting in a Page_Load Sub.

Public Sub Page_Load()
	Dim strDate As String = System.Web.HTTPRequest.QueryString("date")
	Dim requestDate As Date = CDate(strDate)
	Dim myMonth As String = requestDate.month
...

This code returns the error:
Compiler Error Message: BC30469: Reference to a non-shared member requires 
an object reference.
Source Error:
Line 15: 	
Line 16: 	Public Sub Page_Load()
Line 17: 	Dim strDate As String = System.Web.HTTPRequest.QueryString
("date")
Line 18: 	Dim requestDate As Date = CDate(strDate)
Line 19: 	Dim myMonth As String = requestDate.month

Can anyone tell me what I'm doing wrong?

Thanks,
Dan
 
Message #2 by "Minh T. Nguyen" <nguyentriminh@y...> on Mon, 29 Apr 2002 20:51:12 -0700
Dan,

	The official syntax is:
	strDate = Request.QueryString.Get("date")

Hope this works,
Minh.

-----Original Message-----
From: Dan McKinnon [mailto:mddonna@q...] 
Sent: Tuesday, April 30, 2002 3:14 AM
To: aspx_beginners
Subject: [aspx_beginners] vb.not


The things that seemed easy to do with VBScript are more difficult for
me 
with vb.net.

I'm having a devil of a time just trying to retrieve a querystring 
variable. I have a code behind vb page that is getting a variable 
called 'date' from a querystring from another page and I'm just trying
to 
get it into a variable on the code behind page so I can use it.

Here is some of my code, which I'm just putting in a Page_Load Sub.

Public Sub Page_Load()
	Dim strDate As String 
System.Web.HTTPRequest.QueryString("date")
	Dim requestDate As Date = CDate(strDate)
	Dim myMonth As String = requestDate.month
...

This code returns the error:
Compiler Error Message: BC30469: Reference to a non-shared member
requires 
an object reference.
Source Error:
Line 15: 	
Line 16: 	Public Sub Page_Load()
Line 17: 	Dim strDate As String 
System.Web.HTTPRequest.QueryString
("date")
Line 18: 	Dim requestDate As Date = CDate(strDate)
Line 19: 	Dim myMonth As String = requestDate.month

Can anyone tell me what I'm doing wrong?

Thanks,
Dan
 


  Return to Index