如何复制多个文本框文本并将该文本粘贴到其他文本框中?

How to copy multiple textboxes text and paste that text into other textboxes?

我有一些文本框 (9),我想从这些文本框复制数据,所以当我在我的访问数据库上按保存时,我可以按过去,让我以前的数据出现在新的网格线上。

这可能吗?

这是我目前的情况

复制按钮 -

Private Sub Button7_Click(sender As Object, e As EventArgs) Handles Button7.Click
    If SİPARİŞ_MUMARASITextBox.TextLength = 0 Then
        MsgBox("yok")
    Else
        Clipboard.SetText(İSİMTextBox.Text & TARİHTextBox.Text & SİPARİŞ_MUMARASITextBox.Text _
          & SİPARİŞİN_ADI__BASKIDAKİ_BİLGİ_TextBox.Text & SİPARİŞİN_ADI__BASKIDAKİ_BİLGİ_TextBox.Text _
          & SAYACIN_BULUNDUĞU_KAZANTextBox.Text & KUMAŞ_RENGİTextBox.Text)
    End If
End Sub

粘贴按钮 -

Private Sub Button8_Click(sender As Object, e As EventArgs) Handles Button8.Click
    If Clipboard.ContainsText = True Then
        İSİMTextBox.Text = Clipboard.GetText
        TARİHTextBox.Text = Clipboard.GetText
        SİPARİŞ_MUMARASITextBox.Text = Clipboard.GetText
        SİPARİŞİN_ADI__BASKIDAKİ_BİLGİ_TextBox.Text = Clipboard.GetText
        BOBİN_GRAMJI__gr_m2_TextBox.Text = Clipboard.GetText
        BOBİN_ÜZERİNDE_YAZAN_METRAJ__cmXmt_TextBox.Text = Clipboard.GetText
        BASKIDAKİ_TUR_SAYISITextBox.Text = Clipboard.GetText
        SAYACIN_BULUNDUĞU_KAZANTextBox.Text = Clipboard.GetText
        KUMAŞ_RENGİTextBox.Text = Clipboard.GetText
    Else
        İSİMTextBox.Clear()
        TARİHTextBox.Clear()
        SİPARİŞ_MUMARASITextBox.Clear()
        SİPARİŞİN_ADI__BASKIDAKİ_BİLGİ_TextBox.Clear()
        BOBİN_GRAMJI__gr_m2_TextBox.Clear()
        BOBİN_ÜZERİNDE_YAZAN_METRAJ__cmXmt_TextBox.Clear()
        BASKIDAKİ_TUR_SAYISITextBox.Clear()
        BASKIDAKİ_TUR_SAYISITextBox.Clear()
        SAYACIN_BULUNDUĞU_KAZANTextBox.Clear()
        KUMAŞ_RENGİTextBox.Clear()
    End If
End Sub

使用剪贴板很可能是错误的做法。相反,你可以有一个 Class,其中包含你想要记住的每个项目的属性:

Option Infer On
' ...

Dim thingsToCopy As CopyBuffer

Public Class CopyBuffer
    Property İSİM As String = ""
    Property TARİH As String = ""
    Property SİPARİŞ_MUMARASI As String = ""
    Property SİPARİŞİN_ADI__BASKIDAKİ_BİLGİ As String = ""
    Property BOBİN_GRAMJI__gr_m2 As String = ""
    Property BOBİN_ÜZERİNDE_YAZAN_METRAJ__cmXmt As String = ""
    Property BASKIDAKİ_TUR_SAYISI As String = ""
    Property SAYACIN_BULUNDUĞU_KAZAN As String = ""
    Property KUMAŞ_RENGİ As String = ""
End Class

Private Sub bnCopy_Click(sender As Object, e As EventArgs) Handles bnCopy.Click
    If SİPARİŞ_MUMARASITextBox.TextLength = 0 Then
        MsgBox("yok")
    Else
        thingsToCopy = New CopyBuffer With
                       {.İSİM = İSİMTextBox.Text,
                        .TARİH = TARİHTextBox.Text,
                        .SİPARİŞ_MUMARASI = SİPARİŞ_MUMARASITextBox.Text,
                        .SAYACIN_BULUNDUĞU_KAZAN = SAYACIN_BULUNDUĞU_KAZANTextBox.Text,
                        .KUMAŞ_RENGİ = KUMAŞ_RENGİTextBox.Text}

    End If

End Sub

Private Sub bnPaste_Click(sender As Object, e As EventArgs) Handles bnPaste.Click
    If thingsToCopy Is Nothing Then
        ' create a new one, which will have empty text
        thingsToCopy = New CopyBuffer
    End If

    With thingsToCopy
        İSİMTextBox.Text = .İSİM
        TARİHTextBox.Text = .TARİH
        SİPARİŞ_MUMARASITextBox.Text = .SİPARİŞ_MUMARASI
        SAYACIN_BULUNDUĞU_KAZANTextBox.Text = .SAYACIN_BULUNDUĞU_KAZAN
        KUMAŞ_RENGİTextBox.Text = .KUMAŞ_RENGİ
    End With

End Sub

您粘贴的内容似乎比复制的要多;您将必须调整代码以满足要求。