472,353 Members | 1,190 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,353 software developers and data experts.

how can i detect multiplt VBNewLine's in a row

SLH
if i have a text area on a page that i want to validate, and i dont want
there to ever be 2 "enter"s in a row, how can i check for this?
ive been playing with something like:

If InStr(string, "vbnewline&vbnewline") <0

but i cant get that to work no matter what i do with the quotes etc. but
thats the general idea of what i want to do.
any ideas?
Oct 5 '06 #1
6 2345
SLH wrote:
if i have a text area on a page that i want to validate, and i dont
want there to ever be 2 "enter"s in a row, how can i check for this?
ive been playing with something like:

If InStr(string, "vbnewline&vbnewline") <0

but i cant get that to work no matter what i do with the quotes etc.
but thats the general idea of what i want to do.
any ideas?
vbCrLf & vbCrLf
--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.
Oct 5 '06 #2
SLH
thank you ill try that now. question, what is the actual difference between
vbNewLine and vbCrLf?
i ask because i do some other things on various pages using vbNewLine and im
wondering if there is good reason to change it to vbCrLf

thanks

"Bob Barrows [MVP]" <re******@NOyahoo.SPAMcomwrote in message
news:Op**************@TK2MSFTNGP04.phx.gbl...
SLH wrote:
>if i have a text area on a page that i want to validate, and i dont
want there to ever be 2 "enter"s in a row, how can i check for this?
ive been playing with something like:

If InStr(string, "vbnewline&vbnewline") <0

but i cant get that to work no matter what i do with the quotes etc.
but thats the general idea of what i want to do.
any ideas?

vbCrLf & vbCrLf
--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.


Oct 5 '06 #3
They are platform/situation-dependent:
http://msdn.microsoft.com/library/de...scriptinga.asp

I posted that suggestion without testing, assuming it would be the
answer. It turns out I was wrong. According to this test:
<%
dim s, i, ar
ar=array(vbNewLine, vbCrLf)
for each s in ar
Response.Write "Next constant:<BR>"
for i = 1 to len(s)
Response.Write Asc(mid(s,i,1)) & "<BR>"
next
next
%>

The two constants would seem to be equivalent in this situation. So, I
would suggest looping through your string (similar to the above) and
discover what actually is being passed in the form submission for line
break characters.

In fact, based on this test:
<%
if Request.Form.Count>0 then
dim s, i
s=Request.Form("txt")
for i = 1 to len(s)
Response.Write Asc(mid(s,i,1)) & "<BR>"
next
Response.Write "Instr(s,vbCrLf & vbCrLf): " & Instr(s,vbCrLf & vbCrLf)
& "<BR>"
Response.Write "Instr(s,vbNewLine & vbNewLine): " & Instr(s,vbNewLine &
vbNewLine) & "<BR>"
end if
%>
<HTML>
<BODY>
<FORM action="" method=POST id=form1 name=form1>
<textarea name=txt></textarea>
<INPUT type="submit" value="Submit" id=submit1 name=submit1>
</FORM>
</BODY>
</HTML>

Both constants seem to work when I enter a<enter><enter>a in the text
area and submit it.

SLH wrote:
thank you ill try that now. question, what is the actual difference
between vbNewLine and vbCrLf?
i ask because i do some other things on various pages using vbNewLine
and im wondering if there is good reason to change it to vbCrLf

thanks

"Bob Barrows [MVP]" <re******@NOyahoo.SPAMcomwrote in message
news:Op**************@TK2MSFTNGP04.phx.gbl...
>SLH wrote:
>>if i have a text area on a page that i want to validate, and i dont
want there to ever be 2 "enter"s in a row, how can i check for this?
ive been playing with something like:

If InStr(string, "vbnewline&vbnewline") <0

but i cant get that to work no matter what i do with the quotes etc.
but thats the general idea of what i want to do.
any ideas?

vbCrLf & vbCrLf
--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get
a quicker response by posting to the newsgroup.
--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.
Oct 5 '06 #4
SLH wrote:
if i have a text area on a page that i want to validate, and i dont
want there to ever be 2 "enter"s in a row, how can i check for this?
ive been playing with something like:

If InStr(string, "vbnewline&vbnewline") <0
Oh jeez, I just noticed. it should be:

If InStr(string, vbnewline & vbnewline) 0 then
--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.
Oct 5 '06 #5
SLH

"Bob Barrows [MVP]" <re******@NOyahoo.SPAMcomwrote in message
news:uV**************@TK2MSFTNGP06.phx.gbl...
They are platform/situation-dependent:
http://msdn.microsoft.com/library/de...scriptinga.asp

I posted that suggestion without testing, assuming it would be the
answer. It turns out I was wrong. According to this test:
<%
dim s, i, ar
ar=array(vbNewLine, vbCrLf)
for each s in ar
Response.Write "Next constant:<BR>"
for i = 1 to len(s)
Response.Write Asc(mid(s,i,1)) & "<BR>"
next
next
%>

The two constants would seem to be equivalent in this situation. So, I
would suggest looping through your string (similar to the above) and
discover what actually is being passed in the form submission for line
break characters.

