Click here to Skip to main content
15,916,091 members
Home / Discussions / Visual Basic
   

Visual Basic

 
GeneralRe: progress bar Pin
Steve Pullan12-Mar-06 13:30
Steve Pullan12-Mar-06 13:30 
QuestionConstraints Pin
SVb.net11-Mar-06 12:04
SVb.net11-Mar-06 12:04 
AnswerRe: Constraints Pin
Dave Kreskowiak12-Mar-06 3:43
mveDave Kreskowiak12-Mar-06 3:43 
GeneralRe: Constraints Pin
SVb.net12-Mar-06 4:06
SVb.net12-Mar-06 4:06 
GeneralRe: Constraints Pin
Dave Kreskowiak12-Mar-06 9:20
mveDave Kreskowiak12-Mar-06 9:20 
GeneralRe: Constraints Pin
SVb.net12-Mar-06 13:23
SVb.net12-Mar-06 13:23 
GeneralRe: Constraints Pin
Dave Kreskowiak12-Mar-06 16:03
mveDave Kreskowiak12-Mar-06 16:03 
QuestionADSI VB.Net Get User and Update Pin
japel11-Mar-06 10:02
japel11-Mar-06 10:02 
Hi All

I need to write an application that checks A CSV file for a user and if they exist update a corresponding number into their "primaryTELEX" attribute.

CSV File
==================
john smith 1234
jane jones 3421
==================

I have found articles with examples in C but am having trouble converting the syntax over to VB.Net (Never worked in C)

The two examples I found are.

Find User:

The following sample code uses the FindOne method of the DirectorySearcher class to find the same user we authenticated a moment ago. We will limit the properties that are retrieved during the search.

<br />
<br />
DirectoryEntry entry = new<br />
          DirectoryEntry("LDAP://dev.codeguru.com");<br />
try<br />
{<br />
  DirectorySearcher search = new DirectorySearcher(entry);<br />
  search.Filter = "(SAMAccountName=administrator)";<br />
  search.PropertiesToLoad.Add("Name");<br />
  search.PropertiesToLoad.Add("displayName");<br />
  SearchResult result = search.FindOne();<br />
  if( result != null )<br />
  {<br />
    Console.WriteLine("User found");<br />
    foreach( string key in result.Properties.PropertyNames )<br />
    {<br />
      // Each property contains a collection of its own<br />
      // that may contain multiple values<br />
      foreach( Object propValue in  result.Properties[key] )<br />
      {<br />
        Console.WriteLine(key + " = " + propValue);<br />
      }<br />
    }<br />
  }<br />
  else<br />
  {<br />
    Console.WriteLine("User not found");<br />
  }<br />
}<br />
catch( Exception ex )<br />
{<br />
  throw new Exception("User not authenticated: " + ex.Message);<br />
}<br />
Console.ReadLine();<br />


Update Atribute:

<br />
try<br />
{<br />
  string path = "LDAP://CN=Users,DC=dev,DC=codeguru,DC=com";<br />
  DirectoryEntry entry = new DirectoryEntry(path, <br />
  "dev.codeguru.com\\administrator", "password");<br />
  DirectorySearcher search = new DirectorySearcher(entry);<br />
  search.Filter = "(SAMAccountName=testuser)";<br />
  SearchResult result = search.FindOne();<br />
  DirectoryEntry user = result.GetDirectoryEntry();<br />
  user.Properties["description"].Value = "New description for user";<br />
  user.CommitChanges();<br />
}<br />
catch( Exception exception )<br />
{<br />
  Console.WriteLine( exception.Message );<br />
}<br />
<br />


Looking for any aritcal that does this in VB, (examles would be great...

When people make you see red, be thankful your not colour blind.
AnswerTreating CSV file as a DB Pin
HL_SUB12-Mar-06 0:25
HL_SUB12-Mar-06 0:25 
GeneralThanks but NO, LDAP Queries is where I am stuck. Pin
japel12-Mar-06 10:11
japel12-Mar-06 10:11 
QuestionCalling a child form from an MDI Container Pin
Scott341511-Mar-06 9:04
Scott341511-Mar-06 9:04 
AnswerRe: Calling a child form from an MDI Container Pin
Scott341511-Mar-06 9:11
Scott341511-Mar-06 9:11 
Question'sub main not found' bug Pin
formansworld11-Mar-06 7:22
formansworld11-Mar-06 7:22 
AnswerRe: 'sub main not found' bug Pin
Joshua Quick11-Mar-06 8:46
Joshua Quick11-Mar-06 8:46 
QuestionHow can I show a clips of a picture box at runtime? Pin
JUNEYT11-Mar-06 6:40
JUNEYT11-Mar-06 6:40 
AnswerRe: How can I show a clips of a picture box at runtime? Pin
Joshua Quick11-Mar-06 8:41
Joshua Quick11-Mar-06 8:41 
GeneralYour answer is not the answer to my question Pin
JUNEYT11-Mar-06 10:06
JUNEYT11-Mar-06 10:06 
AnswerRe: Your answer is not the answer to my question Pin
Joshua Quick11-Mar-06 14:04
Joshua Quick11-Mar-06 14:04 
QuestionHow can I retrieve the command line arguments? Pin
JUNEYT11-Mar-06 6:34
JUNEYT11-Mar-06 6:34 
AnswerRe: How can I retrieve the command line arguments? Pin
Joshua Quick11-Mar-06 8:25
Joshua Quick11-Mar-06 8:25 
QuestionSeeking for an alternative solution for tabcontrol? Pin
JUNEYT11-Mar-06 6:31
JUNEYT11-Mar-06 6:31 
AnswerRe: Seeking for an alternative solution for tabcontrol? Pin
Joshua Quick11-Mar-06 8:19
Joshua Quick11-Mar-06 8:19 
GeneralRe: Seeking for an alternative solution for tabcontrol? Pin
JUNEYT11-Mar-06 9:44
JUNEYT11-Mar-06 9:44 
AnswerRe: Seeking for an alternative solution for tabcontrol? Pin
Joshua Quick11-Mar-06 10:05
Joshua Quick11-Mar-06 10:05 
QuestionVB.Net- Fields in Access database returned in alphabetical order Pin
JDMils11-Mar-06 5:41
JDMils11-Mar-06 5:41 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.