|
How can I rename an NT user using the ADSI(Active Directory Service Interfaces)? The IADs::SetInfo method can only change user's fullname not rename a user.
|
|
|
|
|
You can do it using the System.DirectoryServices namespace:
Imports System.DirectoryServices
.
.
.
' Allocate a new Directory Entry object and point it
' at the user object we want to rename.
Dim de As New DirectoryEntry("LDAP://whateverPathToUserObject")
' Rename the object and commit the changes to the directory.
de.Rename("myNewUsername")
de.CommitChanges()
' Clean up and destroy the Directory Entry object we created.
de.Close()
de.Dispose()
de = Nothing
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Thanks despite I'm not using .NET platform.With its hint,I worked out the solution.
|
|
|
|
|
Is there a way me to use the classes in System.Configuration in a read/write way. I've looked through the examples and documentation ant it seems that it only supports read-only use. I would like to use this functionality in a Options form that would read and save the configurations for my application. Any Ideas? Is there a write-able equivalent to the AppSettingsReader Class?
|
|
|
|
|
Off the top of my head, I would think it dangerous to allow a system namespace to be read/write, but I'm pretty new to this myself.
This does not keep you from creating your own class though.
Still coaxing software out of the can after all these years...
|
|
|
|
|
Yeah, thought so. I am creating a class using xml though. Thanks.
|
|
|
|
|
|
Great article! Though for my purposes I think it would be better if I create my own class to write dynamic properties. I was hoping to add a feature that will allow addition of new configuration sections and additional attributes. Thanks a lot!!
|
|
|
|
|
How do I access a custom section in a custom section group? I was hoping to have something like this:
<br />
<configuration><br />
<configSections><br />
<sectionGroup name="mySectionGroup"><br />
<section name="mySection" type="System.Configuration.NameValueSectionHandler,System" /><br />
</sectionGroup><br />
</configSections><br />
<br />
<mySectionGroup><br />
<mySection setting1="value1" setting2="value2" /><br />
</mySectionGroup><br />
</configuration><br />
|
|
|
|
|
Like what? Make sure you use the < and > buttons at the botrom of the message box when you post here. Anything in < > characters will be treated like HTML tags and not displayed.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Ok. Sorry about that. After doing some research I got what I wanted. Related question: Can I have multiple sections in a sectionGroup? Like this?
<br />
<?xml version="1.0" encoding="utf-8" ?><br />
<configuration><br />
<configSections><br />
<sectionGroup name="CustomSectionGroup"><br />
<section name="CustomSection" type="System.Configuration.SingleTagSectionHandler" /><br />
<section name="CustomSection2" type="System.Configuration.NameValueSection" /><br />
</sectionGroup><br />
</configSections><br />
<CustomSectionGroup><br />
<CustomSection setting1="value1" setting2="value2" /><br />
<CustomSection2><br />
<add key="key1" value="value1"><br />
<add key="key2" value="value2"><br />
</ CustomSection2><br />
</CustomSectionGroup><br />
</configuration><br />
|
|
|
|
|
Yes, you can. You have to use ConfigurationSettings.GetConfig() to access a custom configuration section. You might want to look at this[^] on MSDN for an example and what the limitions are.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Hi Everyone
Im a new programmer who has just recently (4mths) have purchased Visual Basic 2003 and about 75% through the Step by Step Visual basic book learning how to use it etc.
Im now looking for ideas, to making a programme on a bitmap of Europe, moving Icons on the map (units) from area to provincial area, with a basic data base, political moves with up to 7 players moving on the internet.
Its the moving the Icons on the Map at the moment is the problem initially. I was thinking of left clicking the unit icon, then right clicking the adjacent area to make the move, but how?
Anyhow I bow to more experienced programmers out here to help me out.
Garry
garry
|
|
|
|
|
I wouldn't put anything on the right button except a context menu.
You might consider a drag-and-drop style of movement which people would be more familiar.
"You can have everything in life you want if you will just help enough other people get what they want." --Zig Ziglar
The Second EuroCPian Event will be in Brussels on the 4th of September
Can't manage to P/Invoke that Win32 API in .NET? Why not do interop the wiki way!
My Blog
|
|
|
|
|
I seem to be running into recurring problems with doing book exercises where my code looks exactly the same as the author's, but theirs works and mine has some sort of syntax error.
my latest is:
"Too many arguments to Public Sub New()"
The bolded line has the blue squiggly under (Me)
<br />
Private Sub Button1_Click(ByVal sender As System.Object, _<br />
ByVal e As System.EventArgs) Handles Button1.Click<br />
<br />
Dim f2 As New Form2(Me)<br />
f2.Show()<br />
Me.Hide()<br />
<br />
End Sub<br />
<br />
Private Sub Button2_Click(ByVal sender As System.Object, _<br />
ByVal e As System.EventArgs) Handles Button2.Click<br />
<br />
Dim f2 As New Form2<br />
f2.Show()<br />
<br />
<br />
End Sub<br />
End Class<br />
Granted, there is another form involved here with similar code.
Still coaxing software out of the can after all these years...
|
|
|
|
|
I seem to be running into recurring problems with doing book exercises where my code looks exactly the same as the author's, but theirs works and mine has some sort of syntax error.
my latest is:
"Too many arguments to Public Sub New()"
The bolded line has the blue squiggly under (Me)
<br />
Private Sub Button1_Click(ByVal sender As System.Object, _<br />
ByVal e As System.EventArgs) Handles Button1.Click<br />
<br />
Dim f2 As New Form2(Me)<br />
f2.Show()<br />
Me.Hide()<br />
<br />
End Sub<br />
<br />
Private Sub Button2_Click(ByVal sender As System.Object, _<br />
ByVal e As System.EventArgs) Handles Button2.Click<br />
<br />
Dim f2 As New Form2<br />
f2.Show()<br />
<br />
<br />
End Sub<br />
End Class<br />
Still coaxing software out of the can after all these years...
|
|
|
|
|
You need to change the constructor of the form 'form2' such that it accepts a parameter of type 'form1' if you are in the current form.
Constructor of the form 'form2' goes like this
Sub New ( f as Form1 )
...Code goes here
End Sub
Bhaskara
|
|
|
|
|
tanstaafl28 wrote:
Dim f2 As New Form2(Me)
f2.Show()
Me.Hide()
End Sub
You don't need the Me in the constructor for Form2, unless you intend on passing Form1 as a reference to Form2 for some reason. Usually this would be because Form2 has code on it that modifies the instance, or controls, on Form1.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
While I am beginning to become more intuitive with the code, the "me" is printed in the book just as I typed it.
Still coaxing software out of the can after all these years...
|
|
|
|
|
Where did this book come from? It sounds like it has a mountain of errors in it...
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
It's actually several books. That's what worries me.
One is Visual Basic.Net Step-by-Step by Mike Halvorson, one is Visual Basic.Net Programming by Peter Aiken, and the other one is the MCAD/MCSD Windows Aps with VB.Net and C# 2nd Edition.
None of them have caused any sort of major exceptions, but I've had to do some sort of "tweaking" to my code to avoid syntax errors that they don't seem to have.
So in one way, I'm learning how to improvise, but in another, I'm not getting the same results as these (so called) experts in the field.
Still coaxing software out of the can after all these years...
|
|
|
|
|
Out of curiosity, is it possible to identify which classes are almost always referenced in a VB.NET assembly, and just add them to every project?
If so, what might those classes be?
Still coaxing software out of the can after all these years...
|
|
|
|
|
Classes or Namespaces?
It's entirely up to you. You could go an add ALL the namespaces to each project, but some of them will require you to add the references for them too.
You would have to make your own project templates to add these to every project you make though. You can't tell VS.NET to just add these namespaces to every project, they must be put into the project templates.
When the project is built, all the unnecessary references and namespaces are ignored and not put into the final .EXE or .DLL.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Perhaps I still don't understand the differences between classes and namespaces. I thought the namespaces pointed to the classes (and structures).
Still coaxing software out of the can after all these years...
|
|
|
|
|
Namespaces, I would say to categorize a set of classes. Say, you have classes SqlClient, OracleClient. These two belong to Data manipulation. So, they can be a part of the namespace Data. code may go like this
Namespace System.Data
Public Class SqlClient
Sub SqlConnection ()
End Sub
End Class
Public Class OracleClient
Sub OracleConnection()
End Sub
End Class
End Namespace
Here in this case, if you import System.Data you will have access to both SqlClient and OracleClient classes directly.
Else if you just import System Namespace, you will have to refer to these classes as follows
Dim s as Data.SqlClient
Dim o as Data.OracleClient
I would say namespaces or just for the sake of simplicity in code. So, one namespace is a group of multiple classes.
Bhaskara
|
|
|
|