Results 1 to 10 of 10

Thread: Question about the code..

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Dec 2002
    Posts
    109

    Question about the code..

    I can now place text into text box2 however if I want to copy more than 1 word like a paragraph.. so command1

    text1.text = " hello" works but what if I want to diplay a paragraph?

  2. #2
    Lively Member
    Join Date
    Sep 1999
    Location
    Guayaquil, Guayas, Ecuador
    Posts
    87
    use MultiLine = true in textbox properties

  3. #3
    Frenzied Member
    Join Date
    Jun 2000
    Location
    East Providence, RI
    Posts
    1,715
    after you set the multiline to true, you could do something like this:

    text1.text = "Hello World this is my first line" & vbnewline & "Hello world this is my second line"

    and so on


    -Dimava
    NXSupport - Your one-stop source for computer help

  4. #4

    Thread Starter
    Lively Member
    Join Date
    Dec 2002
    Posts
    109

    Talking Thanks !! one more question.

    Thank you for the help ok that worked but I have yet another question.. I have a text box ( let's say I put in a name like "Nelson") in that text box, and once my command button is pressed (that sends a sentence over yet to another text box) I would like it to place nelson into a certain part of that paragraph.

    so someone enters a word into textbox 1 I would like that word placed in textbox 2 in the middle of a sentence. or end ect.. thank you.

  5. #5
    Lively Member
    Join Date
    Nov 2002
    Location
    Michigan
    Posts
    107
    Well, you'd have to decide where in the text in textbox2 you want it, first. The beginning or end are trivial:
    VB Code:
    1. textbox2 = textbox1 & " " & textbox2   'beginning
    2. textbox2 = textbox2 & " " & textbox1   'end
    I'm not sure of the function to insert in the middle of a string; you could use Replace() and hack it a bit, but there's probably a better way.

  6. #6
    Fanatic Member scr0p's Avatar
    Join Date
    Oct 2002
    Location
    VA
    Posts
    720
    An easy way to do that is to use variables. In code you can do something like this

    VB Code:
    1. Option Explicit
    2. Private Sub Command1_Click()
    3.     Text2.Text = "Hello " & Text1.Text & ", How are you?"
    4. End Sub
    asdf

  7. #7
    Lively Member
    Join Date
    Nov 2002
    Location
    Michigan
    Posts
    107
    Yes, but what if you have existing text in text2 and want to insert into that? I couldn't find an Insert() function in VB, although other languages have one.

  8. #8

    Thread Starter
    Lively Member
    Join Date
    Dec 2002
    Posts
    109

    Question I.E within VB

    quick question I want to disply a webpage within my VB do I use a label?

    for example I want it to display withing a box..

    so www.lycos.com (entered in textbox1)
    and would like it to
    display withing another text box or label on the form?

  9. #9
    Frenzied Member
    Join Date
    Jun 2000
    Location
    East Providence, RI
    Posts
    1,715
    Right click your tool box, goto components
    scroll down and put a check next to Microsoft Internet Controls

    and then you would use something like webbrowser1.navigate text1.text
    NXSupport - Your one-stop source for computer help

  10. #10
    Lively Member
    Join Date
    Sep 1999
    Location
    Guayaquil, Guayas, Ecuador
    Posts
    87
    To insert text from a textbox to another you can do something like this:

    VB Code:
    1. Private Sub Form_Load()
    2. Text1.Text = "Name"
    3. Text2.Text = "Hello how are you"
    4. End Sub
    5.  
    6. Private Sub Command1_Click()
    7. Text2.Text = Left(Text2.Text, 5) & " " & Text1.Text & " " & Mid(Text2.Text, 7)
    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