.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

switch from vB to c#

Posted By:      Posted Date: September 29, 2010    Points: 0   Category :ASP.Net

on  the first time  I use my vistual studio 2010  , I chose Vb, is that possible for me to switch to c#

Thnak you!

View Complete Post

More Related Resource Links



Hello, i need help changing the following code into a switch...case statementUndecided

<script runat="server">
void Page_Load()
    if (Page.IsPostBack)
    public String toSring()
    int intcomputerChoice=1;
       if (Page.IsPostBack)

How to switch between HTTP and HTTPS in ASP.NET MVC2


ASP.NET MVC2 has the new RequireHttpsAttribute that you can use to decorate any action to force any non-secure request to come through HTTPS (SSL).  It can be used as simply as this:

        public ActionResult LogOn()

Now any request to the LogOn action that is not over HTTPS will automatically be redirected back to itself over HTTPS.  This is very useful and easy to implement.

Unfortunately though, once the scheme is changed to HTTPS, all following requests will also be under HTTPS, which is not necessarily what you want.  In most cases you do not need all requests to your site to be secure but only certain ones such as the logon page or pages that accept credit card information. 

To handle this you can override the Controller.OnAuthorization method.  From within this method, you can check to see if the RequireHttps attribute is set on the Controller Action by searching the Attributes collection of the ActionDescriptor object. If the RequireHttpsAttribute is not set AND the request is under SSL, then return a redirect result to the HTTP (no

enum and switch need help

void Main()
	string t = "Vendor";
	switch (t)
		case PType.Client :
		case PartyType.Vendor :

public enum PType

When I try to run these code got error:  cannot implicitly convert type PType to string

If I change PType.Client to PType.Client.ToString() got error: A constant value is expected


Whats wrong with this code, im getting blue line under the createStatus next the switch

Error message: Use of unassigned local variable 'createStatus'
            MembershipCreateStatus createStatus;
            MembershipUser newUser = Membership.CreateUser(Username.Text, Password.Text, Email.Text);

            switch (createStatus)
                case MembershipCreateStatus.Success:
                    this.CreateAccountResults.Text = "The user account was successfully created!";
                case MembershipCreateStatus.DuplicateUserName:
                    this.CreateAccountResults.Text = "There already exists a user with this username.";
                case MembershipCreateStatus.DuplicateEmail:
                    this.CreateAccountResults.Text = "There already exists a user with this email address.";
                case MembershipCreateStatus.InvalidEmail:
                    this.CreateAccountResults.Text = "There email address you provided in invalid.";
                case MembershipCreateStatus.InvalidPassword:
                    this.CreateAccountResults.Text = "The password you provided is invalid. It must be seven characters long and have at least one non-a

Switch views when opening a form depending on submit locations?



I would like to know it was possible to switch views when opening a form depending on where the form has been submitted.

I am submitting my form to library A and library B and want to be able to open it in view 1 in library A and in view 2 in library B.

Is there a way to set some url conditions in the open behavior rules?

Thanks a lot!

Cannot switch between tabs of a tab control at design time

Hi, I have the same problem as this fellows description below. Any suggestions? Cannot switch between tabs of a tab control at design time 06-11-2010 4:21 PM | Hi. I'm using a tabcontrol with some tabs. it works fine in the navigator but in design time a cannot switch between tabs to insert content in graphic mode. When i have created this tabcontrol, i could move me across the tabs. Now when i click the tab it jump the possition in the xaml code but not in the Design. Whats happening? Thanks in advance.

switch between http to https

What is the best way to switch to https from http for some of my aspx pages. Currently, I"m using relative page for all pages.

How to switch to a different Web Part page layout?

I'm not sure if the capabilities are available in SP2010, but I have a web part page that I would like to change to a different layout. In the past I have always recreated the page, which takes a ton of time, but I would rather switch to a different layout on the fly and move everything around again. Is this possible?

Javascript error when attempting to switch page layouts in SharePoint 2010

I hope I put this in the correct forum. I am experiencing the following error when attempting to change the layout of an existing SharePoint 2010 page. But it does not seem to happen on all page types, just publishing pages. This error is happening on both the development server and both test servers. I have look in to the logs, since if it a javascript error there was nothing, which would be expected but I had to try. I have look at the cui.js file but was unable to spend enough time trying to figure out what exactly is going on in this file. Error being received ... Webpage error details User Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; WOW64; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; MS-RTC LM 8; .NET4.0C; .NET4.0E; InfoPath.3) Timestamp: Tue, 7 Sep 2010 21:10:54 UTC Message: Object required Line: 2 Char: 6422 Code: 0 URI: http://devintranet2010.myconexus.ca:85/_layouts/cui.js?rev=wvoVpqlQb30nGo4DjDk8Kg%3D%3D   If anyone has any ides or can point me in a direction that will allow me to productively continue my investigation, the information would be greatly appreciated. Regards Kyle

