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&nbsp;" & 
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

<*> 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/
 


Reply via email to