4 Replies - 271 Views - Last Post: 29 January 2013 - 09:29 PM Rate Topic: -----

#1 Rjjvv  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 12
  • Joined: 29-January 13

Problem vs2012 textbox char edit

Posted 29 January 2013 - 11:26 AM

Hi, what I want to do is to edit every char in a txtbox for ex: txtbox1.text = "Rudi"

Now it must take the text length and count each step, when the char (thats being checked atm = R) then textbox2.text = textbox2.text + "1R1"

then it must go to the next char and "u" must = "1u1" and should be added to textbox 2

So when T1 = "Rudi is my name" then T2 should be = "1R11u11d11i1 1i11s1 1m11y1 1n11a11m11e1"

The point of this is so that i can use a secret code..and set each letter to a value..ex R = 1614641

I DON"T want the bit like 10101101

Please and thanks

Is This A Good Question/Topic? 0
  • +

Replies To: Problem vs2012 textbox char edit

#2 andrewsw  Icon User is online

  • Fire giant boob nipple gun!
  • member icon

Reputation: 3526
  • View blog
  • Posts: 12,036
  • Joined: 12-December 12

Re: Problem vs2012 textbox char edit

Posted 29 January 2013 - 12:00 PM

NB THIS ISN'T VB6

Dim strClip As String = "Rudi is my name"
strClip = Regex.Replace(strClip, "(\w)", "\1$1\1")
Console.WriteLine(strClip)

Output:

Quote

'\1R\1\1u\1\1d\1\1i\1 \1i\1\1s\1 \1m\1\1y\1 \1n\1\1a\1\1m\1\1e\1


Oops
, I need to get rid of the slashes - give me a mo!
Added: here
strClip = Regex.Replace(strClip, "(\w)", "1${1}1")

This post has been edited by andrewsw: 29 January 2013 - 12:05 PM

Was This Post Helpful? 0
  • +
  • -

#3 maj3091  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 300
  • View blog
  • Posts: 1,780
  • Joined: 26-March 09

Re: Problem vs2012 textbox char edit

Posted 29 January 2013 - 12:01 PM

What have you tried already?

in VB6 you would use the LEN function for the length of the string.

You would use the MID$ function to each individual character.

You would use a loop to work around the full string.

And there you go, Andrew beat me to it. :)
Was This Post Helpful? 0
  • +
  • -

#4 Rjjvv  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 12
  • Joined: 29-January 13

Re: Problem vs2012 textbox char edit

Posted 29 January 2013 - 09:22 PM

i have VS 2012 .. will go and try to see if code works
Was This Post Helpful? 0
  • +
  • -

#5 Rjjvv  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 12
  • Joined: 29-January 13

Re: Problem vs2012 textbox char edit

Posted 29 January 2013 - 09:29 PM

Nice, it works, but please help me to understand -> what is /w for? and can i give ex: R or u an individual value ex: R = 13 and u = 55
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1