[VB.net] appel de fonction avec un bouton

Fermé
pavinho Messages postés 1 Date d'inscription mercredi 22 juillet 2009 Statut Membre Dernière intervention 23 juillet 2009 - 23 juil. 2009 à 16:51
voyageur59 Messages postés 1112 Date d'inscription vendredi 7 décembre 2007 Statut Membre Dernière intervention 10 novembre 2009 - 23 juil. 2009 à 19:49
Bonjour,

j'aimerais savoir comment faire pour appeler une fonction avec un bouton dans un Windows Form.
ma fonction est :

Public Function ToSasProgram(ByVal data As String) As String
Dim sb As New StringBuilder()
sb.AppendFormat("title '{0}';", Title)
sb.AppendLine()
sb.AppendFormat("proc means data={0}", data)
sb.AppendLine("run;")
Return sb.ToString()
End Function

Merci

pavinho

1 réponse

voyageur59 Messages postés 1112 Date d'inscription vendredi 7 décembre 2007 Statut Membre Dernière intervention 10 novembre 2009 132
23 juil. 2009 à 19:49
Bonjour,

Ton bouton appelle une sub.

Dans la sub de ton bouton tu mets l'appel de ta fonction:



Private Sub Bouton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Bouton.Click

dim texte1 as string
dim data as string = "Données à passer à la fonction"

texte1=ToSasProgram(data)

end sub
2