|
there is a domain :LDAP://dc=www,dc=xxx,dc=com
and i wan to add a ou the the domaim.
my code is:
DirectoryEntry de=new DirectoryEntry ( LDAP:
de.Children.Add("OU=" + organizationUnitName, "organizationalUnit");
de.CommitChanges();
it neither add a ou to the AD nor throw exception.
is my code error?
appreciated for any suggestion
|
|
|
|
|
Hi,
using openfiledialog to select a particular file and store the selected file name in a string it sores the filename with path so is there any way to store only the file name not the whole path?
Thanks
|
|
|
|
|
Path.GetFileName Method
"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning." - Rick Cook
www.troschuetz.de
|
|
|
|
|
There is no method called getfilename !!
see I have this below
OpenFileDialog select_file = new OpenFileDialog();
select_file.Title = "selected file";
select_file.Filter = "(*.txt) | *.txt";
if (select_file.ShowDialog() != DialogResult.Cancel)
{
file = select_file.FileName; // stores whole path with file name
}
but i want only selected file name in file not the path .
|
|
|
|
|
How will you know where the file is, then?
Use the methods in the System.IO.Path class to get different parts of a complete file path.
---
b { font-weight: normal; }
|
|
|
|
|
Did you actually click on the link you were provided with? Changing just 1 line of your code would get you what you want!
Current blacklist
svmilky - Extremely rude | FeRtoll - Rude personal emails | ironstrike1 - Rude & Obnoxious behaviour
|
|
|
|
|
well... I use a little longer way, but I think there is a shorter way, but I don't know it... so here is my way:
file = select_file.FileName.Substring(select_file.FileName.LastIndexOf("\\") + 1, select_file.FileName.Length - select_file.FileName.LastIndexOf("\\") - 5); // -5 = -4 - 3 letters of ending (you can cancel that if you want the ending) and 1 dot, and -1 - for the +1 we do in the first parameter to cancel the \ in the start.
---- modified ----
the other way is better (as they told you here).
if you didn't see the examples so look here:
file = System.IO.Path.GetFileName(select_file.FileName);
file = System.IO.Path.GetFileNameWithoutExtension(select_file.FileName);
-- modified at 4:12 Friday 12th May, 2006
|
|
|
|
|
Yes, and it is file = Path.GetFileName(select_file.FileName);
"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning." - Rick Cook
www.troschuetz.de
|
|
|
|
|
Use the method I suggested:
file = Path.GetFileName(select_file.FileName);
"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning." - Rick Cook
www.troschuetz.de
-- modified at 4:16 Friday 12th May, 2006
|
|
|
|
|
Hi;
this is simplest code u can use to get file name;first u have to import
System.IO namespace.
string path=openfiledialog1.PostedFile.FileName;
string filename=Path.GetFileName(path);
Response.Write(filename);
it will work fine.
with regards
Nikesh Sahu
nikesh
|
|
|
|
|
|
Hello everybody,
After I add neccesity dll(iTextSharp.dll) I run the codes and I saw below message. What must I do?
"An unhandled exception of type 'System.IO.FileNotFoundException' occurred in itextsharp.dll
Additional information: File or assembly name System.Drawing, or one of its dependencies, was not found."
The codes are below.
using System;
using System.IO;
using System.Drawing;
using iTextSharp.text;
using iTextSharp.text.pdf;
namespace ConsoleApplication8
{
class Class1
{
[STAThread]
static void Main(string[] args)
{
Document document = new Document();
PdfWriter.GetInstance(document, new FileStream("a.pdf", FileMode.Create));
document.Open();
document.Add(new Paragraph("Hello Reliability"));
document.Close();
Console.WriteLine("The program finished..");
Console.ReadLine();
}
}
}
|
|
|
|
|
Could you get some information on which VERSION of assembly the third party is dependent on?
Also, make sure that it is not dynamically loading its dependent assemblies (though highly unlikely).
Shailen Sukul
|
|
|
|
|
You must add System.Drawing to the references.
|
|
|
|
|
I tried this code on my computer and it works with iText version 3.1.0.0.
My guess is that the System.Drawing is not installed in your GAC.
Check the C:\WINDOWS\assembly to locate the System.Drawing and System.Drawing.Design assemblies.
HTH
Shailen Sukul
Bsc MCsd.Net Mcsd Mcad
With Regards
Shane Sukul
|
|
|
|
|
HI
i am trying to open my asp.net but it keeps on giving me this error: "The web server reported the following error when you attempting to open or create web project located at the following URL :’http://localhost/webapplication1’,’HTTP/1.1 403 forbidden’."i don't know what's a problem.
jakes
|
|
|
|
|
Is there a file called 'default.aspx' in your wwwroot/webapplication1 directory?
|
|
|
|
|
no there's file called defualt.asp not default.aspx
|
|
|
|
|
I have an application that receives and processes characters from a serial port. This is done in a separate 'receiver' thread. For diagnostics, when a complete packet of data is received on the serial port, a string is formatted and put on a text box that is part of the main application thread.
In VS2003, modifying the Text property of a text box in the main thread with the code in the worker thread worked and never gave me a problem. The same code recompiled in VS2005 throws an exception: "Cross-Thread operation not valid". Is there a "proper" way to make such changes across threads, or a switch that allows the new code to compile as per the old?
Jonathan M
|
|
|
|
|
Yeah, the rules have been made tighter in .NET 2.0. This[^] article explains the right way to do it, along with the reason why.
Regards
Senthil
_____________________________
My Blog | My Articles | WinMacro
|
|
|
|
|
Hello,
I made a small socket listener with C#, which listens for incomming connection requests (TCP) and passes them to another thread which handles the communication via a Socket.
I can connect without problem to that application using a Client application I wrote in C++, however when I close the connection in the C++ application, the .NET socket gets in a loop receiving 0 byte data... Testing the Connected property on the Socket returns still true, meaning the .NET app didn't realise that the socket got disconnected. Is there something I overlooked???
If anyone knows what might be wrong please let me know...
Friendly Regards,
Davy
|
|
|
|
|
GDavy wrote: the .NET socket gets in a loop receiving 0 byte data.
According to MSDN[^] that is what the socket does :
If you are using a connection-oriented Socket, the Receive method will read as much data as is available, up to the size of the buffer. If the remote host shuts down the Socket connection with the Shutdown method, and all available data has been received, the Receive method will complete immediately and return zero bytes.
Regards
Senthil
_____________________________
My Blog | My Articles | WinMacro
|
|
|
|
|
Hi folks.,
now i have to develop the web browser in the single win form , i know the IE componant help to develop this application but i dont know that componant.
i know the web browser namespace added in framework 2.0, but i need the application in only framework 1.1. If any one done like this plz share with me.
advance thanks to you
best regards.
ranandbe
-- modified at 6:30 Friday 12th May, 2006
|
|
|
|
|
|
pls help me on "how to open a MS word doc in asp.net application"...
|
|
|
|