Solved

VB.NET - Select network computer dialog box

Posted on 2011-03-04
5
748 Views
Last Modified: 2012-08-14
Morning experts...

I am writing a small VB.NET forms application that will allow a user to input a server name, database name and credentials to connect to a database on the local network. Initially I was thinking that the FolderBrowserDialog would allow me to select a computer on the network. However I was mistaken! That only allows a user to select a folder within a computer on the network =)  All I want is the server name to put into the DB connection string.

Any suggestions would be greatly appreciated!!

Thanks!
0
Comment
Question by:romieb69
5 Comments
 
LVL 16

Accepted Solution

by:
Kalpesh Chhatrala earned 250 total points
ID: 35038690
0
 

Author Comment

by:romieb69
ID: 35038725
Read the question again. I'm not looking to select a network folder. I want to simply select the Network computer (the ok button does not light up using FolderBrowserDialog until you select an actual folder) ...
0
 
LVL 8

Expert Comment

by:Toxacon
ID: 35042215
If the computer running your software is in a Active Directory domain, you can make an LDAP query to the domain for computer objects and then filter out workstations.
0
 

Author Comment

by:romieb69
ID: 35071405
Thanks Toxacon ... yes that's absolutely correct. Found a good example on line on how to do that. What about in standard windows networks though where you would really only have the Network Neighborhood to use to allow a user to select a remote system... any ideas for that scenario?  

If not I'll just use what you suggested for now...

Thanks for the good suggestion!
0
 
LVL 3

Expert Comment

by:Avinash Desai
ID: 35221814
Hi

Just use the below code which retrives the installed SQL server Computers from the local network and then using the that you can form the connection string


CODE

    Dim dt As DataTable = Sql.SqlDataSourceEnumerator.Instance.GetDataSources
        For Each dr As DataRow In dt.Rows
            CbServer.Items.Add(String.Concat(dr("ServerName"), "\\", dr("InstanceName")))
        Next


If any doubt or problem in getting the info please let me know

Regards
Avinash Desai
   
0

Featured Post

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

With most software applications trying to cater to multiple user needs nowadays, the focus is to make them as configurable as possible. For e.g., when creating Silverlight applications which will connect to WCF services, the service end point usuall…
What my article will show is if you ever had to do processing to a listbox without being able to just select all the items in it. My software Visual Studio 2008 crystal report v11 My issue was I wanted to add crystal report to a form and show…
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
This video discusses moving either the default database or any database to a new volume.

706 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now