Bonjour
J'ai ecrit un bout de code et je cherche a recuperer le nom du textbox actif sur mon application autrementque que par le sub "TextBox2_GotFocus" directement dans le sub "PastToolStripMenuItem_Click"
merci
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 Public Class Form1 Dim montexte As Decimal Dim t As TextBox Private Sub PastToolStripMenuItem_Click(sender As System.Object, e As System.EventArgs) Handles PastToolStripMenuItem.Click If TypeOf t Is TextBox Then End If If Clipboard.GetDataObject().GetDataPresent(DataFormats.Text) = True Then If t.Text <> "" Then If MessageBox.Show("Voulez vous ecraser la valeur actuelle ?", "Que voulez-vous faire?", MessageBoxButtons.YesNo, MessageBoxIcon.Question) = Windows.Forms.DialogResult.No Then t.Text = t.SelectedText + Clipboard.GetText.ToString End If End If t.Paste() End If End Sub Private Sub TextBox2_GotFocus(sender As Object, e As System.EventArgs) Handles TextBox2.GotFocus t = TextBox2 End Sub End Class
Partager