473,480 Members | 1,996 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

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 2410
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
4563
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 that please share. Particularly I would like to...
23
6467
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 has been declared? QUESTION-2b: How could I...
23
15548
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 statement returns an empty collection when running from...
10
25603
by: Ben Xia | last post by:
Is there some way can detect MAC address with PHP? any help will be appreciate. Ben
6
5206
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 you hb
12
17018
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 icon) How can you detect when the application...
1
2471
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 correct result.. My code is Do Until rec.EOF...
4
7158
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 popup window. The app is a form based...
0
6908
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7043
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
6921
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5336
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
2995
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
2984
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1300
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
563
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
179
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.