.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

@"...\..." and "...\\.." backslash string handling not working

Posted By:      Posted Date: May 22, 2011    Points: 0   Category :Windows Application

I have a string with a directory path C:\ABC\DEFG\ETC.   But string directorypath = @"C:\ABC\DEFG\ETC" at run time is @"C:\\ABC\\DEFG\\ETC.  And string  directorypath = "C:\\ABC\\DEFG\\ETC" is also at run time C:\\ABC\\DEFG\\ETC.  I have googled around but I can't find a solution.  Is it because I am using English regional and keyboard settings perhaps?

View Complete Post

More Related Resource Links

how add a simple backslash to the string

Hi,A question seems to be simple.I have 2 string variables like:string str1="stringOne"; string str2="stringTwo"; What I need is to get a variable like:string str3="stringOne\stringTwo"; How can get that?I tried to use:string str3=str1+"\"+str2;but it doesnt compile.Even I tried:string str3=str1+"\\"+srt2; and string str3=str1+@"\\"+str2;but result is "stringOne\\stringTwo"Any suggestions?

TextBox AutoPostBack not working when handling other DHTML event


I have to format a number in a TextBox while it is being typed. Right after the TextBox looses focus, I need to do other processing on server side, including some database queries.

I'm doing the formatting by handling the onkeyup event, client side. But when I add the handler, the onTextChanged event stops firing on the server. I've tried different return values for the handler but unfortunatelly I'm stuck.

To reproduce the problem, here is a sample where the formatting function was replaced by a simple "convert to uppercase" function. You'll see that, contrary to the expected, the Label doesn't get filled when the TextBox looses focus. It does get filled, however, if the user presses the ENTER key.

What can I possibly be doing wrong with such a simple task?


<%@ Page Language="VB" %>

<script language="VB" runat="server">

Sub Page_Load(ByVal Sender As Object, ByVal E As EventArgs)

'' Adding the event handler like this has the same effect as adding it inline

'txtTextBox.Attributes.Add("onkeyup", "return(upperCase(this));")

End Sub

Protected Sub txtTextBox_TextChanged(ByVal sender As Object, ByVal e As System.EventArgs)

lblTextBox.Text = S

Code working in XP / 32 bit won't work in Win 7 / 64 bit - "Input string was not in a correct forma


I'm working on a program in VS 2008 / XP 32 bit. So far everything has been working
fine in both XP 32 bit and Win 7 / 64 bit - until I introduced the following piece of

        private void DateFilter()
            // strDate = "MM/dd/yyyy";

            // convert strDate to yyyyMMdd
            strConvYear = strDate.Substring(6, 4);
            strConvMonth = strDate.Substring(0, 2);
            strConvDay = strDate.Substring(3, 2);
            strConvDate = convYear + convMonth + convDay; // yyyyMMdd
            intConvDate = Convert.ToInt32(strConvDate);

            // convert DateTimePicker (dtpSortDates) format yyyy-MM-dd to yyyyMMdd
            intDtpSortDates =

Working with SharePoint document libraries

Document libraries are collections of files that you can share with team members on a Web based on Microsoft Windows SharePoint Services. For example, you can create a library of common documents for a project, and team members can use their Web browsers to find the files, read them, and make comments. Users with Microsoft Office 2003 can check out and edit the files as if they resided on a local or network drive.

By default, your team Web site comes with a built-in document library named Shared Documents, which is listed on the Quick Launch bar as well as on the Documents and Lists page.


Every self-respected programmer should include exception handling techniques. Sometimes your application will generate an error. Regardless of who was responsible for this error, the programmer or the user, it is up to the first to include the necessary exception handling techniques to keep his/her program from crashing. The .Net environment provides useful techniques for avoiding disastrous errors such as try-catch statements and user-defined exceptions.

Global Exception Handling with ASP.NET

After your global exception handler has done its work, you'll want to redirect the users of your website to a friendly page that tells them that something has gone wrong, and then provide them with customer support information as well as a link back to your web application's home page.

How to Encrypt Query String Parameters in ASP.NET

Encrypt Query String Parameters in ASP.NET.u can send secure data one page another page u can also use query string to encrypt

Working with DropDownList and ListBox Controls in ASP.NET

"In my application i am using dropdownlist to display all categories from a table. When the user clicks this control I display all records in that category. Category table also contains column called color.

I wanted display some categories in dropdown list different color and others in different color using ASP.NET."-Anonymous

Connestion string create any database server

This links important to how to create connection string to any data base sever.

SQL Server 2005 Try and Catch Exception Handling

I'm pretty excited to see that there is some real error handling for T-SQL code in SQL Server 2005. It's pretty painful to have your wonderfully architected .NET solution tainted by less-than-VBScript error handling for stored procedures in the database. The big difference being the addition of TRY..CATCH blocks. Let's take a look:

SQL Connection String

We can learn or know how can we connect the database from our .net. This will help for freshers or .NET beginners!

Built-in Functions - String Functions

String functions let you extract various portions of character strings, change the case of strings, concatenate and reverse strings and perform many other types of manipulations. All built-in string functions are deterministic with the exception of CHARINDEX and PATINDEX

abstract away the source of the connection string using a class with a static property.

ASP.NET provides a configuration system we can use to keep our applications flexible at runtime. In this article we will examine some tips and best practices for using the configuration system for the best results.

The element of a web.config file is a place to store connection strings, server names, file paths, and other miscellaneous settings needed by an application to perform work. The items inside appSettings are items that need to be configurable depending upon the environment, for instance, any database connection strings will change as you move your application from a testing and staging server into production.

Let's abstract away the source of the connection string using a class with a static property.

Server side validation of Fileupload control not working



I've tried this method in my code behind to try and validate that the Fileupload control has a file or not. I get the error message the the event "Server Validate" cannot be found. Can anyone tell why? Thanks.

Public Sub CustomValidator1_ServerValidate(ByVal source As Object, ByVal args As System.Web.UI.WebControls.ServerValidateEventArgs) Handles CustomValidator1.ServerValidate

' Get file name

        Dim uploadAvatar As FileUpload = DirectCast(AdvertisementForm.FindControl("uploadAvatar"), FileUpload)

        Dim UploadFileName As String = uploadAvatar.PostedFile.FileName

        If UploadFileName = "" Then
            ' There is no file selected
            args.IsValid = False
            Dim Extension As String = UploadFileName.Substring(UploadFileName.L

Handling 404 page not found with Error page



      How do i handle 404 page not found?

highlight string


i am looking for a function that takes two string parameters 

str1 = "hello how are you today mr john"

str2 = "how today"

and in return it shoud highlight the words "how" and "today".

Any ides? I prefer if its possible using reg expression...Thanks

Could some one tell me whats the Problem with this String Manipulation ??? C#.net



I store some values from code behind to a label which is Hidden !

<asp:Label ID="lbl_Hidden" runat="server" Visible = "false"></asp:Label>

and at the page load event i retrieve the value of the label & assign it to a string !

stringvalue = lbl_Hidden.Text;

Now i dont know why this manipulation does'nt work !

I've a character 'A' in the string and i'm unable to replace it with a space !

stringvalue.Replace(A, " ");

Wot do u think abt it ????

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