all i have the following code <%= Replace(FindAndReplace(objDR.Item("LENTAB_NAME") ),"'","'") %> in this we are replacing the ' character with ', which is working fine. but when i tried to enter values like '"" then it is giving scripting error as
Assume the above contents resides in a file. I want to write a snippet that removes any line which has empty string "" and put escape character before the middle quotations. The final output would be: buildLetter.Append("</head>").AppendLine(); buildLetter.Append("<style type="text/css">").AppendLine();
The outer " .... " is not considered special chars. The special chars may be single quotation or double quotation. I could run it via find and replace feature of Visual Studio. However, in my case I want it to be written in c# or VB.NET
I have a couple of strings (in Ms-Word) which I copy and paste into variables in visual studo. Ms-Word uses high ansi characters for double quotes ("x"). I need the same in my app too. There seems to be no easy way to do this.
1. Visual Studio converts them to simple double quotes ("x") if I let it format the line automatically (auto-indent/auto-format).
2. If I turn autoformatting off and put those characters, I can see the correct characters in the code in Visual Studio editor. But when program is run the behave same as the simple double quotes. They are treated as simple double quotes and converts to simple double quotes in the output.
The only way I could find out is to use Chr() etc. functions to concatenate the character codes at appropriate places. But that's tedious on large strings. I want something to escape these characters appropriately (just like we can put two double quotes to escape the simple double quote character). [code]
1. What is the correct way to escape these characters? I don't need string concatenation; I need it in one string (like x="abc").
2. Are there any other characters also which visual studio messes up?
I use ASP.net VB.net to write a XML file. In one of the element which is called "Description" i have to add a "<![CData[Class : <b>Class Name</b><br>Price: 100,000.00]]>".
How to I convert text to JavaScript escape sequences in VS 2010 ? Let's say my text in textbox is: "ab…". This contains two diacritic characters : and(not English characters).
I want to use Regex.Replace to replace a Match with a context sensitive value. I use the MatchEvaluator for this. But to make things simpler lets say I'm matching %v I want %v to be escapable, so if I use \%v it will not match. Anything else should match.
The pattern I came up with is this: (?:[^\]|^)%v It basically matches %v if it occurs at the beginning of the string, or if it follows any character except . It doesn't capture the first part of the expression.I know this isn't the "right" way to do it. But it worked just fine until I noticed that when I use this pattern in a replace, it includes the character before %v in the replacement(duh, right?)So, if I have ThisIsAValue:%v and I do Regex.Replace, replacing with the string Value, my result will be ThisIsAValueValue instead of ThisIsAValue:ValueI've tried googling this but the fact that "escape character" is so heavy in RegEx, all the results are geared towards the USAGE of escape characters instead of picking them out with a pattern.
I want to build a textbox user control which will remove all the escape characters and when we put the user control in the form it should be sizable.Also i want to create a 3 tier application in vb.net.i need a sample code for it in vb.net.Can u plz post me a simple program as of how the 3tier architecture is been implemented.
The data was being read from a Gridview which had the html encoding. The solution was the following...
Dim Sht_Text As String = HttpUtility.HtmlDecode(row.Cells.Item(0).Text)
I am trying to prevent from having to escape apostrophes and other special characters in my string variables by using a parameterized query with an OleDbConnection. I have all of the parameters in the same order, the insert is working, it just does not maintain the characters. I keep getting those pesky html codes. I am trying to insert into an Access db from a web pages. As I mentioned, its working, just not the special characters.
Here's the code:
Dim pConn As New OleDb.OleDbConnection pConn = New OleDbConnection(cb.ConnectionString) Dim SqlString As String = "INSERT INTO Strings (Mlt_String_ID, Lng_ID, Strg_Name, Sht_Text, Lng_Text, Alt_Text) Values (?, ?, ?, ?, ?, ?)"
[code]....
jp and en records already existed, the insert of fr record pushes the html codes for the small circle which represents the degree symbol. Happens for all other special characters as well.
I have recently developed a serial port communication program to access my hardware firewall and its connected to the device via a converter usb to rs232head plugged to a rs232 to an ethernet cable. this ethernet cable then plugs into the device console port.
my program functions similar to that of TeraTerm. an opensource hyperterminal program written in C++ but i decided to do one for vb.net
Alright to cut the story short, i have successfully coded out the program to accept incomming data from the device but however, i'm also receiving ansi escape sequence along with it and i have no idea how i could implement codes to remove these. i have spend 3 weeks trying to look for vt100 emulation codes written in vb.net but i found none so far. most are written in c++. here's an image to illustrate the problem which im facing.
The image below is a screenshot taken when the i ran both the programs together. The bottom is tera term 3.1 and the top is my vb project which i made using msdn's example and improved on the codes. basically tera term was able to interpret those escape sequence and display accordingly to that of the vt100 terminal display. I have spent time reading on regular expressions using the inbuilt function regex in visual basic and tried parsing some strings but its not working. i guess its far more complex than i thought.
i have a script that reads an xml file then produces some document.write javascript lines and sends them to request . I'm getting a weird character (only shows in internet explorer, not firefox). I can't seem to track it down. Here's a URL of the script being used (has weird chars in IE)The source of the javascript tag is where the .net script is
I want to do the equivalent of the following VB in c#
Function([class]) "hello"
This would be the same as this in c#
class=>"hello"
The problem is that the word class is a key word in the language. But I want to use it as a variable name. In the VB example you can use the [] brackets to 'escape' that key word and allow it to be used as a variable name.
Dim comm_update As New OleDbCommand("update item set status = "On Loan" where itemid=@itemid")
I know I cannot write "On Loan" as above, but I don't know what's the right way. status is an attribute in my access table.The SQL should update the status to string "On Loan"
I'm trying to track down the cause of an annoying interface bug in an app that was ecently upgraded from VS2003 to VS2008 (the bug did not exist pre-migration).What happens is this :1) User clicks in textbox containing a date.2) User clears date3) User tries to move to another field, but can't. No error messages appear - it's as if the validation failed.Further info :1) The textbox's Text property is bound to a dataview which uses a datatable as its source. The bound field is a nullable datetime field with no constraints or default.2) The Validating event fires and the CancelEventArgs property is not set to Cancel. The Validated, LostFocus and Leave events all fire as well, going LostFocus > Leave > Validating3) I can't see any code changes relating to the control or the datasource with a couple of exceptions. The first is that this :
Me.txtRangeEnd.DataBindings.Add(New System.Windows.Forms.Binding("Text", Me.dvClientNos, "RangeEnd")) has now changed to this :
Essentially I am trying to replicate the Windows 7 (In-Windows) activation key TextBox form. The Form where it will auto capitalize letters, remove or deny all non alphanumeric characters except dashes every 5 characters that will be auto-input.I assume this can be done with a fairly complicated replacement Regular Expression but I cannot seem to create one to fit the needs.
This is an Example of what I have right now, but it creates an infinite loop as it removes all characters including dashes, than adds a dash, which changes the text and removes the dash again.
If I needed to escape a double quote character within a string literal I'd use two consecutive double quotes as follows:
Dim name = "Chuck ""Iceman"" Liddell"
However, it doesn't seem like consecutive # works the same way. The compiler is expecting a compiler directive to follow the # character, even when its enclosed in double quotes. How can tell the compiler that I want a # character in my string?
EDIT: as a few of the answers below point out, # is not a reserved character. I closed my solution in Visual Studio and re-opened it and no longer got the compiler squiggles warning me.
I'm trying to execute an sql statement in vb.net to an Access database, I am escaping the reserverd word using square brackets []. This has worked in all my SELECT statements within the program.
The reserved word is level
But the SQL statement below fails saying
Syntax error in INSERT INTO statement.
If I directly copy the statement and execute this in Access it works fine
How to exit a form using escape button in vb.net 2005. I need to show a msg box with yes or no conditions only.... Now I am using this code for exit a form.. If e.KeyCode = Keys.Escape Then Application.ExitThread() End If
I am facing an issue with my code the thing is i want to escape { in the string.format function Of course one way to escape it is to use {{ (2 curly braces)Is there any other way possible to escape without using the double curly braces.
I see that print methods have changed in for vb.net 2010. I have looked up and down the internet and have found many examples for earlier versions of vb, but these can not be used in 2010.
I can not use graphics.drawstring / printdocument method because I need to send escape sequences.
While searching on how to escape a single quote in String.Format, I found the answer at SO: Escaping single quote in String.Format(). It seems to be different for VB though. I tested it, and indeed C# needs
string s = DateTime.Now.ToString("MMM d \'yy 'at' H:mmm"); while VB needs Dim s As String = Now.ToString("MMM d 'yy 'at' H:mmm")
Why does C# need a double backslash, and VB a single backslash? This might be a bit of a silly question to C# users, but while I can read C#, I'm not used to writing it.