Results 1 to 5 of 5

Thread: I need some help

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Jul 2008
    Posts
    84

    I need some help

    ok i am trying to do something pretty simple.

    I have a text file loading into a text box which looks like this:

    Code:
    define = _obfuscate_CSBmAn9z
    defined = _obfuscate_XGkLCg47bQÿÿ
    str_replace = _obfuscate_aAFqNWoGfQ87Pjg
    error_reporting = _obfuscate_bShjLzcWFHZ5H2ZgAQ08
    header = _obfuscate_d1x0cApj
    substr = _obfuscate_c2ssCnw1
    
    etc...
    Then I have an array splitting it at the "=" so the output looks like this

    Code:
    define 
     _obfuscate_CSBmAn9z
    defined 
     _obfuscate_XGkLCg47bQ��
    str_replace 
     _obfuscate_aAFqNWoGfQ87Pjg
    error_reporting 
     _obfuscate_bShjLzcWFHZ5H2ZgAQ08
    header 
     _obfuscate_d1x0cApj
    substr 
     _obfuscate_c2ssCnw1
    
    etc...
    what i would like to do is make a line of code generator.

    I need it to generate this line of code
    Code:
    me.textbox2.text = replace("define"," _obfuscate_CSBmAn9z")
    but i need it to generate for each set. i already have it in an array and when i try it, it comes out like

    Code:
    Me.TextBox2.Text = Replace("","define "
    Me.TextBox2.Text = Replace(""," _obfuscate_CSBmAn9z
    defined "
    Me.TextBox2.Text = Replace(""," _obfuscate_XGkLCg47bQ��
    str_replace "
    Me.TextBox2.Text = Replace(""," _obfuscate_aAFqNWoGfQ87Pjg
    error_reporting "
    Me.TextBox2.Text = Replace(""," _obfuscate_bShjLzcWFHZ5H2ZgAQ08
    header "
    Me.TextBox2.Text = Replace(""," _obfuscate_d1x0cApj
    substr "
    
    etc...
    the problem is that the first entry is going to the end of the line and not in between the first set of quotation marks

  2. #2
    eXtreme Programmer .paul.'s Avatar
    Join Date
    May 2007
    Location
    Chelmsford UK
    Posts
    25,464

    Re: I need some help

    i don't understand the question. what should the correct output look like?

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Jul 2008
    Posts
    84

    Re: I need some help

    ok i have made some porgress this is my problem now.

    i have a lot of lines of code that look like this

    Code:
     
    dim txt as tring
    txt - me.textbox2.text
    
    If InStr(1, Me.TextBox2.Text, "_obfuscate_CSBmAn9z") > 0 Then Me.TextBox2.Text = Replace(txt, "_obfuscate_CSBmAn9z", "define")
    the problem is that it is not replacing the "_obfuscate_CSBmAn9z" with "define"

  4. #4
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    110,299

    Re: I need some help

    There's no point call InStr because Replace will have to locate the substring anyway. Just do this:
    vb.net Code:
    1. Dim str As String = Me.TextBox2.Text
    2.  
    3. str = str.Replace("old substring", "new substring")
    4. '...
    5.  
    6. Me.TextBox2.Text = str

  5. #5

    Thread Starter
    Lively Member
    Join Date
    Jul 2008
    Posts
    84

    Re: I need some help

    this can be closed i got it working

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width