In fact, based on this test:
<%
if Request.Form.Count>0 then
dim s, i
s=Request.Form("txt")
for i = 1 to len(s)
Response.Write Asc(mid(s,i,1)) & "<BR>"
next
Response.Write "Instr(s,vbCrLf & vbCrLf): " & Instr(s,vbCrLf & vbCrLf)
& "<BR>"
Response.Write "Instr(s,vbNewLine & vbNewLine): " & Instr(s,vbNewLine &
vbNewLine) & "<BR>"
end if
%>
<HTML>
<BODY>
<FORM action="" method=POST id=form1 name=form1>
<textarea name=txt></textarea>
<INPUT type="submit" value="Submit" id=submit1 name=submit1>
</FORM>
</BODY>
</HTML>

Both constants seem to work when I enter a<enter><enter>a in the text
area and submit it.

SLH wrote:
>thank you ill try that now. question, what is the actual difference
between vbNewLine and vbCrLf?
i ask because i do some other things on various pages using vbNewLine
and im wondering if there is good reason to change it to vbCrLf

thanks

"Bob Barrows [MVP]" <re******@NOyahoo.SPAMcomwrote in message
news:Op**************@TK2MSFTNGP04.phx.gbl...
>>SLH wrote:
if i have a text area on a page that i want to validate, and i dont
want there to ever be 2 "enter"s in a row, how can i check for this?
ive been playing with something like:

If InStr(string, "vbnewline&vbnewline") <0

but i cant get that to work no matter what i do with the quotes etc.
but thats the general idea of what i want to do.
any ideas?

vbCrLf & vbCrLf
--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get
a quicker response by posting to the newsgroup.

--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.



right now im looking for vbCrLf & vbCrLf (2 or more in a row) and replacing
with a single vbCrLf.
i keep looping until theyve all been replaced. this seems to work....
Oct 5 '06 #6
SLH wrote:
right now im looking for vbCrLf & vbCrLf (2 or more in a row) and
replacing with a single vbCrLf.
i keep looping until theyve all been replaced. this seems to work....
Something like this?

Do Until Instr(string, vbCrLf & vbCrLf)=0
string = Replace(string,vbCrLf & vbCrLf,vbCrLf)
Loop

(yeah, I know there's a great regex solution for this, but I'm leaving
that as an exercise ... )

--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.
Oct 5 '06 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
by: R. Rajesh Jeba Anbiah | last post by:
Here is a nice code to detect utf-8 <http://in2.php.net/utf8_encode#39986> But, I couldn't find out the logic behind the script. If anyone knows...
23
by: David McCulloch | last post by:
QUESTION-1: How can I detect if Norton Internet Security is blocking pop-ups? QUESTION-2a: How could I know if a particular JavaScript function...
23
by: Michel Bany | last post by:
I am trying to parse responseXML from an HTTP request. var doc = request.responseXML; var elements = doc.getElementsByTagName("*"); the last...
10
by: Ben Xia | last post by:
Is there some way can detect MAC address with PHP? any help will be appreciate. Ben
6
by: hb | last post by:
Hi, Would you please tell me how to detect if the client's browser is closed? I need such event to trigger a database modification. Thank...
12
by: Patrick Dugan | last post by:
I have an vb.net application that is a module that uses a "application.run" in the sub main to start. There is no form involved (just a system tray...
1
by: sunilkds | last post by:
I am using MSFlexGridcontrol.In that i want input value in to next line of the row @ run time in a single row I used VBNEWLINE ,but i didnt get...
4
by: goscottie | last post by:
I used submodal as my popup window. With some tweaks, it working great in my app. However, I can't find a way to detect session timeout in the...
1
by: Kemmylinns12 | last post by:
Blockchain technology has emerged as a transformative force in the business world, offering unprecedented opportunities for innovation and...
0
by: Naresh1 | last post by:
What is WebLogic Admin Training? WebLogic Admin Training is a specialized program designed to equip individuals with the skills and knowledge...
0
by: antdb | last post by:
Ⅰ. Advantage of AntDB: hyper-convergence + streaming processing engine In the overall architecture, a new "hyper-convergence" concept was...
0
by: Matthew3360 | last post by:
Hi there. I have been struggling to find out how to use a variable as my location in my header redirect function. Here is my code. ...
0
by: Arjunsri | last post by:
I have a Redshift database that I need to use as an import data source. I have configured the DSN connection using the server, port, database, and...
0
by: Matthew3360 | last post by:
Hi, I have been trying to connect to a local host using php curl. But I am finding it hard to do this. I am doing the curl get request from my web...
0
Oralloy
by: Oralloy | last post by:
Hello Folks, I am trying to hook up a CPU which I designed using SystemC to I/O pins on an FPGA. My problem (spelled failure) is with the...
0
by: Carina712 | last post by:
Setting background colors for Excel documents can help to improve the visual appeal of the document and make it easier to read and understand....
0
by: Rahul1995seven | last post by:
Introduction: In the realm of programming languages, Python has emerged as a powerhouse. With its simplicity, versatility, and robustness, Python...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.