Results 1 to 2 of 2

Thread: simple code modification needed [Resolved]

Threaded View

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Dec 2003
    Posts
    127

    simple code modification needed [Resolved]

    I have the following code below for a small project I am working on and I need help to modify it. As it is; the code will produce an output that looks like this:

    Who:
    When:
    Why:

    I would like to have it use something like an if / then statement that would produce the output for the textbox only if there is something typed in the textbox and would skip over it if nothing was typed in the textbox. For example if only Who and Why had something typed in them. The output would look like this.

    Who: Joe Woods
    Why: Called in sick


    *********My existing code*********

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
    Label1.Text = "WHO"
    Label2.Text = "WHEN"
    Label3.Text = "WHY"
    TextBox1.Text = ""
    TextBox2.Text = ""
    TextBox3.Text = ""
    TextBox4.Text = ""
    TextBox4.Multiline = True
    Button1.Text = "GO"
    End Sub

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

    Dim strOutput As String

    strOutput = "Who:" & vbTab & TextBox1.Text & vbCrLf
    strOutput &= "When:" & vbTab & TextBox2.Text & vbCrLf
    strOutput &= "Why:" & vbTab & TextBox3.Text & vbCrLf
    strOutput &= "Test:" & vbTab & ComboBox1.Text & vbCrLf
    TextBox4.Text = strOutput

    End Sub


    ********************************


    I was also wondering if it would be possible to have another button in the form that would somehow place the text from TextBox4 with it's orignal formatting to whatever other program the windows curser is in. ( like passing the text from this program to another program like Notepad ) If this isn't possible would I be able to copy the text from TextBox4 to the Windows Clipboard so I can then paste it into another program using Ctrl-V ( the standard paste method in Windows with the keyboard. )

    Any help on this would be more than greatly appreciated.

    Thanks
    Last edited by teamdad; Jun 13th, 2004 at 08:13 PM.

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