{vb.net} De Textbox a string
Résolu/Fermé
relax.
Messages postés
380
Date d'inscription
vendredi 15 mai 2009
Statut
Membre
Dernière intervention
8 mars 2013
-
17 sept. 2012 à 19:27
Utilisateur anonyme - 17 sept. 2012 à 20:43
Utilisateur anonyme - 17 sept. 2012 à 20:43
A voir également:
- {vb.net} De Textbox a string
- Cannot access offset of type string on string - Forum PHP
- Uninitialized string offset ✓ - Forum PHP
- Include string - Forum C++
- Illegal string offset ✓ - Forum PHP
- Unsupported operand types: string + string ✓ - Forum PHP
1 réponse
Bonjour,
Exemple type :
Cdt
Lupin
Exemple type :
Public Class Form1
Private mVariable As String = String.Empty
Public Property Variable() As String
Get
Dim oldVal As String = Me.TextBox1.Text
If Not (String.IsNullOrEmpty(oldVal)) Then
Me.mVariable = oldVal
End If
Return Me.mVariable
End Get
Set(ByVal value As String)
Me.mVariable = value
End Set
End Property
Private Sub Button1_Click(ByVal sender As Object, ByVal e As EventArgs) Handles Button1.Click
OpenFileDialog1.InitialDirectory = "AppPath"
OpenFileDialog1.RestoreDirectory = True
OpenFileDialog1.Filter = "All files(*.*)|*.*"
OpenFileDialog1.Title = "file selector BETA"
OpenFileDialog1.FileName = "Select a file"
If OpenFileDialog1.ShowDialog() = DialogResult.OK Then
TextBox1.Text = OpenFileDialog1.FileName
Variable = TextBox1.Text
End If
End Sub
End Class
Cdt
Lupin
17 sept. 2012 à 19:58
Public variable As String 'mon boutton parcourire Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click OpenFileDialog1.InitialDirectory = "AppPath" OpenFileDialog1.RestoreDirectory = True OpenFileDialog1.Filter = "All files(*.*)|*.*" OpenFileDialog1.Title = "file selector BETA" OpenFileDialog1.FileName = "Select a file" If OpenFileDialog1.ShowDialog() = DialogResult.OK Then TextBox1.Text = OpenFileDialog1.FileName Variable = TextBox1.Text End If End Subça ne pose pas problème ?
17 sept. 2012 à 20:43
non, ce n'est pas selon la norme, mais c'est fonctionnel :-)
Cdt
Lupin