|
Use (sn=*123*) . I know 123* would be a valid filter in AD; I assume *123* would work as well.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
I gave it a shot. The upside, it didnt generate any errors. The downside, with the * in place, it also doesnt return anything on the searches.
Yes, I am the highly suggestable type.
|
|
|
|
|
Try it without the preceeding asterisk and keep the trailing asterisk. I have a couple Exchange policy filters that use this notation to filter users and groups and it seems to work fine (it uses Active Directory). If not, I don't know what to tell you. I guess search the Active Directory documentation on MSDN[^] and see if there's anything in there about it.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
You, sir, are a saint. It worked perfectly ;)
Yes, I am the highly suggestable type.
|
|
|
|
|
Hello people, how are you?
Does anybody knows how can I hide a tabPage in a TabControl?
For exemplo:
tabControl1.TabPage[1].Visible = false;
If anybody could help me, I would be glad...
thanks
André.
|
|
|
|
|
Just remove it - it doesn't mean you have to dispose of it:
tabControl1.TabPages.RemoveAt(1); Later, you can "show" it again by inserting it back in:
tabControl1.TabPages.Insert(1, tabPage2);
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
I have a C# dialog app, and haven't realized until now that I want to translate it that some of the auto generated *.resx files aren't compiled into the output. (!) I haver verified the build type for them, I have looked into the .csproj file and found nothing unusual.
I have also tried compiling the resx file with the resource compiler which worked right.
I would need help on this, or I can't proceed with my project.
Thanks in advance.
|
|
|
|
|
Found the problem! (after several hours)
The problem was that I had a namespace included in "the wrong place".
Basically, I had a little util class in a different namespace in the dialog file. Therefore the compiled resource would be named after the util class, which was topmost in my source file. (!!) So to solve the problem, I only had to move this little bugger to the bottom of the .cs file.
Ugly! design of Visual Studio I'd say.
|
|
|
|
|
It has nothing to do with VS.NET. If you instantiate a ResourceManager using the constructor that takes a Type , the namespace and class name are used to resource the .resources file. The is how the .NET Framework works and is documented. If you move classes or organize your files incorrectly in your project in VS.NET, this would be an issue that you've created.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Heath Stewart wrote:
It has nothing to do with VS.NET. If you instantiate a ResourceManager using the constructor that takes a Type, the namespace and class name are used to resource the .resources file. The is how the .NET Framework works and is documented.
IMO its VS.NET inserting namespaces et all into resource names that are "incorrect" behaviour. Adding a resource via command line will not prepend anything to the filename.
top secret
|
|
|
|
|
Well, IMO its VS.NET doing what IDEs are typically for - making the life of coders easily. If you organize your projects into "folders", the default namespace of a source file uses that prepended with the default namespace configured in the project. If you add ResX files to that, the same thing happens, keeping with consistent behavior. This is especially important when adding ResX files to be scoped with the fully-qualified class name.
If you don't want VS.NET doing things for you - or any IDE for that matter - use the command-line tools. I typically do when I need something quick and don't want VS.NET automating tasks such as this.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Heath Stewart wrote:
If you don't want VS.NET doing things for you
Being able to disable this behaviour would be nice...
top secret
|
|
|
|
|
I'd like to get all of the available "Save As" formats for my installation of Word...I've tried a couple approaches with overlapping results...
foreach(Word.FileConverter FileCon in WordObj.FileConverters)
{
if(FileCon.CanSave)
cbConvertFormat.Items.Add(FileCon.FormatName);
}
The above code gives the mode formats but it does not include HTML,RTF, Word etc...
Anyone have a way to get a complete list of converters available?
|
|
|
|
|
I would assume those "converters" are built into Word itself and are not pluggable converters, especially the Document saving capability. I mean, what good is Word if it can't save Word Documents? And with all the HTML capabilities they've added with 2000 and up, it would be no surprise that it's all part of the base functionality, especially since the automation model supports a lot of HTML-related methods and properties.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
I have a windows service that polls an "email" message queue. The queue contains serialized email and attachments objects. If a message is in the queue, it is read, deserialized and placed into a MailMessage and sent through the SMTP Service.
To do this, I use a ThreadPool to spawn n threads every n seconds. I employ extensive logging and error catching throughout. If an error occurs, a timeout receiving a response, for example it is logged and processing continues. This all works great, sends 1000's of messages until...
a certain type of error occurs, namely when the smtp server cannot be reached for whatever reason. This error for some reason causes the ThreadPool loop to terminate. Below is the code. If anyone can see why the loop would terminate, please advise.
public void StartListening()
{
_QueryStopEvent = new ManualResetEvent(false);
_StopCompletedEvent = new ManualResetEvent(false);
_Constants.BaseKey = "EmailQueue";
_PollTime = 200000;
_TimeOut = 5000;
_Threads = 5;
_Host = www.smtphost.com;
_Port = 25;
_LogPath = "C:\LogFiles\";
_StopCompletedEvent.Reset();
do
{
AutoResetEvent[] aCompletedEvents = new AutoResetEvent[_Threads];
for (int i = 0; i < _Threads; i++)
{
aCompletedEvents[i] = new AutoResetEvent(false);
EmailGenerator oGen = new EmailGenerator(_Host, _Port, aCompletedEvents[i], i, _BaseKey);
oGen.Start();
Thread.Sleep(1);
}
WaitHandle.WaitAll(aCompletedEvents, _TimeOut, false);
}
while (_QueryStopEvent.WaitOne(_PollTime, false) == false);
_StopCompletedEvent.Set();
}
|
|
|
|
|
I can set my Parent Window for my C# windows application using the unmanaged Windows API SetWindowLong function. But I am trying to avoid all unmanaged code. If I set my form's property TopMost = true; then I can obscure any Modal dialogs my "desired" Parent Window pops up and get into a locked up circumstance, because the user can't respond to the Modal dialog. If I leave TopMost = false;, then I am all or partially obscured by my "desired" Parent Window.
|
|
|
|
|
The SetWindowLong function documentation specifically warns against using it to set the parent of a child window. Use SetParent instead.
What are you attempting to do anyway?
RageInTheMachine9532
|
|
|
|
|
Then why not just set a control's Parent property? That's why it's there as a read/write property. Assigning it removes the control from its current parent's ControlCollection and adds it to the new parent's ControlCollection (the Controls property).
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Hi,
I am trying to make a C# web application witch will POST an xml message to a Cisco IP phone. If I create a webpage with a text editor with the following code, it works when I open it in my browser.
<CiscoIPPhoneExecute>
<ExecuteItem Priority="0" URL="http://10.1.1.15/ciscoipservices/clock/clock.asp"/>
</ciscoipphoneexecute>
Does anyone know how I can put this into C# code and send it with a webform button? Im new to C# but im sure this could be done somehow. Thanks in advance.
|
|
|
|
|
Yikes, My XML did not show up between the text area tags!
Here is what it should be
CiscoIPPhoneExecute>
ExecuteItem Priority="0" URL="http://10.1.1.15/ciscoipservices/clock/clock.asp"/>
/CiscoIPPhoneExecute>
|
|
|
|
|
What exactly are you trying to do? If you want to use a page to post this to your phone, then you've already done it. If you just want to send that XML fragment to your phone without a web page, use the HttpWebRequest class. See the class documentation for a good example of how to POST data to the requested URL (open a request stream and write encoded data to it).
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Heath,
Thanks for the reply. To answer your question, I am wanting to send this xml fragment to the phone without a webpage. The HttpWebRequest seems to be exactly what im looking for. Thanks! The only part I am not following from the class documentation is the Content type. Here is my code:
try
{
// Create and get a request to the phone
WebRequest req = WebRequest.Create("http://10.5.1.168/CGI/Execute");
req.GetRequestStream();
// Set the 'Method' property of the 'Webrequest' to 'POST'.
req.Method="POST";
// Data to be posted
string postData = "<CiscoIPPhoneExecute>\r\n<ExecuteItem Priority"
+"=\"0\" URL=\"http://10.1.1.15/ciscoipservices/clock/clock.asp\"/>\r\n"
+"</CiscoIPPhoneExecute>\r\n";
// Set the encoding for the data to be sent
ASCIIEncoding encoding=new ASCIIEncoding();
// Put the encoded bytes into a Byte Array
byte[] send = encoding.GetBytes(postData);
req.ContentType = "text/xml";
// Set the content length of the string being posted.
req.ContentLength=send.Length;
// Create an output stream
Stream sout = req.GetRequestStream();
// Write to the stream
sout.Write(send, 0, send.Length);
// Close the Stream object.
sout.Close();
Response.Write("It worked");
}
catch( Exception ex)
{
string except = ex.Message;
Response.Write("It failed and threw "+except);
}
When I trigger this function I get the exception: "Cannot send a content-body with this verb-type." Any ideas on what I am doing wrong? Many thanks in advance.
|
|
|
|
|
Don't make that first call to GetRequestStream if you're not going to do anything with it.
The Content-Type is the type of content in the body. Even though you're clearly using text/xml, the phone CGI may be expecting something different, like application/vnd.motorola+xml (completely made up as an example). You need to look at the SDK (if any) for your phone and determine what content-type to send using the HTTP POST method.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Hey,
I wonder wether there is a way (using ColumnStyles, e.g.) to set the back color of the current cell in a datgrid into some value..
Thanks!
|
|
|
|
|
Yes, but you'll need to extend the DataGridColumnStyle - or the DataGridTextBoxColumn and DataGridBoolColumn to avoid implementing all their functionality - and add a BackColor (for example - could be named whatever you want) property. In the override for Edit , set the BackColor and then call base.Edit . The the overrides for Abort and Commit , reset the BackColor to the default and again call the method on the base class. In the Paint override, use the provided Graphics object to paint the background using the BackColor value on your class then call base.Paint .
See Changing the background color of cells in a DataGrid[^] for an example of conditional painting like this.
Microsoft MVP, Visual C#
My Articles
|
|
|
|