Senior Posted November 29, 2009 at 07:27 PM Report Share #298010 Posted November 29, 2009 at 07:27 PM viva pessoal tou a fazer uma barra de atalhos como o do mac, mas tou a ter problemas no codigo diz me que o patch nao foi declarado For Each foundFile As String In My.Computer.FileSystem.GetFiles(path) lvItem = ListView.Items.Add(My.Computer.FileSystem.GetFileInfo(foundFile).Name) ListViewLargeImageList.Images.Add(System.Drawing.Icon.ExtractAssociatedIcon(foundFile).ToString, System.Drawing.Icon.ExtractAssociatedIcon(foundFile)) ListViewSmallImageList.Images.Add(System.Drawing.Icon.ExtractAssociatedIcon(foundFile).ToString, System.Drawing.Icon.ExtractAssociatedIcon(foundFile)) lvItem.ImageKey = ListViewLargeImageList.Images.Keys(passar_icons).ToString lvItem.SubItems.AddRange(New String() {My.Computer.FileSystem.GetFileInfo(foundFile).Extension, "Column3"}) passar_files = passar_files + 1 tssl_ficheiros.Text = passar_files & " Ficheiros e " & passar_dirs & " Pastas = " & passar_dirs + passar_files passar_icons = passar_icons + 1 Application.DoEvents() Next End Sub Link to comment Share on other sites More sharing options...
vbtipo Posted November 29, 2009 at 08:47 PM Report Share #298019 Posted November 29, 2009 at 08:47 PM Essa parte do path deve estar mal introduzida, ou seja, assim como pusestes ele pensa que o path é uma variável e não o caminho tal como tu queres indicares a ele. Lema: Se eu não saber de alguma coisa não se preocupem porque tento sempre ajudar alguma coisita, nem que seja, por palpites/sugestões. Link to comment Share on other sites More sharing options...
Senior Posted November 29, 2009 at 09:00 PM Author Report Share #298020 Posted November 29, 2009 at 09:00 PM nao estou mesmo a ver porque que da este erro Link to comment Share on other sites More sharing options...
ribeiro55 Posted November 29, 2009 at 11:04 PM Report Share #298039 Posted November 29, 2009 at 11:04 PM Onde é que a variável "path" é declarada? Sérgio Ribeiro "Great coders aren't born. They're compiled and released""Expert coders do not need a keyboard. They just throw magnets at the RAM chips" Link to comment Share on other sites More sharing options...
Senior Posted November 30, 2009 at 11:50 AM Author Report Share #298068 Posted November 30, 2009 at 11:50 AM nao declarei porque nao sei como e que declaro o path Link to comment Share on other sites More sharing options...
ribeiro55 Posted November 30, 2009 at 02:21 PM Report Share #298079 Posted November 30, 2009 at 02:21 PM E não percebes porque dá erro? 🙂 Se o path não for declarado ou se nenhum valor lhe for atribuído, é esse erro mesmo que levas. Explica lá onde estás a meter esse código e mais especificamente onde queres ir buscar ficheiros. Sérgio Ribeiro "Great coders aren't born. They're compiled and released""Expert coders do not need a keyboard. They just throw magnets at the RAM chips" Link to comment Share on other sites More sharing options...
vbtipo Posted November 30, 2009 at 03:00 PM Report Share #298083 Posted November 30, 2009 at 03:00 PM Em vb6 o comando path funciona assim app.path e em vbnet tens quer ver como é que é. Lema: Se eu não saber de alguma coisa não se preocupem porque tento sempre ajudar alguma coisita, nem que seja, por palpites/sugestões. Link to comment Share on other sites More sharing options...
ribeiro55 Posted November 30, 2009 at 03:19 PM Report Share #298085 Posted November 30, 2009 at 03:19 PM O ter chamado "path" não quer necessáriamente dizer que queira ir buscar à origem da execução. Eu já lhe pedi para especificar melhor de onde quer ir buscar ficheiros. Caso seja mesmo isso que queiras, My.Application.Info.DirectoryPath Sérgio Ribeiro "Great coders aren't born. They're compiled and released""Expert coders do not need a keyboard. They just throw magnets at the RAM chips" Link to comment Share on other sites More sharing options...
Senior Posted November 30, 2009 at 03:37 PM Author Report Share #298086 Posted November 30, 2009 at 03:37 PM tou a fazer uma barra de atalhos como do mac e ao fazer drag drop dos atalhos do ambiente para cima da form aparecesse os icones dos atalhos. Link to comment Share on other sites More sharing options...
Senior Posted December 1, 2009 at 06:06 PM Author Report Share #298261 Posted December 1, 2009 at 06:06 PM alguem pode ajudar Link to comment Share on other sites More sharing options...
Ivo Pereira Posted December 1, 2009 at 06:49 PM Report Share #298269 Posted December 1, 2009 at 06:49 PM Se não deres mais pormenores, e não responderes às perguntas que te forem colocadas, é difícil alguém te ajudar rapaz 🙂 Link to comment Share on other sites More sharing options...
Senior Posted December 1, 2009 at 07:03 PM Author Report Share #298272 Posted December 1, 2009 at 07:03 PM tenho este codigo na listview For Each foundFile As String In My.Computer.FileSystem.GetFiles(path) lvItem = ListView.Items.Add(My.Computer.FileSystem.GetFileInfo(foundFile).Name) ListViewLargeImageList.Images.Add(System.Drawing.Icon.ExtractAssociatedIcon(foundFile).ToString, System.Drawing.Icon.ExtractAssociatedIcon(foundFile)) ListViewSmallImageList.Images.Add(System.Drawing.Icon.ExtractAssociatedIcon(foundFile).ToString, System.Drawing.Icon.ExtractAssociatedIcon(foundFile)) lvItem.ImageKey = ListViewLargeImageList.Images.Keys(passar_icons).ToString lvItem.SubItems.AddRange(New String() {My.Computer.FileSystem.GetFileInfo(foundFile).Extension, "Column3"}) passar_files = passar_files + 1 tssl_ficheiros.Text = passar_files & " Ficheiros e " & passar_dirs & " Pastas = " & passar_dirs + passar_files passar_icons = passar_icons + 1 Application.DoEvents() Next End Sub mas da me erro no path diz que nao foi declarada Link to comment Share on other sites More sharing options...
Ivo Pereira Posted December 1, 2009 at 07:16 PM Report Share #298275 Posted December 1, 2009 at 07:16 PM Sim, essa parte está no tópico inicial. Diz que o path não foi declarado, exactamente onde? Já experimentaste fazer um breakpoint? Link to comment Share on other sites More sharing options...
Senior Posted December 1, 2009 at 07:27 PM Author Report Share #298279 Posted December 1, 2009 at 07:27 PM logo na 1 linha For Each foundFile As String In My.Computer.FileSystem.GetFiles(path) Link to comment Share on other sites More sharing options...
Ivo Pereira Posted December 1, 2009 at 07:32 PM Report Share #298280 Posted December 1, 2009 at 07:32 PM logo na 1 linha For Each foundFile As String In My.Computer.FileSystem.GetFiles(path) É porque o programa não sabe onde ir buscar path. O que tu tens ai no código na primeira linha quer dizer algo como isto: Para cada "ficheiroencontrado" do tipo String em VerificarOsFicheirosDoMeuComputadorNestaPasta(path) Isto assim traduzido mal e porcamente para português. Se não tu especificas onde ele deve ir ver os ficheiros, é normal que ele te diga que não sabe onde os há-de ir ver. O path poderá ser por exemplo "C:\", digo eu. Link to comment Share on other sites More sharing options...
Senior Posted December 1, 2009 at 07:37 PM Author Report Share #298282 Posted December 1, 2009 at 07:37 PM queria que fosse ver ao desktop Link to comment Share on other sites More sharing options...
Ivo Pereira Posted December 1, 2009 at 07:49 PM Report Share #298288 Posted December 1, 2009 at 07:49 PM Dim path As String = My.Computer.FileSystem.SpecialDirectories.Desktop For Each foundFile As String In My.Computer.FileSystem.GetFiles(path) lvItem = ListView.Items.Add(My.Computer.FileSystem.GetFileInfo(foundFile).Name) ListViewLargeImageList.Images.Add(System.Drawing.Icon.ExtractAssociatedIcon(foundFile).ToString, System.Drawing.Icon.ExtractAssociatedIcon(foundFile)) ListViewSmallImageList.Images.Add(System.Drawing.Icon.ExtractAssociatedIcon(foundFile).ToString, System.Drawing.Icon.ExtractAssociatedIcon(foundFile)) lvItem.ImageKey = ListViewLargeImageList.Images.Keys(passar_icons).ToString lvItem.SubItems.AddRange(New String() {My.Computer.FileSystem.GetFileInfo(foundFile).Extension, "Column3"}) passar_files = passar_files + 1 tssl_ficheiros.Text = passar_files & " Ficheiros e " & passar_dirs & " Pastas = " & passar_dirs + passar_files passar_icons = passar_icons + 1 Application.DoEvents() Next End Sub Experimenta lá assim 🙂 Link to comment Share on other sites More sharing options...
Senior Posted December 1, 2009 at 07:57 PM Author Report Share #298292 Posted December 1, 2009 at 07:57 PM assim da bues erros http://img44.imageshack.us/img44/6060/erros1234.jpg Link to comment Share on other sites More sharing options...
Ivo Pereira Posted December 1, 2009 at 08:03 PM Report Share #298296 Posted December 1, 2009 at 08:03 PM Tens as variáveis passar_icons, etc.. declaradas? Link to comment Share on other sites More sharing options...
Senior Posted December 1, 2009 at 08:06 PM Author Report Share #298298 Posted December 1, 2009 at 08:06 PM nao so tenho este bocado do codigo eu tirei este codigo numa pagina que encontrei Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now