Solved

VB.NET - Select network computer dialog box

Posted on 2011-03-04
5
769 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

VMware Disaster Recovery and Data Protection

In this expert guide, you’ll learn about the components of a Modern Data Center. You will use cases for the value-added capabilities of Veeam®, including combining backup and replication for VMware disaster recovery and using replication for data center migration.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Creating an analog clock UserControl seems fairly straight forward.  It is, after all, essentially just a circle with several lines in it!  Two common approaches for rendering an analog clock typically involve either manually calculating points with…
For most people, the WrapPanel seems like a magic when they switch from WinForms to WPF. Most of us will think that the code that is used to write a control like that would be difficult. However, most of the work is done by the WPF engine, and the W…
This tutorial gives a high-level tour of the interface of Marketo (a marketing automation tool to help businesses track and engage prospective customers and drive them to purchase). You will see the main areas including Marketing Activities, Design …
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…

770 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