Treeview Network PCs And Shared Directories With VB2010?
Sep 9, 2011
I'm working on my first VB2010 project, having used VB6 up to now.In VB6, I used some library functions to implement a treeview of network PCs and their shared folders.
I've been searching, but I've not found a way to get this done with VB2010.
I have found scode to return a list of all the devices local to my network....close but not what I'm looking for.
Does anyone know a way to get a list of UNC servers (A.K.A. items in the "Network" system folder in windows vista +, or "My Network Places" in win xp -), and get a list of shared files for a particular server?
When I try to get directories using System.IO.Directory.GetDirectories("\"), it says I need to put it in the form of \UNC serverFile share
I have a page in VB.NET that is hosted with IIS 7 on Windows 7 Home Premium. The page has code in the Page_Load event that scans through a directory and adds all sub directories to a drop down list. When testing through VS2010, it works perfectly. However, when I set the site up in IIS, the page loads correctly but nothing is added to the drop down list. My current code is: [Code]
I am using the following code to add all files and sub-directories to a Treeview control. The user can select a directory (using a folder browser dialog) and this code will add that directory, and all it's files and sub-directories, to the Treeview:
[Code]....
I have tried a few ways, mainly 'copying' the code from this recent codebank submission. However, I keep getting the obvious cross-thread call issue that I am adding nodes to the 'node' parameter, which is not allowed.
I am at a loss at how to do this otherwise. How can I update a Treeview like this if I have to recursively add nodes to the 'node' parameter, which is not 'available' in a separate thread?
I want to have a treeview as directory navigator I can view the first path of my dir (C:Dirmanin), I can list all files in and folders in this path, but I can't add the subfolders as node, and the subfolder of the subfolder...
Public Sub LoadFolderTree(ByVal path As String, ByVal e As System.Windows.Forms.TreeView) Dim sbasenode As System.Windows.Forms.TreeNode Try sbasenode = e.Nodes.Add(path)
This is a follow-up questions to the following post: [URL]
Below (Example 2) is working code for populating a treeview with directories only down to 1 level. Note just directores are added- No files. I want to add a Listview control beside my treeview and have the Listview populated with the "files" from the selected node in the treeview. This would fire off the NodeMouseClick event of the treeView. I have used Example 1 (NodeMouseClick) before with other code that I have. However, I cannot get the code to work with the Example 2 code below
how to change the Example 1 code to work with Example 2?
Example 1 '************************************************ Private Sub treeView1_NodeMouseClick(ByVal sender As Object, _ ByVal e As TreeNodeMouseClickEventArgs) _
how do you make a rectangle without the designer.if the powerpack rectangleshape is the only thing, how do you add it to the form, like controls.add(label) works with other controls
I am working in Microsoft Visual Studio 2003.I want to copy a file from one folder to another folder in php.
I written the code in vb.net and created exe. I called that exe in php.Exe is executed successfully in php and file is successfully copied for local path. But network path file is not copied. How can i able to copy the shared network file?
I wrote WCF method that check whether file is available or not. File is on the network drive. "\orl-avqaAVIPHist_Images2009h010109000379.fim"When I am checking file is available or not. Web service is returning me "file not found"let me know what should I do to fix it.
All i am trying to do is read and write files to a shared folder on a network in visual basic (VS 2010). I can go to the folder through windows without a problem and without being prompted for a password. However when i try to do it through visual basic, it cant find the directory. Here is my small snippet of code that i (hope) is telling me that the program cannot connect to the folder. [code] Are there any known issues with VS 2010 that may cause this? Maybe something else in my code that could have an effect? This is in my form_load event though, so it is literally one of the first things that runs.
With the help of NetFileEnum or Openfiles.exe of system32, we can get the username who has opened the shared files. Is there any API function or any exe files in any programming language like c#, vb.net, visual c++ to find out who is the user to create, rename, or delete shared files or folders on the network?
I have a web service that is currently calling the DOS command copy to put a text file to a specified network share.
This is the code: Imports System.Web.Services Imports System.Web.Services.Protocols Imports System.ComponentModel Imports System.Data Imports System.IO Imports System.Xml [Code] .....
It appears doing this might be causing some problems and our front-end programmer suggested I see if I can output the stream "output" directly to the network shared printer specified by the SOAP request. Is this possible? This is VS 2010
Dim fileList As Collections.ObjectModel.ReadOnlyCollection(Of String) = My.Computer.FileSystem.GetFiles(FolderDialog1.SelectedPath, FileIO.SearchOption.SearchTopLevelOnly) For Each topLvlFile As String In fileList
[code]....
The above code reads all the files & directories in a selected path. It ignores any hidden folders, like it suppose to. Except it doesn't ignore folders inside of the hidden folders that it finds & I need it to.I can't quite wrap my head around how to make it ignore all folders & files inside of a hidden folder that it find.
Here is my idea so far: I have a bunch of computers connected in a local network. One of them is a MySQL server, one will have a vb.NET program wich will act as a "second server" and the rest will be different clients. What I want to do is that the "second server" will send out some kind of message or network package to some of the clients in the network, and they will execute a code based on what message it is, or what kind of package it is. I'll give you a simple example:
I need to list all files folders, subfolders and subfolder files under a selected directory in a list box not sure how to do the logic in the last amount of code lines to enumerate all subfolders dna files.Here is what I have so far:
Dim OldProfileDir As String Dim NewProfileDir As String Dim Newdocs As String = "" Dim Olddocs As String = ""
Basically I'm going to try and develop a software that merges PDFs automatically using the PDFSharp API.What I want in the program is to basically that: Have the program to give and Input and Output directoryMerge all the documents in the directory or sub-directoryRename the merged PDF file according the the name of the directory/sub-directoryIf the folder has PDF files and a Sub-Directory I want to merge the PDF files in the folder and rename them as per the main folder, and rename the files in the sub-folder according to its name (i.e. seperate|)
It's the first time I'm using an API.The problem I have is how to use the directories and sub-directories as I need them.
It works, when I make getBar methods public, but I don't want to expose these unneccessarily. Why I can't call private shared methods from a public one in the same class is over my head. I'm using .net framework 4.0 in a web application.
I've taken over the maintenance of the website (ASP.NET VB) and on one particular page I noticed the below code
Inherits System.Web.UI.Page Public Shared UserNumber As String Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init
[Code]....
My question is whether the variable UserNumber can be accessed or changed by any other user than the current one?
Given in the following language specification, for me at least, calling Db.Foobar() [In the following code] does not indeed call off to the Shared Constructors of the base classes. I am curious as to a) is this my own fault for doing something wrong or b) is this an error in the language specification[code]...
I have a .NET 2.0 *.dll that calls My.Computer.Network.Ping(). The *.dll is then run out of an *.exe via AppDomain.CreateDomain() and Invoke(). The problem is that this works just fine under Windows XP but under Windows 7, I get an exception saying that no network connection is available. I tried the Ping() call out of a small console application under Windows 7 and it works just fine.
I seem to be drawing a blank. I'd like to create a "shared" variable that is shared with all instances of a class but not classes that inherit from it. For example.Class A: Shared list As New List(Of String): list.Add("A")
Class B Inherits A: list.Add("B")Class C Inherits B: list.Add("C")The end result I'd like is that any instance of A has just A in the list. Any instance of B has A and B in the list. Any instance of C has A, B, and C in the list. I can accomplish it by creating Instance variables, but I have to construct the list for each instance of a class. I'd like to construct it once for a specific point in the Hierarchy and then share it accross other instances of that class.
I am trying to add shared members in derived classes and use that values in base classes...
I have base
class DBLayer public shared function GetDetail(byval UIN as integer) dim StrSql = string.format("select * from {0} where uin = {1}", tablename, uin) end function end class
[Code]..
currently there is error using the tablename variable of derived class in base class but i want to use it i dun know other techniques if other solutions are better then u can post it or u can say how can i make it work? confused...
i have a treeviev and listbox.i want to display the selected contents of treeview into the listbox.my code is working for file but not for folder. means i want, if the all contents of folder ABC(i.e all files) are selected then in listbox i want to show the only path of folder not the seperate path of each file.
I am writing some code as part of a framework for opening a file.The file is of custom type and should not be opened by more than one instance of my application. To stop multiple file opening I use a filestream to create a lock file and then keep said filestream open. This seems to work in preventing another instance of my application from opening the file ( as it will fail in recreating the lock stream in the files open code ) but if the file is on a network share and the network drops then the original application also can not access the file any more.The code to get the lock stream is as follows:
Try ' We need to keep this stream alive to prevent other applications gaining access to the lock mLockStream = New FileStream(mLockPath, FileMode.CreateNew, FileAccess.Write, FileShare.None)[code]....
In this I create the lock stream the first time round and then if another application tries to create it, it throws an exception and stops them from getting any further. This is kind of how it needs to work, unfortunately as I said, if this is done across a network and then the network connection is dropped for some reason then I can not delete the lock stream as I get an IOException telling me a process cannot access the file as it is open in another process ( which shouldn't be happening I don't think).