Ok I dim x as integer now I get back an error:
Server Error in '/' Application. -------------------------------------------------------------------------------- Input string was not in a correct format. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.FormatException: Input string was not in a correct format. Source Error: Line 330: newstring_withnum_tostr = words1.substring(location + x, 1) Line 331: Line 332: words1.Replace(newstring_withnum_tostr, Cint(newstring_withnum_tostr) + 1) Line 333: Line 334: ' newstr = words1.Insert(newstring_withnum_tostr + 4, "_" & Counter + 1) ----- Original Message ----- From: Mischa Kroon To: [email protected] Sent: Wednesday, May 11, 2005 3:02 PM Subject: Re: [AspNetAnyQuestionIsOk] VB.net String maniplulation problem x stands for I'm not certain at this point :) I think it's 5 but could be 4 Pizza sounds good btw :) ----- Original Message ----- From: "Tony Trapp" <[EMAIL PROTECTED]> To: <[email protected]> Sent: Thursday, May 12, 2005 12:11 AM Subject: Re: [AspNetAnyQuestionIsOk] VB.net String maniplulation problem > Micha fallowing along I know x in math represents the unknown and of > course if its not declared I will get back an error so what is x > representing in this equation? > > Thanks for your help by the way, can I buy you a pizza? LOL > > Tony... > > ----- Original Message ----- > From: Mischa Kroon > To: [email protected] > Sent: Wednesday, May 11, 2005 2:48 PM > Subject: Re: [AspNetAnyQuestionIsOk] VB.net String maniplulation problem > > > whoops didn't read the full message. > > here is where you go wrong i think :) > > > > location = words1.IndexOf("_new") > > > > If location > 0 or not -1 then > > > > location will give the location of the start of "_new" > you want the next char not the position of the "_" > > then: newstring_withnum_tostr = words1.substr (location + x, 1) > words1.replace (newstring_withnum_tostr, cint (newstring_withnum_tostr) + > 1 ) > > check it: > > response.write (words1) > > > > > > ----- Original Message ----- > From: "Tony Trapp" <[EMAIL PROTECTED]> > To: <[email protected]> > Sent: Wednesday, May 11, 2005 11:13 PM > Subject: [AspNetAnyQuestionIsOk] VB.net String maniplulation problem > > > > Hey guys here is what I want to do. > > > > Lets say I have a file name is my database my_pic_new1.jpg first off. > > > > Now I want to change this file name to make it a uniqe file name but > > I need to do a few things to the string first. > > > > Is in the string _new is there then I want to see if a number is > > there. > > > > If there is a number there I want to take that number and what ever > > it is increment that number up by one make the file now > > my_pic_new2.jpg > > > > and so on. > > > > I am not asking for someone to write the code for me but point me to > > where I can gain viable info on how to make this hapeen or a small > > code example. > > > > Here is my code at present, > > > > > > Dim words1 as String = tmnescort_currentpic_small > > > > Dim location as Integer > > Dim Counter as Integer > > Dim newstr as Integer > > Dim newstring_withnum as Integer > > Dim countvar as Integer > > Dim newstring_withnum_tostr > > dim addnum as String > > > > Counter = 0 > > location = words1.IndexOf("_new") > > > > If location > 0 or not -1 then > > > > newstring_withnum_tostr = instr(1, words1, "1") > > > > > > newstr = System.Convert.ToInt16 > > (newstring_withnum_tostr + 1) > > newstring_withnum = newstr & Counter + 1 > > addnum = System.Convert.ToString(newstring_withnum) > > > > str_msg.Visible = True > > str_msg.Text = "This is the pic name in DB " & > > tmnescort_currentpic_small & "<br><br>new string was found<br><br>" & > > addnum & "<br><br>" > > > > else > > > > str_msg.Visible = True > > str_msg.Text = "This is the pic name in DB " & > > tmnescort_currentpic_small & "<br>new string was not found<br><br>" & > > addnum & "<br><br>" > > > > end if > > > > > > what I get back printed out is > > > > This is the pic name in DB my_pic_new1.jpg > > > > new string was found > > > > 161 << this is what happens after my string manipualtion I dont want > > this. > > > > Can any please help me? > > > > Thanks, > > > > Tony... > > > > > > > > > > > > > > Yahoo! Groups Links > > > > > > > > > > > > > > > > -- > > No virus found in this incoming message. > > Checked by AVG Anti-Virus. > > Version: 7.0.308 / Virus Database: 266.11.8 - Release Date: 5/10/2005 > > > > > > > > ------------------------------------------------------------------------------ > Yahoo! Groups Links > > a.. To visit your group on the web, go to: > http://groups.yahoo.com/group/AspNetAnyQuestionIsOk/ > > b.. To unsubscribe from this group, send an email to: > [EMAIL PROTECTED] > > c.. Your use of Yahoo! Groups is subject to the Yahoo! Terms of > Service. > > > > [Non-text portions of this message have been removed] > > > > > Yahoo! Groups Links > > > > > > > > -- > No virus found in this incoming message. > Checked by AVG Anti-Virus. > Version: 7.0.308 / Virus Database: 266.11.8 - Release Date: 5/10/2005 > > ------------------------------------------------------------------------------ Yahoo! Groups Links a.. To visit your group on the web, go to: http://groups.yahoo.com/group/AspNetAnyQuestionIsOk/ b.. To unsubscribe from this group, send an email to: [EMAIL PROTECTED] c.. Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service. [Non-text portions of this message have been removed] Yahoo! Groups Links <*> To visit your group on the web, go to: http://groups.yahoo.com/group/AspNetAnyQuestionIsOk/ <*> To unsubscribe from this group, send an email to: [EMAIL PROTECTED] <*> Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/
