Showing posts with label forms. Show all posts
Showing posts with label forms. Show all posts

Monday, March 26, 2012

Pass values in QueryString using VB.Net

Response.Redirect("http://localhost/WebApplication3/Forms/paymentprocessing.aspx?fname=+"

'Me.txtFirstName.Text"'", False)

how do i pass the text from a control in the querey string???

Dim myURL as string = "http://Localhost/WebApplication3/Forms/paymentprocessing.aspx?fname="

myURL = myURL & Me.txtFirstName.Text

Response.Redirect(myURL, False)

Friday, March 16, 2012

Passing an array as a session variable

I have 2 asp.net forms. In the first form I create a one dimensional array and copy that array into a session object. In the second form I want to read the elements of that array. Everything I've tried results in either a casting error, a late binding error or nothing at all. The following code shows what Iwant to do.

Form one: Dim aArray(2) as stringaArray(0) = "zero"aArray(1) = "one"Session("PassArray") = aArray
Form two: Dim aTest(2) as stringaTest(0) = CType(Session("PassArray(0)"), String)aTest(1) = CType(Session("PassArray(1)"), String)When I run form two in the editor, I can Watch Session("PassArray") and see:Session("PassArray") {System.Array} object-- (0) "zero" string-- (1) "one" stringSo I know it's there and available, but how do I read the extents.

Could really use a simple code example to explain what I'm doing wrong.

Hi,

Use this on the second form:

Dim aTest() As String = CType(Session("PassArray"), String())


That did it. Thank you.