2011-12-30 7 views
0

私はそれを変換することはできませんVB.NETでこのコードを希望するC#で... VB.Net

CODE1

Response.Redirect("user.aspx?val=" + txtBox.Text); 
string strVal = Request.QueryString["val"]; 

CODE2をコードスニペットを変換する

Session["val"] = txtBox.Text; 
Response.Redirect("user.aspx"); 
String strVal = (string) Session["val"]; 
+4

なぜいけないのでしょうか?何を試しましたか? – SLaks

+0

このリンクを確認してください。
[http://www.developerfusion.com/tools/convert/csharp-to-vb/](http://www.developerfusion.com/tools/convert/csharp-to-vb/) –

答えて

1

はここですあなたの翻訳:

Response.Redirect("user.aspx?val=" & txtBox.Text) 

Dim strVal As String = Request.QueryString("val") 

および

Session("val") = txtBox.Text 
Response.Redirect("user.aspx") 

Dim strVal As String = DirectCast(Session("val"), String) 
1

CODE1:

Response.Redirect("user.aspx?val=" & txtBox.Text) 


Dim strVal As String 
strVal=Request.QueryString("val") 

CODE2:

Session("val)=txtBox.Text 
Response.Redirect("user.aspx") 


Dim strVal As String 
strVal=Cstr(Session("val"))