Posts
 
Reputation
Joined
Last Seen
0 Reputation Points
100% Quality Score
Upvotes Received
4
Posts with Upvotes
3
Upvoting Members
3
Downvotes Received
0
Posts with Downvotes
0
Downvoting Members
0
0 Endorsements
Ranked #2K
~11.3K People Reached
Favorite Forums
Favorite Tags

22 Posted Topics

Member Avatar for anjela

You can add data that is returned from a reader the same way you would programmatically add items to a combobox (combobox1.Items.Add(*Object to add to combobox*); Here is a sample of code that I did a while ago, this reads all of the Columns on a particular table and adds …

Member Avatar for asshankar
0
703
Member Avatar for Nfurman

NFurman, Looking at your connection string I am unable to determine what credentials you are using, but the credentials in the connection string should be the SQL server credentials, not the client logon credentials.

Member Avatar for Nfurman
0
196
Member Avatar for Lolalola

When you use WMI to query running process you can use a WHERE clause when there is an available attribute, unfortunately Owner is not one of the attributes, there may be a way to resolve the process ID or Session ID to a specific Owner, possibly? At any rate, Here …

Member Avatar for sanch01r
0
647
Member Avatar for skinder

Skinder, you can use WMI to query printer information (Win32_Printer). Below is some sample code that I wrote a while ago, this will retrieve every printer mapped to your computer and give you all available details about it. Create a windows form application and add a Button and TreeView and …

Member Avatar for sanch01r
1
104
Member Avatar for saggiatorius

I am not sure if this will help, but I wrote an Active Directory tool that needed to run on administrator credentials, here is the code. Hope this helps or at least points you in the right direction. [code] using System; using System.Collections.Generic; using System.Linq; using System.Windows.Forms; using System.Runtime.InteropServices; using …

Member Avatar for saggiatorius
0
1K
Member Avatar for RoyMicro

Here is a method that uses the FileStream object, but you can also use the StreamWriter object to write data to a text file. The code below creates the file if it doesn't exist, then writes the data to the text file. If the file already exist you will use …

Member Avatar for Geekitygeek
2
190
Member Avatar for aliiya

Aliiya, You can add values from directly to a database using the following example, However, I recommend creating a stored procedure instead of using variables within your string, I just did it this way as an example: [code] string _InsertRow = "INSERT INTO `"+ DatabaseName +"`.`" + TableName +"` (`FirstName` …

Member Avatar for Marcwolf
0
2K
Member Avatar for Jaydenn

List<string> Directories = new List<string>(System.IO.Directory.GetDirectories("C:\\")); List<string> Files = new List<string>(System.IO.Directory.GetFiles("C:\\")); Not sure if this helps but I was writing some code for a TreeView and created list<>, one for the directories and one for the files.

Member Avatar for sanch01r
0
153
Member Avatar for sanch01r

Does anyone know how to get the adspath attribute value to a better looking string. Active Directory returns the following: "LDAP://contoso.com/CN=Sanch01R,OU=Managers,OU=Users,OU=InfoTech,DC=contoso,DC=com"; I would like it to read: contoso.com/infotech/users/managers/sanch01r The IndexOf and Substring methods do not work consistently as we never know how many OU's would be returned, any ideas would …

0
94
Member Avatar for CyberPirate1

Here is an example that I put together. I wrote a Remove Duplicate method that accepts a List as an overload. It will remove the remove the duplicates and send it back to its caller. Here goes. [code] static void Main(string[] args) { try { List<string> Letters = new List<string>(); …

Member Avatar for Geekitygeek
0
145
Member Avatar for sidd.

Found an old code snippet, Here goes. [code] static void Main(string[] args) { string line; try { StreamReader sr = new StreamReader(new FileStream("C:\\Techdata.txt", FileMode.Open)); line = sr.ReadLine(); while (line != null) { Console.WriteLine(line); line = sr.ReadLine(); } sr.Dispose(); } catch (Exception ex) { Console.WriteLine(ex.Message); } Console.ReadKey(); } [/code]

Member Avatar for sanch01r
0
160
Member Avatar for sanch01r

Hey guys, I am writing an Active Directory Tool and I created a Dictionary<> that iterates through all of the available attributes from the LDAP server. The Keys are the names of the attributes (displayname, samaccountname, gn, sn, etc), the TValues are the associated values to the keys. I am …

Member Avatar for DdoubleD
0
177
Member Avatar for ShailaMohite

Found an old example. I am not sure if this will help out entirely but it should convey the general idea. You can retrieve the selected item value and /or the checklisted item alone, I created a form with a checklistbox, and two listboxes titled listbox1 and listbox2. Listbox1 one …

Member Avatar for sanch01r
0
112
Member Avatar for sidd.

Just in case, here is a method to read from a CSV or delimiter. It returns data to its caller. [code] static void Main(string[] args) { List<string> columns; List<Dictionary<string, string>> myData = GetData(out columns); foreach (string column in columns) { Console.Write("{0,-20}", column); } Console.WriteLine(); foreach (Dictionary<string, string> row in myData) …

Member Avatar for sanch01r
0
337
Member Avatar for crazyboy

Here is some code that I wrote a while back, it populates a TreeView with the directories and files from the path in the textbox. You will need to add a TreeView control to your form, a button, and a textbox for the path. [code] private void button1_Click(object sender, EventArgs …

Member Avatar for sanch01r
0
155
Member Avatar for sanch01r

Hey guys, I am needing to find out the expiration date of a users password using the LDAP attribute "pwdlastset", I am able to retrieve the date of the last password reset. The password expiration date should be exactly 90 days from the "pwdlastset" value. For some reason I am …

Member Avatar for DdoubleD
0
1K
Member Avatar for sanch01r

Hey guys, I am writing an Active Directory Tool that allows my team to read data without having to access Active Directory through a remote desktop session. I am not too familiar with the TreeView control and I was wondering if there was a way to add the Active Directory …

Member Avatar for DdoubleD
0
1K
Member Avatar for kool.net

The example below will retrieve the value of a checkbox and display it in a messagebox on a button click event. [code] if (checkBox1.Checked) { MessageBox.Show(checkBox1.Text.ToString()); } [/code]

Member Avatar for avirag
0
223
Member Avatar for S2009

From the form load method, you can disable the button. button1.Enabled = false; On the click event enable the button. button1.Enabled = true;

Member Avatar for Geekitygeek
0
196
Member Avatar for VidyaYadav

You can create a method that uses a ternary operator that determines if a null value exist, if it does then send back an empty string or "----" rather than a null value. logic: Does DataGridView(columnXX) have a null value? If Yes, send back an empty string "" or else …

Member Avatar for sanch01r
0
1K
Member Avatar for shukuo

You can create your new DirectoryEntry object on the fly and pass it to the search object. [code] DirectorySearcher search = new DirectorySearcher(new DirectoryEntry("LDAP://servername.net", "administrator", "password123$")); [/code]

Member Avatar for sanch01r
0
97
Member Avatar for havejeet

You can use the IDictionary interface. All you have to do is pass the field (AD attribute field) to Dictionary and pass the ResultProperty or The value from the cell to it as its key, then iterate through it. [code] private Dictionary<string, ResultProperty>[] GetDataReader(string Fields, string Table, string Conditions) [/code]

Member Avatar for sanch01r
0
128

The End.