Results 1 to 6 of 6

Thread: Help help help!!!

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Sep 2011
    Posts
    66

    Help help help!!!

    I want to know how to put (-) AFTER the word LOVE AND before Any word in the textbox by a click of Button. (
    if my textbox1.text has: LOVEMOM then when i click the "Button" it shows "LOVE-MOM"
    if LOVEDAD then = "LOVE-DAD" and soo on.
    Thank you very much for helping.

  2. #2
    Addicted Member
    Join Date
    Nov 2010
    Location
    TamilNadu, India
    Posts
    249

    Re: Help help help!!!

    Try this
    vb Code:
    1. Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
    2.         Dim _strfull$ = TextBox1.Text.ToString
    3.         Dim _Love$ = _strfull.Substring(0, 4)
    4.         Dim _conct$ = String.Concat(_Love, "-", _strfull$.Substring(4, Len(_strfull) - 4))
    5.         TextBox1.Text = _conct$
    6.     End Sub

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Sep 2011
    Posts
    66

    Re: Help help help!!!

    Another question is that if i type in the Textbox "ILOVEYOUMOM" and i want to remove the first 8 letter by 1 click of button, how do i do it
    thanks so much

  4. #4
    Addicted Member
    Join Date
    Nov 2010
    Location
    TamilNadu, India
    Posts
    249

    Re: Help help help!!!

    ooh please using SubString method like this..
    vb Code:
    1. Dim _strng$ = "ILOVEYOUMOM"
    2.         MsgBox(_strng.Substring(8, Len(_strng) - 8))

  5. #5

    Thread Starter
    Lively Member
    Join Date
    Sep 2011
    Posts
    66

    Re: Help help help!!!

    I meant like if i copy "ILOVEYOUMOM" and paste to the textbox1 and click button1 then the textbox1.text should be "MOM" only cuz its -8 letters.
    can u show me the full method cuz i'm newbie
    thanks for your advance

  6. #6
    Addicted Member
    Join Date
    Nov 2010
    Location
    TamilNadu, India
    Posts
    249

    Re: Help help help!!!

    vb Code:
    1. Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
    2.         Dim _strng$ = TextBox1.Text
    3.         If Trim(_strng) <> String.Empty Then
    4.             If Len(_strng) >= 8 Then
    5.                 TextBox1.Text = _strng.Substring(8, Len(_strng) - 8)
    6.             End If
    7.         End If
    8.     End Sub

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