Results 1 to 12 of 12

Thread: String manipulation and forms

Threaded View

  1. #1

    Thread Starter
    New Member
    Join Date
    Jun 2008
    Posts
    3

    String manipulation and forms

    O so I'm a Noob, and I hope someone has a simple answer for me. I Have a 5 Form project, and 4 of the 5 forms have textboxes that I need to store values in. I can Switch between forms and the code creates a new instance of the form each time it is brought back into focus. the ultimate goal is to have the text remain visible when switching back and forth between forms and at the end of the program copy all the text to the clipboard in the order that the text was entered with a newline character between textboxes.

    (Form 1)
    Code:
    Dim f2 As New UserForm2
    
    Dim Txt1Frm1 As String
    Dim Txt2Frm1 As String
    Dim Txt3Frm1 As String
    Dim Txt4Frm1 As String
    Dim Txt5Frm1 As String
    
    
    Private Sub CommandButton1_Click()
        f2.Show
        Me.Hide
    End Sub
    
    Public Sub T1F1_Change()
        Txt1Frm1 = T1F1.Text
    End Sub
    
    Private Sub T2F1_Change()
        Txt2Frm1 = T2F1.Text
    End Sub
    
    Private Sub T3F1_Change()
        Txt3Frm1 = T3F1.Text
    End Sub
    
    Private Sub T4F1_Change()
        Txt4Frm1 = T4F1.Text
    End Sub
    
    Private Sub T5F1_Change()
        Txt5Frm1 = T5F1.Text
    End Sub
    (Form 2)
    Code:
    Dim f3 As New UserForm3
    Dim f1 As New UserForm1
    
    Dim Txt1Frm2 As String
    Dim Txt2Frm2 As String
    Dim Txt3Frm2 As String
    
    Private Sub T1F2_Change()
    End Sub
    
    Private Sub T2F2_Change()
    End Sub
    
    Private Sub T3F2_Change()
    End Sub
    
    Private Sub CommandButton1_Click()
        Shell "C:\Program Files\Internet Explorer\iexplore.exe http://www.Somewhere.com", vbNormalFocus
    End Sub
    
    Private Sub CommandButton2_Click()
        f3.Show
        Me.Hide
    End Sub
    
    Public Sub CommandButton3_Click()
        f1.Show
        Me.Hide
    End Sub
    (Form 3)
    Code:
    Dim f2 As New UserForm2
    Dim f4 As New UserForm4
    
    Dim Txt1Frm3 As String
    Dim Txt2Frm3 As String
    Dim Txt3Frm3 As String
    Dim Txt4Frm3 As String
    Dim Txt5Frm3 As String
    
    Private Sub CommandButton1_Click()
        f4.Show
        Me.Hide
    End Sub
    
    Private Sub CommandButton2_Click()
        Shell "C:\Program Files\Internet Explorer\iexplore.exe http://www.Somewhere.com", vbNormalFocus
    End Sub
    
    Private Sub CommandButton3_Click()
        f2.Show
        Me.Hide
    End Sub
    
    
    Private Sub T1F3_Change()
    End Sub
    
    Private Sub T2F3_Change()
    End Sub
    
    Private Sub T3F3_Change()
    End Sub
    
    Private Sub T4F3_Change()
    End Sub
    
    Private Sub T5F3_Change()
    End Sub
    (Form 4)
    Code:
    Dim f3 As New UserForm3
    Dim f5 As New UserForm5
    
    Dim Txt1Frm4 As String
    
    Private Sub CommandButton1_Click()
        f5.Show
        Me.Hide
    End Sub
    
    Private Sub CommandButton2_Click()
        f3.Show
        Me.Hide
    End Sub
    
    Private Sub T1F4_Change()
    End Sub
    (Form 5)
    Code:
    Private Sub CommandButton1_Click()
        Clipboard.Clear  (This isn't working)
        Clipboard.SetText T1F1.Text & vbCrLf
        Clipboard.SetText T2F1.Text & vbCrLf
        Clipboard.SetText T3F1.Text & vbCrLf
        Clipboard.SetText T4F1.Text & vbCrLf
        Clipboard.SetText T5F1.Text & vbCrLf
        Clipboard.SetText T1F2.Text & vbCrLf
        Clipboard.SetText T2F2.Text & vbCrLf
        Clipboard.SetText T3F2.Text & vbCrLf
        Clipboard.SetText T1F3.Text & vbCrLf
        Clipboard.SetText T2F3.Text & vbCrLf
        Clipboard.SetText T3F3.Text & vbCrLf
        Clipboard.SetText T4F3.Text & vbCrLf
        Clipboard.SetText T5F3.Text & vbCrLf
        Clipboard.SetText T1F4.Text & vbCrLf
    End Sub
    
    Private Sub CommandButton2_Click()
        (Will Reset all textfields and load Form 1 Havn't figured this out yet)
    End Sub
    
    Private Sub CommandButton3_Click()
        f4.Show
        Me.Hide
    End Sub
    Last edited by si_the_geek; Jun 22nd, 2008 at 10:22 AM. Reason: added code 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