Results 1 to 12 of 12

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

  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

  2. #2
    Freelancer akhileshbc's Avatar
    Join Date
    Jun 2008
    Location
    Trivandrum, Kerala, India
    Posts
    7,652

    Re: Multiple Text Box Copy, Skip if Textbox if Not Populated

    Welcome to the forums

    VB2008 is released after VB6.. So, this isn't the correct section. It will be Visual Basic.Net...
    I will inform a mod to move this thread.
    Also, when posting code, enclose it in [ CODE ] [ /CODE ] tags... Which makes it easier to read...

    If my post was helpful to you, then express your gratitude using Rate this Post.
    And if your problem is SOLVED, then please Mark the Thread as RESOLVED (see it in action - video)
    My system: AMD FX 6100, Gigabyte Motherboard, 8 GB Crossair Vengance, Cooler Master 450W Thunder PSU, 1.4 TB HDD, 18.5" TFT(Wide), Antec V1 Cabinet

    Social Group: VBForums - Developers from India


    Skills: PHP, MySQL, jQuery, VB.Net, Photoshop, CodeIgniter, Bootstrap,...

  3. #3
    Super Moderator si_the_geek's Avatar
    Join Date
    Jul 2002
    Location
    Bristol, UK
    Posts
    41,974

    Re: Multiple Text Box Copy, Skip if Textbox if Not Populated

    Thread moved from 'VB6 and Earlier' forum to 'VB.Net' (VB2002 and later) forum

    (thanks for letting us know akhileshbc )

  4. #4

    Thread Starter
    New Member
    Join Date
    Jan 2010
    Posts
    6

    Re: Multiple Text Box Copy, Skip if Textbox if Not Populated

    Thank you, I will await a response.

  5. #5
    Karen Payne MVP kareninstructor's Avatar
    Join Date
    Jun 2008
    Location
    Oregon
    Posts
    6,713

    Re: Multiple Text Box Copy, Skip if Textbox if Not Populated

    Welcome to the forum.

    Might I suggest you reword the problem in a technical manner and explain what is the problem rather then a design issue and you will get faster responses. Also what version of Express are you using i.e. VS2010, VS2008?

  6. #6

    Thread Starter
    New Member
    Join Date
    Jan 2010
    Posts
    6

    Re: Multiple Text Box Copy, Skip if Textbox if Not Populated

    Yes, I'll try. BTW I have VB 2008 Express. So I a total of 7 different text boxes and a Copy to Clipboard at the bottom. I can't find the code to do this, but I just want to have the textbox be skipped if it's empty and copy all the others in formatting that I have setup. I would like to try and do it this way instead of trying to think of every different scenario the user would put in like putting in textbox4 and textbox 6 and leaving the rest blank.

  7. #7
    Karen Payne MVP kareninstructor's Avatar
    Join Date
    Jun 2008
    Location
    Oregon
    Posts
    6,713

    Re: Multiple Text Box Copy, Skip if Textbox if Not Populated

    Quote Originally Posted by w4itwh4t? View Post
    Yes, I'll try. BTW I have VB 2008 Express. So I a total of 7 different text boxes and a Copy to Clipboard at the bottom. I can't find the code to do this, but I just want to have the textbox be skipped if it's empty and copy all the others in formatting that I have setup. I would like to try and do it this way instead of trying to think of every different scenario the user would put in like putting in textbox4 and textbox 6 and leaving the rest blank.
    The following code shows how to get all TextBoxes where the parent conrol is the form, not something like a panel etc.

    Code:
    Public Class Form1
        Dim TextBoxList As New List(Of TextBox)
    
        Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
    
            Dim TextBoxes = From tbs In Me.Controls Where TypeOf (tbs) Is TextBox
            Dim EmptyBoxes = From tbs In TextBoxes.Cast(Of TextBox)() Where tbs.Text = ""
    
    
            Console.WriteLine("Number of textboxes {0}", TextBoxes.Count)
            Console.WriteLine("Empty textboxes {0}", EmptyBoxes.Count)
    
            For Each tb In EmptyBoxes
                TextBoxList.Add(CType(tb, TextBox))
            Next
    
            ' Later in another sub or function
    
            For Each tb In TextBoxList
                Console.WriteLine("TextBox [{0}] is empty", tb.Name)
            Next
    
            ' Manipulating them
            For Each tb In TextBoxList
                tb.Text = "Hello World"
            Next
    
        End Sub
    End Class

  8. #8

    Thread Starter
    New Member
    Join Date
    Jan 2010
    Posts
    6

    Re: Multiple Text Box Copy, Skip if Textbox if Not Populated

    I will check this out after work

  9. #9

    Thread Starter
    New Member
    Join Date
    Jan 2010
    Posts
    6

    Re: Multiple Text Box Copy, Skip if Textbox if Not Populated

    Hmm, well I'm a beginner in VB and I tried the code, but I guess I don't understand what you posted. The picture below is what the form looks like. Really all I'm trying to do now is simplify it.


    The output should look like this when the Copy all to Clipboard is pressed:

    CORP - Component - Issue goes here - HOSTNAME - USERNAME

    DETAILS:
    Details go here.

    TROUBLESHOOTING/ACTIONS:
    Troubleshooting goes here.
    Actions can also go here.


    Here is the code I currently have now:

    Code:
    Public Class Form1
        Private Sub Text1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles button1.Click
    
            Dim ComboBox
            Dim Textbox1
            Dim Textbox2
            Dim Textbox3
            Dim Textbox4
            Dim Textbox5
            Dim Textbox6
    
            ComboBox = ComboBox1.Text
            Textbox1 = Chr(32) & Chr(45) & Chr(32) & Text1.Text
            Textbox2 = Chr(32) & Chr(45) & Chr(32) & Text2.Text
            Textbox3 = Chr(32) & Chr(45) & Chr(32) & Text3.Text
            Textbox4 = Chr(32) & Chr(45) & Chr(32) & Text4.Text
            Textbox5 = vbCrLf & vbCrLf & "DETAILS:" & vbCrLf & Text5.Text
            Textbox6 = vbCrLf & vbCrLf & "TROUBLESHOOTING/ACTIONS:" & vbCrLf & Text6.Text
    
    
            My.Computer.Clipboard.SetText(ComboBox & Textbox1 & Textbox2 & Textbox3 & Textbox4 & Textbox5 & Textbox6)
    
            If ComboBox = "" Then
                My.Computer.Clipboard.SetText(Text1.Text & Textbox2 & Textbox3 & Textbox4 & Textbox5 & Textbox6)
            End If
    
    
            If Text1.Text = "" Then
                My.Computer.Clipboard.SetText(ComboBox & Textbox2 & Textbox3 & Textbox4 & Textbox5 & Textbox6)
            End If
    
            If Text2.Text = "" Then
                My.Computer.Clipboard.SetText(ComboBox & Textbox1 & Textbox3 & Textbox4 & Textbox5 & Textbox6)
            End If
    
            If Text3.Text = "" Then
                My.Computer.Clipboard.SetText(ComboBox & Textbox1 & Textbox2 & Textbox4 & Textbox5 & Textbox6)
            End If
    
            If Text4.Text = "" Then
                My.Computer.Clipboard.SetText(ComboBox & Textbox1 & Textbox2 & Textbox3 & Textbox5 & Textbox6)
            End If
    
            If Text5.Text = "" Then
                My.Computer.Clipboard.SetText(ComboBox & Textbox1 & Textbox2 & Textbox3 & Textbox4 & Textbox6)
            End If
    
            If Text6.Text = "" Then
                My.Computer.Clipboard.SetText(ComboBox & Textbox1 & Textbox2 & Textbox3 & Textbox4 & Textbox5)
            End If
    
    
    
    
    
    
            If Text1.Text & Text2.Text = "" Then
                My.Computer.Clipboard.SetText(ComboBox & Textbox3 & Textbox4 & Textbox5 & Textbox6)
            End If
    
            If Text1.Text & Text3.Text = "" Then
                My.Computer.Clipboard.SetText(ComboBox & Textbox2 & Textbox4 & Textbox5 & Textbox6)
            End If
    
            If Text1.Text & Text4.Text = "" Then
                My.Computer.Clipboard.SetText(ComboBox & Textbox2 & Textbox3 & Textbox5 & Textbox6)
            End If
    
            If Text1.Text & Text5.Text = "" Then
                My.Computer.Clipboard.SetText(ComboBox & Textbox2 & Textbox3 & Textbox4 & Textbox6)
            End If
    
            If Text1.Text & Text6.Text = "" Then
                My.Computer.Clipboard.SetText(ComboBox & Textbox2 & Textbox3 & Textbox4 & Textbox5)
            End If
    
    
            If Text2.Text & Text3.Text = "" Then
                My.Computer.Clipboard.SetText(ComboBox & Textbox1 & Textbox4 & Textbox5 & Textbox6)
            End If
    
            If Text2.Text & Text4.Text = "" Then
                My.Computer.Clipboard.SetText(ComboBox & Textbox1 & Textbox3 & Textbox5 & Textbox6)
            End If
    
            If Text2.Text & Text5.Text = "" Then
                My.Computer.Clipboard.SetText(ComboBox & Textbox1 & Textbox3 & Textbox4 & Textbox6)
            End If
    
            If Text2.Text & Text6.Text = "" Then
                My.Computer.Clipboard.SetText(ComboBox & Textbox1 & Textbox3 & Textbox4 & Textbox5)
            End If
    
    
            If Text3.Text & Text4.Text = "" Then
                My.Computer.Clipboard.SetText(ComboBox & Textbox1 & Textbox2 & Textbox5 & Textbox6)
            End If
    
            If Text3.Text & Text5.Text = "" Then
                My.Computer.Clipboard.SetText(ComboBox & Textbox1 & Textbox2 & Textbox4 & Textbox6)
            End If
    
            If Text3.Text & Text6.Text = "" Then
                My.Computer.Clipboard.SetText(ComboBox & Textbox1 & Textbox2 & Textbox4 & Textbox5)
            End If
    
    
            If Text4.Text & Text5.Text = "" Then
                My.Computer.Clipboard.SetText(ComboBox & Textbox1 & Textbox2 & Textbox3 & Textbox6)
            End If
    
            If Text4.Text & Text6.Text = "" Then
                My.Computer.Clipboard.SetText(ComboBox & Textbox1 & Textbox2 & Textbox3 & Textbox5)
            End If
    
    
            If Text5.Text & Text6.Text = "" Then
                My.Computer.Clipboard.SetText(ComboBox & Textbox1 & Textbox2 & Textbox3 & Textbox4)
            End If
    
    
            If Text1.Text & Text2.Text & Text3.Text = "" Then
                My.Computer.Clipboard.SetText(ComboBox & Textbox4 & Textbox5 & Textbox6)
            End If
    
            If Text1.Text & Text2.Text & Text3.Text & Text4.Text = "" Then
                My.Computer.Clipboard.SetText(ComboBox & Textbox5 & Textbox6)
            End If
    
            If Text1.Text & Text2.Text & Text3.Text & Text4.Text & Text5.Text = "" Then
                My.Computer.Clipboard.SetText(ComboBox & Textbox6)
            End If
    
            If Text1.Text & Text2.Text & Text3.Text & Text4.Text & Text5.Text & Text6.Text = "" Then
                My.Computer.Clipboard.SetText(ComboBox)
            End If
    
    
            If Text1.Text & Text5.Text & Text6.Text = "" Then
                My.Computer.Clipboard.SetText(ComboBox & Textbox2 & Textbox3 & Textbox4)
            End If
    
            If Text2.Text & Text5.Text & Text6.Text = "" Then
                My.Computer.Clipboard.SetText(ComboBox & Textbox1 & Textbox3 & Textbox4)
            End If
    
            If Text3.Text & Text5.Text & Text6.Text = "" Then
                My.Computer.Clipboard.SetText(ComboBox & Textbox1 & Textbox2 & Textbox4)
            End If
    
            If Text4.Text & Text5.Text & Text6.Text = "" Then
                My.Computer.Clipboard.SetText(ComboBox & Textbox1 & Textbox2 & Textbox3)
            End If
    
    
            If Text3.Text & Text4.Text & Text5.Text = "" Then
                My.Computer.Clipboard.SetText(ComboBox & Textbox1 & Textbox2 & Textbox6)
            End If
    
            If Text3.Text & Text4.Text & Text6.Text = "" Then
                My.Computer.Clipboard.SetText(ComboBox & Textbox1 & Textbox2 & Textbox5)
            End If
    
            If Text3.Text & Text4.Text & Text5.Text & Text6.Text = "" Then
                My.Computer.Clipboard.SetText(ComboBox & Textbox1 & Textbox2)
            End If
    
        End Sub
    
        Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click
            My.Computer.Clipboard.SetText(Text7.Text)
        End Sub
    
        Private Sub btnClear_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnClear.Click
            ComboBox1.ResetText()
    
            Text1.SelectAll()
            Text1.Copy()
            Text1.SelectAll()
            Text1.Cut()
    
            Text2.SelectAll()
            Text2.Copy()
            Text2.SelectAll()
            Text2.Cut()
    
            Text3.SelectAll()
            Text3.Copy()
            Text3.SelectAll()
            Text3.Cut()
    
            Text4.SelectAll()
            Text4.Copy()
            Text4.SelectAll()
            Text4.Cut()
    
            Text5.SelectAll()
            Text5.Copy()
            Text5.SelectAll()
            Text5.Cut()
    
            Text6.SelectAll()
            Text6.Copy()
            Text6.SelectAll()
            Text6.Cut()
    
            Text7.SelectAll()
            Text7.Copy()
            Text7.SelectAll()
            Text7.Cut()
            ComboBox1.Focus()
            ComboBox1.SelectedIndex = 0
    
        End Sub
    
        Private Sub Button6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button6.Click
            Text1.Undo()
            Text2.Undo()
            Text3.Undo()
            Text4.Undo()
            Text5.Undo()
            Text6.Undo()
            Text7.Undo()
        End Sub
    
    End Class
    Last edited by w4itwh4t?; Feb 24th, 2010 at 02:29 AM. Reason: Changing wording and removing [/HIGHLIGHT]

  10. #10
    Karen Payne MVP kareninstructor's Avatar
    Join Date
    Jun 2008
    Location
    Oregon
    Posts
    6,713

    Re: Multiple Text Box Copy, Skip if Textbox if Not Populated

    Quote Originally Posted by w4itwh4t? View Post
    Hmm, well I'm a beginner in VB and I tried the code, but I guess I don't understand what you posted.
    As a novice developer you really need to begin reading MSDN documentation so that you do understand the basics so that you can comprehend code provided to you. The code below is very basic LINQ which gives you all empty textboxes to use in your code for logic of empty textboxes as asked in post 6 and the initial question.

    Code:
    Dim EmptyBoxes = From tbs In TextBoxes.Cast(Of TextBox)() Where tbs.Text = ""
    For Each tb In EmptyBoxes
         TextBoxList.Add(CType(tb, TextBox))
     Next

  11. #11

    Thread Starter
    New Member
    Join Date
    Jan 2010
    Posts
    6

    Re: Multiple Text Box Copy, Skip if Textbox if Not Populated

    Thank you I will try it out, any tips on cleaning up the code or is what you posted how I would clean it up?

  12. #12
    Karen Payne MVP kareninstructor's Avatar
    Join Date
    Jun 2008
    Location
    Oregon
    Posts
    6,713

    Re: Multiple Text Box Copy, Skip if Textbox if Not Populated

    Quote Originally Posted by w4itwh4t? View Post
    Thank you I will try it out, any tips on cleaning up the code or is what you posted how I would clean it up?
    Take a look at the attached project for some ideas/suggestions.
    Last edited by kareninstructor; Nov 21st, 2011 at 10:15 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