|
Are you talking about Database connections?
|
|
|
|
|
Dear i m asking about socket based client server
architecture.
|
|
|
|
|
When pdb file is generated ? Why it is generated while building a solution in Debug Mode ? Why is it not generated in Release Mode ? What is the difference between Debug Mode Build and Release Mode Build?
|
|
|
|
|
A PDB file - or Programming Database - contains symbols (method names, field names, class names, etc.) for your assemblies. They are useful for debugging - more so with native code where type metadata doesn't exist (meaning that there's no reflection functionality that can get class, method, field, and property names like in .NET). A full PDB file contains source information so that in debug builds you can get line numbers in exception stack traces.
By default, PDB files aren't generated for release (retail) builds but you can generate stripped PDB files (stripped means that source information is not included, which is what you typically would send out to customers). In Visual Studio in the Project properties, look for "Generate Debugging Information" in the build catagory.
Even Microsoft makes available stripped public symbols for free, which can be downloaded as a whole or downloaded when needed using a symbol server (preferred so you don't have to keep updating your local symbol store automatically after installing patches or service packs). See my blog entries at http://blogs.msdn.com/heaths/search.aspx?q=symbols&p=1[^] for details.
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Customer Product-lifecycle Experience
Microsoft
[My Articles] [My Blog]
|
|
|
|
|
Hi there,
I have a problem with the Active Directory part of the .Net framework.
In our AD setup we are allowed to read a set of variables for a user with an anonymous login. If you have a username and a password you can get a lot more information about the specific user.
This piece of code works fine for the anonymous access:
DirectoryEntry de = new DirectoryEntry(@"LDAP://servername/ou=People,o=company");<br />
DirectorySearcher ds = new DirectorySearcher(de);<br />
ds.Filter = @"(uid=username)";<br />
ds.SearchScope = SearchScope.Subtree;<br />
SearchResultCollection results = ds.FindAll();
I get the limited set of informations about the user. If I try with my logininformation
DirectoryEntry de = new DirectoryEntry(<br />
@"LDAP://servername/ou=People,o=company",<br />
@"cn=username,ou=SystemUsers,ou=Accounts,o=company",<br />
@"password",<br />
AuthenticationTypes.Secure);<br />
DirectorySearcher ds = new DirectorySearcher(de);<br />
ds.Filter = @"(uid=username)";<br />
ds.SearchScope = SearchScope.Subtree;<br />
SearchResultCollection results = ds.FindAll();
Then I just get a "Logon faliure: unknown user name or bad password".
One would then say that I have entered the wrong login information. But... When I use the exact same login information in the LDAP browser from Softerra (http://www.ldapadministrator.com/download/index.php) it works fine, and I get my extended details.
I'm
I have tried with several combinations in the AuthenticationTypes field, and I have googled the problem without success... Anyone have any ideas ?
Lasse Fabricius
|
|
|
|
|
Hi,
This a a request for some seriously urgent help please...
I have an application that needs to print a crystal report directly to a printer attached to a PC. The Print needs to be direct ie: the user is not presented with a preview or a print dialog box. The pc is standalone and not connected to any network.
Printing a crystal report directly to a printer is easy if the pc is networked because you can set the PrintOptions.PrinterName to the name of the printer as identified on the network. I need to know how to do the equivalent of this but by specifying the LPT port number. Does anyone know how to do this.
Here is my function where i set the print options
private void SetPrintOptions()<br />
{<br />
CrystalDecisions.CrystalReports.Engine.PrintOptions printOptions = crDocument.PrintOption; <br />
printOptions.PrinterName = CURRENT_PRINTER;<br />
printOptions.PaperOrientation = PaperOrientation.DefaultPaperOrientation;<br />
printOptions.PaperSize = PaperSize.PaperA4;<br />
printOptions.PrinterDuplex = PrinterDuplex.Default;<br />
printOptions.PaperSource = PaperSource.Auto;<br />
}
Any help will be greatly appreciated.
Craigo
** Vision - The ability to look further than your eyes can see
|
|
|
|
|
Have you considered just setting PrintOptions.PrinterName to an empty string (string.Empty , or just "") to use the default printer? In lieu of presenting the user with printer options this would provide a consistent user experience - print to the printer they selected as the default.
Based on the documentation it doesn't seem like you can refer to an LPT port.
If you want to find out the printer name on a specific LPT port, you could P/Invoke EnumPrinters http://msdn.microsoft.com/library/en-us/gdi/prntspol_9fjn.asp[^] and enumerate the printers till you find one installed on LPTx: (keeping in mind that a printer can be on more than one LPT port, so in that case a comma-delimited list is returned so be sure to parse that as well).
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Customer Product-lifecycle Experience
Microsoft
[My Articles] [My Blog]
|
|
|
|
|
Thanx for the quick reply Heath.
I can't use an empty string for the printer name because (and i should have mentioned this in my origional post) there are 2 printers connected to the PC and i have to print a separate report to each of them. The one printer has pre-printed stationary and the other is plain paper - so I have to implicitly send the report to the correct printer.
I will look at the EnumPrinters solution you have suggested. This may sound like a really stupid question but do all printers that are connected to a PC have a name, even if it is not on a network?
Thanx again for your help.
Cheers
Craigo
|
|
|
|
|
FWIW - though it may not be relevant to your problem - multi-tray printers will (or, at least, should) select the right tray based on the media in the tray.
Craig G Fraser wrote: This may sound like a really stupid question but do all printers that are connected to a PC have a name, even if it is not on a network?
Yes they do. Open your "Printers and Faxes" folder (or the equivalent on whatever OS you're running) and you'll see all the various names. These are the names of the printers as should be specified in PrintOptions.PrinterName . If the printers on the various machines (or just a single machine) are all the same and you require such a constraint, you could fix the printer names or, better yet, make them configurable in the application configuration file (yourexe.exe.config in the same folder as yourexe.exe). This way if a machine for some reason must use a different name you can configure it per-application/per-machine.
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Customer Product-lifecycle Experience
Microsoft
[My Articles] [My Blog]
|
|
|
|
|
Excellent..that sounds like the answer. In my app i had the LPT ports configurable in my app.config so i'll just change this to hold the printer name instead as you have suggested.
Heath Stewart wrote: If you want to find out the printer name on a specific LPT port, you could P/Invoke EnumPrinters http://msdn.microsoft.com/library/en-us/gdi/prntspol_9fjn.asp[^] and enumerate the printers till you find one installed on LPTx: (keeping in mind that a printer can be on more than one LPT port, so in that case a comma-delimited list is returned so be sure to parse that as well).
Any chane you point me to some sample code that retrieves the printer names as mentioned above...I had a look at the link you sent but i'm afraid having not worked in this area a lot, it doesnt really make too much sense to me.
Craigo
|
|
|
|
|
PInvoke.net[^] is an excellent resources for finding P/Invoke signatures. I myself add some new signatures from time to time.
Specifically, you can find this one at http://pinvoke.net/default.aspx/winspool/EnumPrinters.html[^]. I haven't tested it but there is a sample so hopefully this will get you started.
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Customer Product-lifecycle Experience
Microsoft
[My Articles] [My Blog]
|
|
|
|
|
Hi Heath,
Thanx for the info....had a look and boy that stuff is really confusing for me....Havent worked with calls to unmaganged code before so struggling to get my head around it and how to implement it in my code. I have managed to sort out the problem by creating a class using System.Management functionality.....Not sure if this is the best way but it works so will do for now....Does my class below look ok or do you tink it will cause problems ?
You really helped me to solve this so thanx a million...it really is appreciated..
Cheers
Craig
using System;<br />
using System.Management;<br />
using System.Collections;<br />
<br />
namespace VTG.Functions<br />
{<br />
public class PrintFunctions<br />
{<br />
public struct PrinterInfo<br />
{<br />
public string sPrinterName;<br />
public bool bShared;<br />
public string sSharedName;<br />
public string sServerName;<br />
public string sPortName;<br />
public bool bDefaultPrinter;<br />
}<br />
<br />
public static PrinterInfo[] GetPrintersCollection()<br />
{<br />
PrinterInfo[] pi = new PrinterInfo[10];<br />
string searchQuery = "SELECT * FROM Win32_Printer";<br />
ManagementObjectSearcher searchPrinters = <br />
new ManagementObjectSearcher(searchQuery);<br />
ManagementObjectCollection printerCollection = searchPrinters.Get();<br />
int iPrinterIndex=0;<br />
foreach(ManagementObject printer in printerCollection)<br />
{<br />
pi[iPrinterIndex].sPrinterName=printer.Properties["Name"].Value.ToString();<br />
pi[iPrinterIndex].bShared=Convert.ToBoolean(printer.Properties["Shared"].Value);<br />
if (pi[iPrinterIndex].bShared==true)<br />
{<br />
pi[iPrinterIndex].sSharedName=printer.Properties["ShareName"].Value.ToString();<br />
pi[iPrinterIndex].sServerName=printer.Properties["ServerName"].Value.ToString();<br />
}<br />
pi[iPrinterIndex].sPortName=printer.Properties["PortName"].Value.ToString();<br />
pi[iPrinterIndex].bDefaultPrinter=Convert.ToBoolean(printer.Properties["Default"].Value);<br />
<br />
iPrinterIndex++;<br />
}<br />
return pi;<br />
}<br />
}<br />
}
|
|
|
|
|
Hi All!
Can we draw manually with the Graphics Class on a Form?
If not how can i draw borders, can i use the GroupBox Object?
or how can i impliment in a TextBox a border, i mean if i inherite TextBox Class to my Class how can i add that f points from the left will appear fat black line?
Thanks!!
|
|
|
|
|
You can draw on your form a couple of different ways, like calling Control.CreateGraphics on your Form derivative class and drawing using the Graphics object, but as soon as something covers up your drawing it's not repainted automatically.
For that reason, override OnPaint :
public class MyForm : Form
{
protected override void OnPaint(PaintEventArgs e)
{
base.OnPaint(e);
Graphics g = e.Graphics;
g.DrawLine(...);
}
} Most controls provided by the .NET Framework you can't simply draw differently; they actually encapsulate Windows Common Controls (the TextBox encapsulates the native Edit control, for example) and are drawn by the system with only some input as to how the controls are displayed. No, in .NET 2.0 you can use - for newer controls like WinBars (the new tool and menu strips) - painting adapters that lets you determine how controls are drawn.
You can also draw certain parts of controls (called "owner drawing") in the .NET Framework, like drawing shading for sorted columns in a ListView or adding icons to column headers. There are many, many articles here on Code Project about that. Browse the catagories or do a searching using the text box under the logo of every page.
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Customer Product-lifecycle Experience
Microsoft
[My Articles] [My Blog]
|
|
|
|
|
Hello, I have completed a compression program however I have the following problem:
For a certain file, when I compress it, and then decompress it running the program, the decompressed file is missing all "n" letters. I thought it was a programming error until I ran my program in debug mode and it decompressed correctly. I do not understand why my code works perfectly in debug, but doesn't write n's running normally for that one file. Is there a reason for this?
I love to program!
|
|
|
|
|
Without knowing exactly how your code works, an idea right off the top of my head would be: Are the n's represented in a string as "\n" and therefore being translated into carriage returns?
This wouldn't explain why it only does it in release mode, though.
|
|
|
|
|
Hi guys,
I'm a newbee to programming.
I have a project coming on which involves many modules. The problem is the first module is created in C#. The others are developed in VB.NET. How can I integrate them all together at the final phase as one project?
Also how do I make that the different modules can talk to each other? For instance the C# module program might be able to invoke the VB.NET module program.
Can I add in the different modules in Visual Studio and compile them easily at the later stage?
Any advice?
Thanks.
|
|
|
|
|
It's easy. Create one class library (DLL) project with all the C# code and the windows application (EXE) with all the VB.NET code, and make the EXE depend on the DLL. You can then call the code written in another language as if it were written in the same language. .NET makes this very easy.
-- LuisR
Luis Alonso Ramos
Intelectix - Chihuahua, Mexico
Not much here: My CP Blog!
The amount of sleep the average person needs is five more minutes. -- Vikram A Punathambekar, Aug. 11, 2005
|
|
|
|
|
Hello
I'm trying to use a MaskedTextBox but I'm having an unusual problem.
I set the Mask property on the Properties Window to support anyone of the templates (Data Validation, Hour Validation, etc...), after that, I execute the debug to test the whole Control (UserControl), then the problem appears: Any value that I type on the MaskedTextBox is written on another TextBox as I had typed on it ! Why is this happening ?!
When I remove the mask property from the MaskedTextBox control it works as a normal TextBox, writting the text on itself as it was supposed to be even with the Mask property set, but with the Mask property set it writes on any other TextBox avaliable on the Control I'm developing.
I'm using:
Microsoft Visual C# 2005 55603-000-0000016-00101
Microsoft Visual C# 2005
But I don't think that the problem is being caused by the VStudio version since I downloaded a tutorial about MaskedTextBoxes and it works perfectly here, but when I try to implement it (also copy) the tutorial's MaskedTextBox to my Control it "stops working". It seems to be a conflict... but as I don't receive any error or warning messages from the compiler I got confused.
I was testing right now and I detected that If the MaskedTextBox is the only thing on the Control it works perfectly but If I add only one or more TextBoxes the MaskedTextBox will write on any of them instead of filling itself with what I type. Any idea ?
Thank you.
-- modified at 23:59 Wednesday 9th November, 2005
|
|
|
|
|
Please share out relevant code so that we can help diagnose the problem.
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Customer Product-lifecycle Experience
Microsoft
[My Articles] [My Blog]
|
|
|
|
|
Hi,
I am storing a photo in an image format in SQL Server 2000.
I am able to retrieve the stored photo in the code behind without mentioning the physical path location of the photo. But i need to show the retrieved photo in thumbnail.
Image controls in .net requires the physical path of the photo.
So, how can i do that?
Regards,
Syed.
|
|
|
|
|
Image classes do not require a physical path to an image. You can write it into a MemoryStream , for example, from SQL Server then use the Bitmap constructor that accepts a Stream . It will determine the image format based on encoding information in the image (for supported image types and assuming there are no errors in the encoded information). Then you can assign this Bitmap instance to PictureBox.Image , for example.
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Customer Product-lifecycle Experience
Microsoft
[My Articles] [My Blog]
|
|
|
|
|
I am displaying images from a camera continuously in a PictureBox, it works fine, but when I minimize the window and restore again, it shows a cross symbol in picture box, as well as it throws argument exception, System.paint.getWidth(), etc,
Please help, should I draw inside paint method or so, but I use Thread method to draw directly...
Thanks in advance
|
|
|
|
|
All interaction with a control should be done on the thread on which the control was created. The Control.InvokeRequired property and the Control.Invoke method are for this very thing. You could load the image in a separate thread, but when you assign the image to a PictureBox , for example, you should do it in the control's owner thread:
void AssignImage(Image img)
{
if (!pictureBox1.InvokeRequired)
{
pictureBox1.Image = img;
}
else
{
MethodInfo setMethod = pictureBox1.GetType().GetProperty("Image").GetSetMethod();
MethodInfoInvokeHandler d = new MethodInfoInvokeHandler(setMethod.Invoke);
pictureBox1.Invoke(d, new object[] {pictureBox1, new object[] {img}});
}
}
delegate object MethodInfoInvokeHandler(object obj, object[] parameters); Interacting with a control from a different thread causes unusual problems that differ from control to control and even between properties and methods for a single control.
I'm not 100% sure this is the problem you're seeing but it's one possibility.
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Customer Product-lifecycle Experience
Microsoft
[My Articles] [My Blog]
|
|
|
|
|
What Heath said is probably what is happening, but you can also get those errors if you Dispose the image before the PictureBox gets a chance to draw it.
Regards
Senthil
_____________________________
My Blog | My Articles | WinMacro
|
|
|
|