Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Dec 22nd, 2009, 3:51 AM   #1
Zukeru
Newbie
 
Join Date: Aug 2009
Posts: 10
Rep Power: 0 Zukeru is on a distinguished road
Error With Substring Command

I use visual studio 2008 and i am trying to pick out specific desgnator from a string and then display the next 5 charecters.

I get
"ArgumentOutOfRangeException was unhandled"
Startindex cannot be less than zero. Parameter name: Startindex

My code

dim networkstream as networkstream = tcpclient.getstream()
if networkstream.canwrite and networkstream.canread then
dim bytes(tcpclient.recievebuffersize) as byte
networkstream.read(bytes, 0, CInt(tcpclient.recievebuffersize))
dim returndata as string = encoding.ascii.getstring(bytes)
dim slpart as string
dim possl as integer
possl = returndata.indexof("Sl")
slpart = returndata.substring(possl, 7)
if slpart = 7 then
label1.text = slpart
else
end if
Zukeru is offline   Reply With Quote
Old Dec 22nd, 2009, 3:55 AM   #2
Zukeru
Newbie
 
Join Date: Aug 2009
Posts: 10
Rep Power: 0 Zukeru is on a distinguished road
Re: Error With Substring Command

if I change it to Int(possl = returndata.indexof("sl") it stops lookinf for sl in the string coming from the network stream
Zukeru is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
How to make your/my own command line program FoggyDreamer C 3 Mar 21st, 2009 6:40 PM
How to Fire a command From FILE jdKool C 7 Jan 10th, 2009 3:24 PM
Trying to pipe output system command results directly into a variable VernonDozier C++ 5 Jan 6th, 2008 2:39 AM
Command Prompt SkyPioneer Coder's Corner Lounge 5 May 3rd, 2006 10:07 PM
system () command in Borland C++ Bldr. 4 L7Sqr C++ 14 Jun 18th, 2005 8:15 PM




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 10:56 AM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC