Du bist echt der Hammer,
aber: mit strg+b kann ich den Inhalt aus C nicht einfügen.
Anbei der gesamte Code von Dir, angepasst auf meine Form
Public Class Form1
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As _
System.EventArgs) Handles MyBase.Load
Call FillComboBox()
WebBrowser2.Dock = DockStyle.Fill
WebBrowser2.Navigate("www.google.de")
End Sub
Private Sub FillComboBox()
'ComboBox2.Items.Add(New ComboBoxItem("test", "kopierter Text"))
Dim Excel1 As New Excel.Application
Excel1.Workbooks.Open("C:\Datenbank.xls")
Excel1.Visible = False
For i As Integer = 1 To 40
ComboBox2.Items.Add(New ComboBoxItem(Excel1.Range("A" + _
i.ToString).Text, Excel1.Range("B" + i.ToString).Text, _
Excel1.Range("C" + i.ToString).Text))
Next
Excel1.ActiveWorkbook.Close()
Excel1.Workbooks.Close()
Excel1.Visible = False
End Sub
Private Sub ComboBox2_SelectedIndexChanged(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles ComboBox2.SelectedIndexChanged
If ComboBox2.SelectedItem IsNot Nothing Then
Dim item As ComboBoxItem = CType(ComboBox2.SelectedItem, _
ComboBoxItem)
If item.FeldB <> String.Empty Then My.Computer.Clipboard.SetText( _
item.FeldB)
End If
WebBrowser2.Navigate(ComboBox2.Text)
WebBrowser2.Focus()
End Sub
Private Sub ComboBox2_KeyPress(ByVal sender As Object, ByVal e As _
System.Windows.Forms.KeyPressEventArgs) Handles ComboBox2.KeyPress
If Asc(e.KeyChar) = 13 Then
e.Handled = True
WebBrowser2.Navigate(ComboBox2.Text)
End If
'Private Sub ComboBox2_SelectedIndexChanged(ByVal sender As
' System.Object, ByVal e As System.EventArgs) Handles
' ComboBox2.SelectedIndexChanged
'WebBrowser2.Navigate(ComboBox2.Text)
End Sub
Private Sub ComboBox2_KeyDown(ByVal sender As System.Object, ByVal e As _
System.Windows.Forms.KeyEventArgs) Handles ComboBox2.KeyDown
e.SuppressKeyPress = True
e.Handled = True
If e.Control And e.KeyCode = Keys.V Then
If ComboBox2.SelectedItem IsNot Nothing Then
Dim item As ComboBoxItem = CType(ComboBox2.SelectedItem, _
ComboBoxItem)
If item.FeldB <> String.Empty Then _
My.Computer.Clipboard.SetText( _
item.FeldB)
End If
ElseIf e.Control And e.KeyCode = Keys.B Then
If ComboBox2.SelectedItem IsNot Nothing Then
Dim item As ComboBoxItem = CType(ComboBox2.SelectedItem, _
ComboBoxItem)
If item.FeldB <> String.Empty Then _
My.Computer.Clipboard.SetText( _
item.FeldC)
End If
End If
End Sub
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As _
System.EventArgs) Handles Button3.Click
Me.Close()
End Sub
End Class
Public Class ComboBoxItem
Public Sub New(ByVal feldA As String, ByVal feldB As String, ByVal feldC As _
String)
pFeldA = feldA
pFeldB = feldB
pFeldC = feldC
End Sub
Private pFeldA As String
Public Property FeldA() As String
Get
Return pFeldA
End Get
Set(ByVal value As String)
pFeldA = value
End Set
End Property
Private pFeldB As String
Public Property FeldB() As String
Get
Return pFeldB
End Get
Set(ByVal value As String)
pFeldB = value
End Set
End Property
Private pFeldC As String
Public Property FeldC() As String
Get
Return pFeldC
End Get
Set(ByVal value As String)
pFeldC = value
End Set
End Property
Public Overrides Function ToString() As String
Return FeldA
End Function
End Class |