Home Page
Articoli
Tips & Tricks
News
Forum
Archivio Forum
Blogs
Sondaggi
Rss
Video
Utenti
Chi Siamo
Contattaci
Username:
Password:
Login
Registrati ora!
Recupera Password
Home Page
Stanze Forum
App. WinForms / WPF .NET
Filtrare i D&D.
domenica 07 dicembre 2008 - 09.33
Elenco Threads
Stanze Forum
Aggiungi ai Preferiti
Cerca nel forum
xxtr93
Profilo
| Junior Member
93
messaggi | Data Invio:
dom 7 dic 2008 - 09:33
Ciao!
Sto creando un applicazione che usa il metodo del D&D per visualizzare il percorso del file spostato su un textbox.
Private Sub TextBox1_DragDrop(ByVal sender As Object, ByVal e As System.Windows.Forms.DragEventArgs) Handles TextBox1.DragDrop
Try
Dim str As String = CType(e.Data.GetData(DataFormats.FileDrop), Array)(0)
str = IO.Path.GetDirectoryName(str) & "\" & IO.Path.GetFileName(str)
If ComboBox1.Text <> "" Then
TextBox1.Text = str
Else
MsgBox("Scegliere l'unità a cui cambiare l'icona", MsgBoxStyle.Exclamation)
End If
Catch ex As Exception
MsgBox("Impossibile trovare il file!", MsgBoxStyle.Critical)
End Try
End Sub
Private Sub TextBox1_DragEnter(ByVal sender As Object, ByVal e As System.Windows.Forms.DragEventArgs) Handles TextBox1.DragEnter
Try
If e.Data.GetDataPresent(DataFormats.FileDrop) Then
e.Effect = DragDropEffects.Copy
Else
e.Effect = DragDropEffects.None
End If
Catch ex As Exception
End Try
End Sub
Il problema è: Come posso filtrare i file spostati sul textbox, io voglio solo i file con estensione ".ico" ma non so come fare.
0v3rCl0ck
Profilo
| Guru
1.120
messaggi | Data Invio:
dom 7 dic 2008 - 16:14
>Ciao!
Ciao
>
>Sto creando un applicazione che usa il metodo del D&D per visualizzare
>il percorso del file spostato su un textbox.
>
>
>Il problema è: Come posso filtrare i file spostati sul textbox,
>io voglio solo i file con estensione ".ico" ma non so come fare.
Vorresti non visualizzare niente nella textbox, ed eventualmente una messagebox, se vi viene trascinato un file che non ha estensione .ico? Ho capito bene?
-------------------------------------------------------------------
Michael Denny
Senior Software Developer - Microsoft Framework (C# ASP.NET VB.NET)
http://blogs.dotnethell.it/Regulator/
xxtr93
Profilo
| Junior Member
93
messaggi | Data Invio:
dom 7 dic 2008 - 20:10
Esatto!
Proprio così!
Sai come si fa?
0v3rCl0ck
Profilo
| Guru
1.120
messaggi | Data Invio:
lun 8 dic 2008 - 15:14
Puoi utilizzare il metodo: Path.GetExtension(string path)
Ti ritorna una stringa contenente l'estensione del file compreso del punto '.'
Es.: Path.GetExtension("C:\pippo.txt") Ritornerà ".txt"
Oppure puoi utilizzare anche l'oggetto FileInfo:
Dim fi2 As FileInfo = New FileInfo(path2)
fi2.Extesion
-------------------------------------------------------------------
Michael Denny
Senior Software Developer - Microsoft Framework (C# ASP.NET VB.NET)
http://blogs.dotnethell.it/Regulator/
xxtr93
Profilo
| Junior Member
93
messaggi | Data Invio:
lun 8 dic 2008 - 19:33
Hey! Ma 6 un genio? Funziona alla perfezione!!!
Grazie, non immagini quanto mi sia servito il tuo aiuto.
Ciao
0v3rCl0ck
Profilo
| Guru
1.120
messaggi | Data Invio:
mar 9 dic 2008 - 01:57
>Hey! Ma 6 un genio? Funziona alla perfezione!!!
>Grazie, non immagini quanto mi sia servito il tuo aiuto.
>Ciao
Bene sono contento
Alla prossima
Ciaooo
-------------------------------------------------------------------
Michael Denny
Senior Software Developer - Microsoft Framework (C# ASP.NET VB.NET)
http://blogs.dotnethell.it/Regulator/
Torna su
Stanze Forum
Elenco Threads
Partecipa anche tu! Registrati!
Hai bisogno di aiuto ?
Perchè non ti registri subito?
Dopo esserti registrato potrai chiedere
aiuto sul nostro
Forum
oppure aiutare gli altri
Consulta le
Stanze
disponibili.
Registrati ora !