Results 1 to 12 of 12

Thread: [RESOLVED] Multiple Text Box Copy, Skip if Textbox if Not Populated

Threaded View

  1. #1

    Thread Starter
    New Member
    Join Date
    Jan 2010
    Posts
    6

    Resolved [RESOLVED] Multiple Text Box Copy, Skip if Textbox if Not Populated

    Hey there,

    I am running Visual Basic Express 2008. I realize this forum category is for VB6 or earlier, so please kindly inform me of where to post this if this is incorrect.

    This is actually the first forum I have joined ever because I can't figure it out on my own and can't find the code off the website.

    So here's the deal. I am almost done, i I have a ComboBox and 4 text boxes. At the bottom it has CLEAR, UNDO CLEAR, COPY ALL TO CLIPBOARD & COPY SOLUTION which does so for the ComboBox and all 4 text boxes. The format like this (CORP is the ComboBox):

    CORP - Workstation - Won't power on - HOSTNAME/USERNAME

    PROBLEM/REQUEST:
    started happening today

    TROUBLESHOOTING/ACTIONS:
    reseated cables
    pings as offline

    And then due to the ticket entry system we use, I have a separate COPY SOLUTION button and that works just fine, but that would read as:

    Dispatching tech

    Now here's where I'm caught up on, I need to take a textbox where I don't use it because I don't have a use for it dependent on the issue of the person I'm working with and it'll look like this:

    CORP - Windows - Password Reset - USERNAME

    But, this is where I'm getting stuck, it keeps putting stuff like:

    CORP - Windows - Password Reset - /USERNAME
    or
    - Windows - Password Reset - /USERNAME

    it's doing weird stuff like that all over the place. I really appreciate any help.

    Here's the code:
    vb.net Code:
    1. Public Class Form1
    2.     Private Sub Text1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles button1.Click
    3.  
    4.  
    5.  
    6.         My.Computer.Clipboard.SetText(ComboBox1.Text & Chr(32) & Chr(45) & Chr(32) & _
    7.                                       Text1.Text & Chr(32) & Chr(45) & Chr(32) & _
    8.                                       Text2.Text & Chr(32) & Chr(45) & Chr(32) & _
    9.                                       Text3.Text & Chr(92) & _
    10.                                       Text4.Text & vbCrLf & vbCrLf & "PROBLEM/REQUEST:" & vbCrLf & _
    11.                                       Text5.Text & vbCrLf & vbCrLf & "TROUBLESHOOTING/ACTIONS:" & vbCrLf & _
    12.                                       Text6.Text)
    13.  
    14.         If ComboBox1.Text = "" Then
    15.             My.Computer.Clipboard.SetText(Text1.Text & Chr(32) & Chr(45) & Chr(32) & _
    16.                                           Text2.Text & Chr(32) & Chr(45) & Chr(32) & _
    17.                                           Text3.Text & Chr(92) & _
    18.                                           Text4.Text & vbCrLf & vbCrLf & "PROBLEM/REQUEST:" & vbCrLf & _
    19.                                           Text5.Text & vbCrLf & vbCrLf & "TROUBLESHOOTING/ACTIONS:" & vbCrLf & _
    20.                                           Text6.Text)
    21.         End If
    22.  
    23.  
    24.         If Me.Text1.Text = "" Then
    25.             My.Computer.Clipboard.SetText(ComboBox1.Text & Chr(32) & Chr(45) & Chr(32) & _
    26.                                       Text2.Text & Chr(32) & Chr(45) & Chr(32) & _
    27.                                       Text3.Text & Chr(92) & _
    28.                                       Text4.Text & vbCrLf & vbCrLf & "PROBLEM/REQUEST:" & vbCrLf & _
    29.                                       Text5.Text & vbCrLf & vbCrLf & "TROUBLESHOOTING/ACTIONS:" & vbCrLf & _
    30.                                       Text6.Text)
    31.         End If
    32.  
    33.         If Me.Text2.Text = "" Then
    34.             My.Computer.Clipboard.SetText(ComboBox1.Text & Chr(32) & Chr(45) & Chr(32) & _
    35.                                       Text1.Text & Chr(32) & Chr(45) & Chr(32) & _
    36.                                       Text3.Text & Chr(92) & _
    37.                                       Text4.Text & vbCrLf & vbCrLf & "PROBLEM/REQUEST:" & vbCrLf & _
    38.                                       Text5.Text & vbCrLf & vbCrLf & "TROUBLESHOOTING/ACTIONS:" & vbCrLf & _
    39.                                       Text6.Text)
    40.         End If
    41.  
    42.         If Me.Text3.Text = "" Then
    43.             My.Computer.Clipboard.SetText(ComboBox1.Text & Chr(32) & Chr(45) & Chr(32) & _
    44.                                       Text1.Text & Chr(32) & Chr(45) & Chr(32) & _
    45.                                       Text2.Text & Chr(32) & Chr(45) & Chr(32) & _
    46.                                       Text4.Text & vbCrLf & vbCrLf & "PROBLEM/REQUEST:" & vbCrLf & _
    47.                                       Text5.Text & vbCrLf & vbCrLf & "TROUBLESHOOTING/ACTIONS:" & vbCrLf & _
    48.                                       Text6.Text)
    49.         End If
    50.  
    51.         If Me.Text4.Text = "" Then
    52.             My.Computer.Clipboard.SetText(ComboBox1.Text & Chr(32) & Chr(45) & Chr(32) & _
    53.                                       Text1.Text & Chr(32) & Chr(45) & Chr(32) & _
    54.                                       Text2.Text & Chr(32) & Chr(45) & Chr(32) & _
    55.                                       Text3.Text & vbCrLf & vbCrLf & "PROBLEM/REQUEST:" & vbCrLf & _
    56.                                       Text5.Text & vbCrLf & vbCrLf & "TROUBLESHOOTING/ACTIONS:" & vbCrLf & _
    57.                                       Text6.Text)
    58.         End If
    59.  
    60.         If Me.Text5.Text = "" Then
    61.             My.Computer.Clipboard.SetText(ComboBox1.Text & Chr(32) & Chr(45) & Chr(32) & _
    62.                                       Text2.Text & Chr(32) & Chr(45) & Chr(32) & _
    63.                                       Text3.Text & Chr(92) & _
    64.                                       Text4.Text & vbCrLf & vbCrLf & "PROBLEM/REQUEST:" & vbCrLf & _
    65.                                       Text6.Text)
    66.         End If
    67.  
    68.         If Me.Text6.Text = "" Then
    69.             My.Computer.Clipboard.SetText(ComboBox1.Text & Chr(32) & Chr(45) & Chr(32) & _
    70.                                       Text1.Text & Chr(32) & Chr(45) & Chr(32) & _
    71.                                       Text2.Text & Chr(32) & Chr(45) & Chr(32) & _
    72.                                       Text3.Text & Chr(92) & _
    73.                                       Text4.Text & vbCrLf & vbCrLf & "PROBLEM/REQUEST:" & vbCrLf & _
    74.                                       Text5.Text)
    75.         End If
    76.  
    77.         If (Me.Text5.Text & Me.Text6.Text) = "" Then
    78.             My.Computer.Clipboard.SetText(ComboBox1.Text & Chr(32) & Chr(45) & Chr(32) & _
    79.                                       Text1.Text & Chr(32) & Chr(45) & Chr(32) & _
    80.                                       Text2.Text & Chr(32) & Chr(45) & Chr(32) & _
    81.                                       Text3.Text & Chr(92) & _
    82.                                       Text4.Text)
    83.  
    84.         End If
    85.  
    86.         If (Me.Text3.Text & Me.Text4.Text & Me.Text5.Text & Text6.Text) = "" Then
    87.             My.Computer.Clipboard.SetText(ComboBox1.Text & Chr(32) & Chr(45) & Chr(32) & _
    88.                                       Text1.Text & Chr(32) & Chr(45) & Chr(32) & _
    89.                                       Text2.Text)
    90.         End If
    91.  
    92.         If (Me.Text4.Text & Me.Text5.Text & Me.Text6.Text) = "" Then
    93.             My.Computer.Clipboard.SetText(ComboBox1.Text & Chr(32) & Chr(45) & Chr(32) & _
    94.                                       Text1.Text & Chr(32) & Chr(45) & Chr(32) & _
    95.                                       Text2.Text & Chr(32) & Chr(45) & Chr(32) & _
    96.                                       Text3.Text)
    97.         End If
    98.  
    99.         If (Me.Text3.Text & Me.Text5.Text & Me.Text6.Text) = "" Then
    100.             My.Computer.Clipboard.SetText(ComboBox1.Text & Chr(32) & Chr(45) & Chr(32) & _
    101.                                       Text1.Text & Chr(32) & Chr(45) & Chr(32) & _
    102.                                       Text2.Text & Chr(32) & Chr(45) & Chr(32) & _
    103.                                       Text4.Text)
    104.         End If
    105.  
    106.     End Sub
    107.  
    108.     Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click
    109.         My.Computer.Clipboard.SetText(Text7.Text)
    110.     End Sub
    111.  
    112.     Private Sub btnClear_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnClear.Click
    113.         ComboBox1.ResetText()
    114.  
    115.         Text1.SelectAll()
    116.         Text1.Copy()
    117.         Text1.SelectAll()
    118.         Text1.Cut()
    119.  
    120.         Text2.SelectAll()
    121.         Text2.Copy()
    122.         Text2.SelectAll()
    123.         Text2.Cut()
    124.  
    125.         Text3.SelectAll()
    126.         Text3.Copy()
    127.         Text3.SelectAll()
    128.         Text3.Cut()
    129.  
    130.         Text4.SelectAll()
    131.         Text4.Copy()
    132.         Text4.SelectAll()
    133.         Text4.Cut()
    134.  
    135.         Text5.SelectAll()
    136.         Text5.Copy()
    137.         Text5.SelectAll()
    138.         Text5.Cut()
    139.  
    140.         Text6.SelectAll()
    141.         Text6.Copy()
    142.         Text6.SelectAll()
    143.         Text6.Cut()
    144.  
    145.         Text7.SelectAll()
    146.         Text7.Copy()
    147.         Text7.SelectAll()
    148.         Text7.Cut()
    149.         ComboBox1.Focus()
    150.     End Sub
    151.  
    152.     Private Sub Button6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button6.Click
    153.         Text1.Undo()
    154.         Text2.Undo()
    155.         Text3.Undo()
    156.         Text4.Undo()
    157.         Text5.Undo()
    158.         Text6.Undo()
    159.         Text7.Undo()
    160.     End Sub
    161.  
    162. End Class
    Last edited by Hack; Feb 4th, 2010 at 07:07 AM. Reason: Added Highlight Tags

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