Cannot switch to design mode - Load Failed! Cannot Load fpacutl10.dll

I have just upgraded from Visual Studio 2005.  I cannot switch to design mode in my Web Application project.  I keep getting the following error:Load Failed! Cannot Load fpacutl10.dll.Any reason for this?  I have just run Windows Updates and I still get the issue.Thanks in advance.

Server Busy "Switch to" problem (C#)

I hope this is the right forum. But I have the following problem i have an application wich uses a COM object. In one of my methods I Ask the com object for an article id. The com object displays a dialog where the user can sellect the right one. If the user wait's to long he get's the message Server is busy "Switch to" how can I prevent it that this message is thrown. I Use the following code so far. public class ERPConnectionRidder8 : IErpConnection { private RidderApplication application; #region IErpConnection Members public object FindArticle() { IRidderTable articleTable = application.CreateR8Table("ARTIKEL"); object articleNumber = application.ShowBrowse("ARTIKEL", articleTable, "ARTIKELNUMMER"); return articleNumber; } public bool Login(string user, string password, bool showLogin) { if (application == null) { application = new RidderApplication(); } return application.Login(user, password, "001", showLogin); } public void Logout() { application.Logout(); } #endregion } The FindArticle Method is causing the problems when called

Visual Web Developer 2008 Express freezes when I switch to design view.

When I try to switch to design view of any form, aspx, or html, the entire program freezes and I heave to end task. It also freezes if I click Tools, Options, HTML Designer, CSS Styling. Any help would be appreciated.

How can I switch the "Linked to document" link from the 'name' column to another column e.g. title

In SP2010 it is not possible to click on the icon to open a document in a list web part. Therefore I want to move the 'linked to document' feature from the name colum to the title column (as I do not show the name colum on the site). How can I do it or how can I make sure that clicking on the document icon leads me to the document and not to the edit menu?

switch case not working - what am I doing wrong

Hi, pretty strange issue with switch case. It is not working. Here is the code:if (!IsAchieved) { //Status will show count of tasks finished for achievement switch (ach.AchievementCode) { case Constants.DEFEAT_VILLAGE_GUARD_CODE : achGridRow.AchStatus = Constants.IN_PROGRESS + userAchParams.VillageGuardDefeated + "/" + ach.AchievementMax; break; case Constants.FIRST_STEP_CODE : achGridRow.AchStatus = Constants.IN_PROGRESS + userAchParams.NoOfMatchSurvived + "/" + ach.AchievementMax; break; default: achGridRow.AchStatus = "Unknown"; break; } }While debugging, I see that even though ach.AchievementCode is same as Constants.FIRST_STEP_CODE, it still goes to default. I also tried removing Constants.FIRST_STEP_CODE and put "FS" but still it is going to default.What could be the possible reason for this behavior? Both ach.AchievementCode and Constants.FIRST_STEP_CODE are string values.I am sure this is something elementary, just missing my eyes. Perhaps you people could

How to use switch - case statement in T-SQL..?

Hi, I want to use switch - case statement in T-SQL stored procedure. Can any one help regarding the same..?   for e.g. switch (exp) { case 1 : stmt 1; break; case 2 : stmt 2; break; case 3 : stmt 3; break; & so on....... }

Workflow switch case activity splitter

Hi All, Can anyone advise, if the switch case activity accept case splitter?  If yes, how? Example: switch (number) Case 1, 5: Kindly advise.
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend