"With" in c#


S

sck10

Hello,

Is there the equivalent of the "with" command in c#?


protected void SetFocusControl(Control FocusControl)
{

System.Text.StringBuilder script = New System.Text.StringBuilder();
string ClientID = FocusControl.ClientID;
With script{
.Append["<script language='javascript'>"];
.Append("document.getElementById('");
.Append(ClientID);
.Append("').focus();");
.Append("</script>");
} //End With
Me.Clientscript.RegisterStartupscript(GetType(String),
"SetFocusControl", script.ToString());

}
 
Ad

Advertisements

G

Guest

Nor should there be, IMHO.

--
-Demetri


Winista said:
no

sck10 said:
Hello,

Is there the equivalent of the "with" command in c#?


protected void SetFocusControl(Control FocusControl)
{

System.Text.StringBuilder script = New System.Text.StringBuilder();
string ClientID = FocusControl.ClientID;
With script{
.Append["<script language='javascript'>"];
.Append("document.getElementById('");
.Append(ClientID);
.Append("').focus();");
.Append("</script>");
} //End With
Me.Clientscript.RegisterStartupscript(GetType(String),
"SetFocusControl", script.ToString());

}
 
K

Karl Seguin [MVP]

You can find out about why at:
http://www.gotdotnet.com/team/csharp/learn/columns/ask.aspx#with

Karl

--
http://www.openmymind.net/
http://www.fuelindustries.com/


Winista said:
no

sck10 said:
Hello,

Is there the equivalent of the "with" command in c#?


protected void SetFocusControl(Control FocusControl)
{

System.Text.StringBuilder script = New System.Text.StringBuilder();
string ClientID = FocusControl.ClientID;
With script{
.Append["<script language='javascript'>"];
.Append("document.getElementById('");
.Append(ClientID);
.Append("').focus();");
.Append("</script>");
} //End With
Me.Clientscript.RegisterStartupscript(GetType(String),
"SetFocusControl", script.ToString());

}
 
G

Guest

Fortunately, Microsoft saw fit to create C# from the ground up, which some
people say gave them the luxury of leaving out all the little crutches and
bad-programming practices constructs that more or less "had" to come along
for the ride in VB.NET.
And "With" is one of them.
Peter
 
Ad

Advertisements

G

Guest


Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top