|
|
Have you tried @".\Applog.txt"
I always do as Senthil suggested:
string fileSpec = string.Format("{0}{1}Applog.txt", Application.StartupPath, Path.DirectorySeparatorChar);
|
|
|
|
|
Hi
Please Help in this situation
I have created an application to draw a image that contains Rectangles and others as a images. I just add them in the Picture box. I have completed up to creating the images but the problem comes when i want to rotate the images using the mouse. Not by using the angles given to text boxes. We have to predict the mouse movements and then we have to find the angle of the rotation for that angle we have to rotate the object. Is there any specific algorithm for that. I just have the contrl to the picture box.
With Luv,
Arun R.
-- modified at 7:44 Thursday 10th November, 2005
|
|
|
|
|
Hi
Please Help in this situation
I have created an application to draw a image that contains Rectangles and others as a images. I just add them in the Picture box. I have completed up to creating the images but the problem comes when i want to rotate the images using the mouse. Not by using the angles given to text boxes. We have to predict the mouse movements and then we have to find the angle of the rotation for that angle we have to rotate the object. Is there any specific algorithm for that. I just have the contrl to the picture box.
With Luv,
Arun R.
|
|
|
|
|
Hi!
I'm using Measurement Studio 7.1.
I have the problem to get a rectangle into a graph which shows
measurement data.
This rectangle should be as scrollable and zoomable as the
graph but my rectangle i insert is fix on the screen.
e.Graphics.DrawRectangle(new Pen(Color.Turquoise,2),10,10,50,50);// works!!! but without scrolling and zooming
Hope you can help me.
M.Friedel
|
|
|
|
|
I want to delete Temporary Internet Files, Cookie, and History by using C#.
However, the sample etc. were not found though I searched the Internet.
Please teach when you have the sample and information.
|
|
|
|
|
hello
i tried getting my old project that deals with processes into the new shiny c# 2005 and when i try running i get access denied from the 'System Idle Process' Process object when i try pulling the data out of TotalMilliseconds value (it worked just fine in vs2003) anyone got a clue on how to fix this?
thanks Gil
|
|
|
|
|
Is it possible for a single client to have multiple connectiosn
with a single host?
if so how?
|
|
|
|
|
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.
|
|
|
|