.net zip equivalent of jar in Java
Dear All,
Is there a .net zip equivalent of jar in Java? I would like to
compression my dlls while sending it across via No Touch...it should
also take care of versioning...
Thanks & Regards
Jack Tag: Who can tell me how to monitor printer by C# Tag: 75556
LoadFrom and gzip
Dear All,
I have a stub program on my client...Can I use the gzip
functionality along with No Touch? I am loading assemblies using
assembly.LoadForm method...If I set the HTTPCompression to true in
IIS...does it work with
Assembly.LoadForm("http://localhost/Smart/bin/Startup.dll")...how do I
test if http compression is working?
Please help...
TALIA
Many Regards
Jack Tag: Who can tell me how to monitor printer by C# Tag: 75554
Converting an XML documentation file to a help file
Hi all,
This may seem like an obvious question.
How do I convert the XML documentation file that the C# compiler emits from
my XML comments into a help file for the Microsoft Document Explorer?
Is there a tool program or something that I am missing? I cannot find
anything in any of the documentation.
Regards,
Chris Tag: Who can tell me how to monitor printer by C# Tag: 75541
Threading and raising events
hello,
I'm using C# and having a little thread communication problem :
-one thread (and its associated object) receives UDP packets using the
UdpClient class
-another object (say Object2) needs to raise an event from another thread
when a packet is received.
-as Object2 *could* be sitting on the main thread, it cannot be blocked
waiting on the "UdpThread"
-Object2 is not a System.Window.Forms.Control
-I'd rather avoid polling some synchronized variable.
in the good old win32 times, i would have allocated a window handle in
Object2's thread and
used PostMessage from the UdpThread.=> no polling and no locking...
Any advice on what should be done to remain in the .NET spirit while
achieving such goals ?
thanks in advance
Sacha De Vos Tag: Who can tell me how to monitor printer by C# Tag: 75538
Responding to global keyboard shortcuts
Hi!
I have developed an app, which normally resides in the tray and does stuff
in the background. I would like to make it possible to press a keyboard
shortcut from anywhere in windows/applications and respond to that event.
I have searched high and low on the web, but I guess I do not know excatly
what to look for. :)
Could someone please point me in the direction of an answer? :)
- Klaus Jensen Tag: Who can tell me how to monitor printer by C# Tag: 75537
how to get the source file reference data from the clipboard in .Net
Hello,
I am familiar with obtaining source file reference material from the system
clipboard using the old Win32 API.
For example, copy an Excel chart onto the clipboard and goto Word. Under,
Edit & PasteSpecial, there is a label called "Source:" which will contain
the file path, etc.
How can one obtain the source file reference material utilizing .Net
technology?
Thanks & Regards,
TC Tag: Who can tell me how to monitor printer by C# Tag: 75533
HideEditBox in a DataGrid. Please Help.
Hi All,
Has anyone out there used HideEditBox, successfully? I am writing
developing in VB .NET (VS .NET 2002) for the desktop. I have a datagrid
which is ReadOnly. When you click in a cell, the text edit box appears
which looks bad and distracts the user, AND it captures DoubleClick which I
want to handle at the DataGrid level. I have set up a TableStyle and
GridColumnStyles - all ReadOnly. I have created a new class for the
columns, which inherits DataGridTextBoxColumn, and have called HideEditBox
in the constructor. It does absolutely nothing. Here is the class:
Public Class DataGridPassiveColumn
Inherits DataGridTextBoxColumn
Public Sub New()
Me.HideEditBox()
Me.Alignment = HorizontalAlignment.Right
End Sub
End Class
... I put the Alignment in there just to get some feedback so I know my
class is working (I have to admit I'm new at this). The Alignment works,
the HideEditBox does not.
Can alybody help? I would appreciate it vey much.
Randall Smallwood. Tag: Who can tell me how to monitor printer by C# Tag: 75530
FILE I/O
How do you delete some data from a file? The file size should shrink.
How do you insert data at a specific offset without overwriting?
Something like this:
xy xaabcy
01 012345
--
Using Opera's revolutionary e-mail client: http://www.opera.com/m2/ Tag: Who can tell me how to monitor printer by C# Tag: 75511
Process.GetProcesses(remoteMachineName)
Hi all,
I want to get the list of active/running processes on some remote machines
in the same LAN my application run.
I always get a System.InvalidOperationExpection exception with the message
of "Couldn't get process information from remote machine".
I run my application under the administrator user account.
Do you know where I am wrong? Tag: Who can tell me how to monitor printer by C# Tag: 75510
Client/Server
I need to write an application (Server) that listen to a specific port, and receives and processes all requests that come from multiple machines (clients) at the same time. My question is; where can I start? Are there any examples that can help me?
Thanks in advanc Tag: Who can tell me how to monitor printer by C# Tag: 75507
decimal.ToString behaviour
I have come across a behaviour with the decimal.ToString method which i didn't expect, if i run the following console ap
using System
public class Ap
public static void Main(string[] args
decimal _decValue
foreach(string _arg in args
_decValue = decimal.Parse(_arg);
Console.WriteLine(_decValue.ToString())
with the following arg
1 1.00 1.000
I will get output as follow
1
1.00
1.000
I would have expecte
Can't see anything in the SDK explaining this. If anyone knows why this is so i would appreciate a pointer
Thanks in advanc
Pa Tag: Who can tell me how to monitor printer by C# Tag: 75500
TCPListener and Windows service
Hi All
I have a scenario
The server can dial into the client for several task
1. To fetch several rows from 2 or 3 tables - I plan to zip the files and send it across the network; to increase performance, instead of row-by-row update on the serve
2. To execute a remote application on the client and fetch data returned by the client application to the serve
3. To transfer some files to the client which would be either stored on the client's hard disk, or execute an application and pass the file to the remote applicatio
4. To update sql data on the client databas
My initial design was to make four TCPlistener exes listening to 4 ports and appropriately make the listeners to the appropriate jobs depending on the port that receives data
Is it possible for me to have just one windows service to be running on the client, and depending on the parameter sent from the server, do one of the four options stated above
Please advise
Thanks Tag: Who can tell me how to monitor printer by C# Tag: 75498
Framework SDK version
Can anyone tell me if the .NET Framework version 1.1 SDK will work with
Visual Studio .NET 2002 (as opposed to 2003). Or at least tell me where I
can find information on which versions of the SDK are compatible with which
versions of Visual Studio.
Thanks. Tag: Who can tell me how to monitor printer by C# Tag: 75494
Urgent: how to call a web service through a thirdly authenticated web page??
hi all,
We've been facing a difficult task that we need some wise advices
from other professional indeed.
Our client want before calling the webservice from 1 webserver, for
instance A, we must go through an authenticated web page on webserver
B which requires to input user name, password, then if valid, that
webpage auto redirect to our web service.
More in detail:
we need call http://A/WebService/WebService.asmx
it jumps to http://B/authentication/authentication, a HTML page here
for inputting user name, password. Then if OK, it redirect to our
webservice. We've checked by IE already.
So, the problem is how can we fulfill this task???
Any help would be very appreciated.
Khanh Tag: Who can tell me how to monitor printer by C# Tag: 75491
PerformanceCounter & PerformanceCounterCategory on Windows 2003
We are trying to create a custom performance counter and category in .Net 1.1 with Windows 2003 and XP as our operating systems. We use the following code to do this
if (PerformanceCounterCategory.Exists(categoryName)
PerformanceCounterCategory.Delete(categoryName)
CounterCreationData ccd = new CounterCreationData(counterName, counterHelp, PerformanceCounterType.RateOfCountsPerSecond32)
CounterCreationDataCollection ccdc = new CounterCreationDataCollection()
ccdc.Add(ccd)
PerformanceCounterCategory perfCategory = PerformanceCounterCategory.Create(categoryName, categoryHelp, ccdc)
OurLibrary.Error.AssertThrow(perfCategory.CounterExists(counterName), String.Format("Expected \"{0}\" counter to exist.", counterName))
PerformanceCounter counter = new PerformanceCounter(categoryName, counterName, false)
We get a "Category does not exist" InvalidOperationException when we assert that the counter exists. perfCategory != null at this time. The PerformanceCounterCategory.Create does NOT throw. We have tried many permutations of calls to try to get this to work, but it always throws. The odd thing is that the category and counter are actually created in the perfmon utility. We can see them from .net too, but not in the process that created them. We have tried this same code on Windows 2000 boxes and it works correctly. What is the problem with the Windows 2003 and XP operating systems that cause this to fail? We have searched the newsgroups and have not seen any explanations and very few instances of this problem. Are we the only ones using the .net performance counters
Thanks
Frank Tag: Who can tell me how to monitor printer by C# Tag: 75487
Good sockets tutorial needed
Can anyone give me some links to tutorials on using sockets with .NET?
Here's my scenario: I'm writing a service in .NET. I want to be able to
create clients which can talk to the service to both get status information
from it and also make configuration changes. I figure a simple TCP
connection would be the easiest way to facilitate communication. I'm no
sockets guru in the first place or I'd try to muddle through it on my own
(which of course I may have to). Any pointers would be appreciated, and any
suggestions on a better way to set up program-program communication across
different machines would be welcomed. Tag: Who can tell me how to monitor printer by C# Tag: 75485
HOWTO: Add help file to .Net IDE
Gentlemen
I've developed a library that a good number of programmers are using. I've also now created a Help file that explains this library
Where could I find a white paper or article which would explain HOWTO add a third-party help such as mine so that it appears as a "Filtered by:" category within .Net Index, so that my programmers can reference this help right within .Net? Tag: Who can tell me how to monitor printer by C# Tag: 75482
IPC / Named pipes
This is a multi-part message in MIME format.
------=_NextPart_000_0020_01C43F4C.452B0C50
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
This is from the Stream help... Where is the IPC Pipe? I cannot find =
anything on this. Using sockets is TERRIBLE for this sort of thing. We =
have an app that keeps running out of socket handles because they are in =
the TIME_WAIT. Why doesn't the framework recycle those? FreeBSD and =
other Unix's will force recycle TIME_WAIT's when the system gets under =
load and runs out. This seems like a really easy way for someone to DOS =
attack a windows box.
FROM THE HELP:
Stream is the abstract base class of all streams. A stream is an =
abstraction of a sequence of bytes, such as a file, an input/output =
device, an inter-process communication pipe, or a TCP/IP socket. The =
Stream class and its derived classes provide a generic view of these =
different types of input and output, isolating the programmer from the =
specific details of the operating system and the underlying devices.
------=_NextPart_000_0020_01C43F4C.452B0C50
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Diso-8859-1">
<META content=3D"MSHTML 6.00.2800.1400" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY>
<DIV>
<P><FONT face=3DArial size=3D2>This is from the Stream help... =
Where is the=20
IPC Pipe? I cannot find anything on this. Using sockets is =
TERRIBLE=20
for this sort of thing. We have an app that keeps running out of =
socket=20
handles because they are in the TIME_WAIT. Why doesn't the =
framework=20
recycle those? FreeBSD and other Unix's will force recycle =
TIME_WAIT's=20
when the system gets under load and runs out. This seems like a =
really=20
easy way for someone to DOS attack a windows box.</FONT></P>
<P><FONT face=3DArial size=3D2>FROM THE HELP:</FONT></P>
<P><FONT face=3DArial size=3D2>Stream is the abstract base class of all =
streams. A=20
stream is an abstraction of a sequence of bytes, such as a file, an =
input/output=20
device, an <FONT size=3D4><STRONG>inter-process communication=20
pipe,</STRONG></FONT> or a TCP/IP socket. The Stream class and its =
derived=20
classes provide a generic view of these different types of input and =
output,=20
isolating the programmer from the specific details of the operating =
system and=20
the underlying devices.</FONT></P></DIV></BODY></HTML>
------=_NextPart_000_0020_01C43F4C.452B0C50-- Tag: Who can tell me how to monitor printer by C# Tag: 75478
Runs Slow The First Time
I have an application that uses data access that runs slow the first
time. My first page reads data from an ODBC source and the second page
hits a MSDE database. After each page opens the first time, they run
just fine.
What should I do? I have all my code in ASPX pages right now, but I
would like to break it up in some code behind. Also, is this the
advantage in pre-compiling data access classes (like in a dll or is
there an easier way)? Help appreciated. Thanks.
Steve
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it! Tag: Who can tell me how to monitor printer by C# Tag: 75475
passing values between web forms usign session variables
any comments on this? I always use session variables to pass values
among web forms. That is if I get a username, password in a Login
form, then I pass these to the subsequent Search form as session
variables. The search form needs to know who login to display the
appropriate data.........is this the most efficient way of doing this? Tag: Who can tell me how to monitor printer by C# Tag: 75474
Mutex Differences VB.NET & C#
Hi,
I've got the following C# code that works perfectly to prevent a 2nd
instance of my C# app:
bool bAppNotRunning = false;
Mutex MutApp = new Mutex(true, "MyC#AppMutex", out bAppNotRunning)
if(bAppNotRunning == true)
{
Run the app and do work...
MutApp.ReleaseMutex();
}
I did the same thing in another app that's in VB. NET to prevent a 2nd
instace of it:
Dim bAppNotRunning As Boolean
bAppNotRunning = False
MutApp = New Mutex(True, "MyVBAppMutex", bAppNotRunning)
If(bApNotRunning = True) Then
Run the app and do work...
MutApp.ReleaseMutex()
End If
Why doesn't the VB version work? bAppNotRunning comes back True from the
Mutex constructor even when another instance of the app is already running?!
What gives? Any ideas would be appreciated.
TIA,
--
John C. Bowman
Software Engineer
Thermo Electron Scientific Instruments Div.
<Remove this before reply> john.bowman@thermo.com Tag: Who can tell me how to monitor printer by C# Tag: 75466
RSACryptoServiceProvider constructor very slow under Win XP
I have a .NET app that uses the RSACryptoServiceProvider class to perform a
key exchange with a server. During testing we've found that on some Windows
XP machines, the call to the constructor for this class can take 15 or more
seconds! On our Win 2K and Win 98 test machines it always takes less than 3
seconds.
The problem's very easy to reproduce -- just create a console app with one
line of code in it:
RSACryptoServiceProvider p = new RSACryptoServiceProvider();
One most machines, this should run fairly quickly. On the afflicted
machined, it's very slow. I know that the key generation goes on during the
constructor, but 15 seconds...?!?! Also, as I said, this only affects SOME
XP machines -- we have others that work just as the Win 2K boxes.
To compare the XP machines that work fine to those that don't, we compared
the advapi32.dll versions/dates, but they were identical. Has anyone else
seen this issue or have any idea why XP would be so slow in generating
running this constructor?
Thanks for your help -
Ken Tag: Who can tell me how to monitor printer by C# Tag: 75465
Class Modifiers via Reflection
Is there a way to determine the access modifiers of a class type in an
assembly via reflection? I see that I can determine if the class is public
or non-public, but I would like to be able to further sub-divide the
non-public modifiers (assembly, family, familyAndAssembly, familyOrAssembly,
private). Is this possible with the .NET 1.1 Reflection API? And just to
clarify, I see I can get this info for nested classes, but I would like it
for non-nested classes too.
Thanks for any suggestions or pointers on this.
Kevin Tag: Who can tell me how to monitor printer by C# Tag: 75464
Config File for typefilterlevel change
Can someone look at this post and tell me what can i do please.I have been
waiting or 3 days now and still no answer.
http://www.codeguru.com/forum/showthread.php?s=&postid=950198#post950198 Tag: Who can tell me how to monitor printer by C# Tag: 75461
Scan Resource Files
Given a reference to an Assembly, is there any way to generically scan the
assembly for embedded resource files ?
And, given such a resource file, is there any way to loop through all the
entries in that resource file without knowing what the keys are ?
Any help gratefully appreciated. Tag: Who can tell me how to monitor printer by C# Tag: 75459
EventLog Category
I have an application that writes events to the Windows Event Log. I
created a log Source ID on the Application log. Everything seems to be
working fine except that all the events have the event category of Network.
I found the code for that by trial and error. I would like to add two new
event categories to make the event records more intuitive. I've spent a day
already trying to do this. Can you tell me how to add two new event
categories to my log records. For example if I have a log source ID of
"Gizmo" on the Application log, I would like to log events with new event
categories of Exception and Trace Data. Can you tell me how to do this?
Thanks for your help.
Best Regards,
Paul J. Lay Tag: Who can tell me how to monitor printer by C# Tag: 75456
how to change the font
Dear all,
How to change the font in the table grid?
Please go to the above link to see the problem
http://destiny.xfiles.to/ubbthreads/files/562767-1.jpg
THank you Tag: Who can tell me how to monitor printer by C# Tag: 75455
Non-modal Status Form
Hi --
I'm trying to write a modeless status form that other classes can call
and display information to the user while they're working.
The problem is that the controls aren't showing up correctly in the
status form when I call frm.Show(). They'll appear correctly if I use
frm.ShowDialog(), but I don't want a modal form.
I'm sure I'm missing something really basic here. What am I doing wrong?
TIA. Tag: Who can tell me how to monitor printer by C# Tag: 75454
Installation of Dotnet framework fails
Hello All,
I have same situation when I tried to install dotnet framework 1.1. The
installation failed.
My machine is a windows 2000 server , service pack 4 has been applied.
The error message is: Error 1935.An error occured during the installation of
assembly component
{10BC3EDB-1888-4FD8-99E6-36851AB725oC}.
HRESULT:-2147025891
Do any of of you encounter same problem?
Any advice or help is vry much appreciated.
Thank you
Hai Tag: Who can tell me how to monitor printer by C# Tag: 75452
How to invoke a method using the thread which created the object
Hello!
In my program I've made an STA thread which is running separately from the
main thread. The STA thread is instantiating some COM objects. Is it
possible, from the main thread, to invoke the COM object using the thread
which instantiated it? This situation compares quite much to the Invoke
method of the Windows Forms Control class. Do some of you know how to
achieve that?
Best regards,
Henrik Dahl Tag: Who can tell me how to monitor printer by C# Tag: 75448
DirectoryInfo / FileInfo
I am writing a file manager that uses DirectoryInfo / FileInfo
to obtain details about files and folders that are then shown in
a ListView.
During testing I have found that I can't delete some files or
folders because 'another process is using them'.
I ran Process Explorer (by Mark Russinovich
www.sysinternals.com) and it shows that my app seems to have a
massive number of files and folders open which is a bit
worrying.
Do DirectoryInfo / FileInfo actually open files? If so how do I
close them?
If not I'll need to look elsewhere in the app.
--
Jeff Gaines - Damerham Hampshire UK Tag: Who can tell me how to monitor printer by C# Tag: 75447
Custom ToolBar & Code generation
Hello,
I'm coding a custom toolbar from scratch. The toolbar class uses a collection to store the buttons.
Everything works fine except for this:
I add my custom toolbar to a form, add some buttons and delete the toolbar: In my code, the toolbar buttons don't get removed!
What went wrong?
This is my code:
[DesignTimeVisible(false)]
public class coolToolBarButton : Component
{
private Image m_Image;
[DefaultValue(null),
System.ComponentModel.RefreshProperties(RefreshProperties.Repaint)]
public Image Image
{
get { return m_Image; }
set
{
m_Image = value;
}
}
}
public class coolToolBarButtonCollection : CollectionBase
{
public int Add(coolToolBarButton Button)
{
return List.Add(Button);
}
public void AddRange(coolToolBarButton[] Buttons)
{
for(int i=0;i<Buttons.Length;++i)
List.Add(Buttons[i]);
}
public void Insert(int index,coolToolBarButton Button)
{
List.Insert(index, Button);
}
public void Remove(coolToolBarButton Button)
{
List.Remove(Button);
}
public bool Contains(coolToolBarButton Button)
{
return List.Contains(Button);
}
public int IndexOf(coolToolBarButton Button)
{
return List.IndexOf(Button);
}
public void CopyTo(coolToolBarButton[] array, int index)
{
List.CopyTo(array, index);
}
public coolToolBarButton this[int index]
{
get { return (coolToolBarButton)List[index]; }
set { List[index] = value; }
}
}
/// <summary>
/// Summary description for coolToolBar
/// </summary>
public class coolToolBar : System.Windows.Forms.Control
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.Container components = null;
private coolToolBarButtonCollection m_ButtonCollection;
[DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]
public coolToolBarButtonCollection Buttons
{
get { return m_ButtonCollection; }
set
{
m_ButtonCollection = value;
}
}
public coolToolBar()
{
// This call is required by the Windows.Forms Form Designer.
InitializeComponent();
m_ButtonCollection=new coolToolBarButtonCollection();
SetStyle(ControlStyles.DoubleBuffer |
ControlStyles.UserPaint |
ControlStyles.AllPaintingInWmPaint |
ControlStyles.ResizeRedraw |
ControlStyles.StandardDoubleClick |
ControlStyles.UserMouse |
ControlStyles.StandardClick |
ControlStyles.SupportsTransparentBackColor,
true);
}
/// <summary>
/// Clean up any resources being used.
/// </summary>
protected override void Dispose( bool disposing )
{
if( disposing )
{
if( components != null )
components.Dispose();
}
base.Dispose( disposing );
}
#region Component Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
components = new System.ComponentModel.Container();
}
#endregion
protected override void OnPaint(PaintEventArgs pe)
{
// TODO: Add custom paint code here
// Calling the base class OnPaint
base.OnPaint(pe);
}
} Tag: Who can tell me how to monitor printer by C# Tag: 75442
StreamWriter Adds FFFE at the start of the file with Unicode Encoding!!
Hi , all
I'm trying to write unicode to a file for another app (not developed with
vs2003) to read it. I used StreamWriter with unicode encoding.but I was
surprised that the streamwriter adds FFFE to the start of the file,which
stopes the other app from reading it!!
any idea how to stope it frome doing that,do I have to use another class
#####writer that supports unicode?
help me Please!
Thanks
majed
I did some code with diferent encoding and here is the result:
UTF7 48656C6C6F2B4143454149512D0D0A
Hello+ACEAIQ-..
DEFAULT 48656C6C6F21210D0A
Hello!!..
ASCII 48656C6C6F21210D0A
Hello!!..
BIGENDIANUNICODE FEFF00480065006C006C006F00210021000D000A
...H.e.l.l.o.!.!....
UNICODE FFFE480065006C006C006F00210021000D000A00
..H.e.l.l.o.!.!.....
UTF8 EFBBBF48656C6C6F21210D0A
...Hello!!..
and here is the code
Imports System
Imports System.Text
Imports System.IO
Class filestream
Public Shared Sub main()
Dim ASCIIStream As New StreamWriter("ASCIIStream.txt", False,
System.Text.Encoding.ASCII)
Dim BigEndianUnicodeStream As New StreamWriter("BigEndianUnicodeStream.txt",
False, System.Text.Encoding.BigEndianUnicode)
Dim UnicodeStream As New StreamWriter("UnicodeStream.txt", False,
System.Text.Encoding.Unicode)
Dim DefaultStream As New StreamWriter("DefaultStream.txt", False,
System.Text.Encoding.Default)
Dim UTF7Stream As New StreamWriter("UTF7Stream.txt", False,
System.Text.Encoding.UTF7)
Dim UTF8Stream As New StreamWriter("UTF8Stream.txt", False,
System.Text.Encoding.UTF8)
ASCIIStream.WriteLine("Hello!!")
ASCIIStream.Close()
ASCIIStream = Nothing
BigEndianUnicodeStream.WriteLine("Hello!!")
BigEndianUnicodeStream.Close()
BigEndianUnicodeStream = Nothing
UnicodeStream.WriteLine("Hello!!")
UnicodeStream.Close()
UnicodeStream = Nothing
DefaultStream.WriteLine("Hello!!")
DefaultStream.Close()
DefaultStream = Nothing
UTF7Stream.WriteLine("Hello!!")
UTF7Stream.Close()
UTF7Stream = Nothing
UTF8Stream.WriteLine("Hello!!")
UTF8Stream.Close()
UTF8Stream = Nothing
Console.WriteLine ("Done!)
End Sub
End Class Tag: Who can tell me how to monitor printer by C# Tag: 75429
Chicken and egg problem with FileIOPermission and Environment.GetFolderPath("My Documents")
Hello,
I am trying to assert a FileIOPermission to get access to the "My
Documents" folder. To do this, I am using this code:
FileIOPermission FilePathPerm = new
FileIOPermission(FileIOPermissionAccess.AllAccess,
Environment.GetFolderPath(Environment.SpecialFolder.Personal));
The problem I'm running into is that the code above throws a permissions
acception. GetFolderPath method requires FileIOPermission to the path is is
returning before it can return anything. So, it can't be used to return the
path permissions are being requested for.
So, how do I accomplish this task of requesting permissions for "My
Documents" when I don't know ahead of time what the full path to "My
Documents" is and I can't get access to it through the GetFolderPath method?
Is there an environment variable or something that would hold this value?
Thanks,
Phred Tag: Who can tell me how to monitor printer by C# Tag: 75426
Macro Question
Hello
I am writing a macro in Visual Studio .Net 2003, and I was wondering if it is possible for a macro to access properties of objects that are selected. For instance, assume I have the following object declared (on a different page, but it can still be instanciated)
Class rectangl
Private _height as doubl
Private _length as doubl
Public Property height(
Public Property width(
End Clas
Now, is there a way, using a macro, to take a name of an object type and then print the properties to the screen
For instance - the object name 'rectangle' would print out
'rectangle
Property: heigh
Property: weigh
I'm relatively new to this, and I suspect that if it could be done, it might be done using reflection, but I don't know how to approach it
Can anyone provide help in this matter
Thanks
Andrew Wied Tag: Who can tell me how to monitor printer by C# Tag: 75420
Wi-Fi / Access Points
Hello All, I have an application that will be connecting through an access
point. At times there may be multiple networks available. Is there a way I
can pragmatically force the application to drop one connection and connect
to a different only depending on the SSID? Tag: Who can tell me how to monitor printer by C# Tag: 75416
Select a Specific Row in DataGrid at Form Load Time
I have a DataGrid control in a Windows Form. At the time the form is
displayed, I would like to have a specific row (record) being selected and
highlighted. At form load time I can populate the data source of DataGrid
control. At what time (handler of which event) should I go through the
DataGrid control to locate the row and select specific record?
Thanks.
Jian Dai Tag: Who can tell me how to monitor printer by C# Tag: 75415
Security Policy, Code Groups and Security Tools.
Could someone who has active experience of assigning Security Policys please
clarify my follow comments...
Having gone through the MSDN documentation on this subject, my condensed
version of the way the security code permissions works is thus :-
1. An Assembly will be mapped to one or more Code Groups based upon the
membership conditions specified within each code group.
2. When an assembly belongs to multiple code groups, permissions assigned by
one code group can be overridden (increased) by permissions assigned by
another code group when they are both part of the same Policy level.
3. Code groups from a lower policy level cannot override (increase)
permissions set by an upper level (apart from when the permission hasnt yet
been set) *but* can reduce them.
4. The user policy level code groups cannot grant additional permissions to
an assembly *but* can only reduce them further.
5. When the Exclusive attribute is used on a code group, the code group will
become the only one within that policy level to apply permissions, although
the further policy levels code groups will be evaluated. When an application
belongs to more than one Exclusive code group it will not be run.
6. When the Level Final attribute is used on a code group, no other policy
levels code groups are evaluated *although* the current policy levels code
groups will.
7. When Level Final and Exclusive are used together then the codegroup on
that level will be the only one that will apply to the application through
all policy levels.
Couple of points.
a. Firstly is there any reason that the code groups are / can be nested,
from what I can see the answer is no -although I am assuming that it allows
for a more specific targetting of conditions.
b. Since the default Enterprise code group is All_Code -Full Trust and
changing it could effectly cause problems with the framework, I assume this
is left alone. Because this code group would override any additional code
groups within this policy, I am assuming that all Enterprise level code
groups should be marked as Exclusive.
c. Does Caspol utility expose any additional functionality than mscorcfg
utility (apart from the ability to do scripted config)?
Thanks in advance
--
Br,
Mark Broadbent
mcdba , mcse+i
============= Tag: Who can tell me how to monitor printer by C# Tag: 75409
Exception Handling and Loops
Hi,
I have a while loop where for each value I execute a database query. I
have a situation where one of these queries abort due to bad data. I want
the application to continue processing the loop for other values.
I have tired what I thought would do this but it still aborts the
application on error.
I have a Manager class that has the while loop that calls a Data class that
fromulates the parameters and the the right stored proc and that calls the
MS. Data Access application block to execute the query
The block of code in the manager class looks like this
SqlDataReader drIDs = GetInformation();
while (drIDs.Read())
{
int iId = drIDs.GetInt32(0);
try
{
GenerateReport(iId);
}
catch (Exception e)
{
throw;
continue;
}
}
The error I get is .Net SQL Client Data Provider. Subquery returned more
than one value. How do I skip the error and continue processing the loop for
other values.
TIA Tag: Who can tell me how to monitor printer by C# Tag: 75406
C Library Problem when using Managed Code
The following line of code does not work when using the /clr option
TCHAR *p = _tcsrchr(_T("Test\\String"), _T('\\'));
if(p==NULL)
AfxMessageBox(_T("Error"));
If I disable the /clr option, the message box "Error" is not shown. My
program is compiled to use the Unicode Charset and I have the macro UNICODE
define. If I change the code to use multibyte charset it works fine.
Does anyone know how to get this problem fixed? (CString ReverseFind has the
same problem).
Regards,
Lourenço. Tag: Who can tell me how to monitor printer by C# Tag: 75401
ERROR: COULD NOT FIND INSTALLABLE ISAM
When using ADO.NET with ASP.NET, here is my code to bring in a table from
EXCEL:
Dim sConnectionString As String = "Provider=Microsoft.Jet.OLEDB.4.0;" _
& "Data Source=C:\Inetpub\wwwroot\ExcelData.xls;" _
& "Extended Properties=Excel 11.0;"
When it tries to OPEN my connection, I receive the following error:
COULD NOT FIND INSTALLABLE ISAM!
PLEASE HELP! Tag: Who can tell me how to monitor printer by C# Tag: 75399
Connecting to existing remote project
Hello,
I have searched all over for the answer to this, to no avail. I have a web
project already set up and running on a remote server, that I created from
my home computer. I am now trying to connect to it from my work computer,
but cannot figure out how to set up the project.
Here are the various methods I've already tried:
1) When I try Open > Project From Web, I type in the URL, and then it
prompts me for a project to open, locally. The problem is, I don't have a
project set up locally -- that's what I'm trying to do.
2) When I try New > Project > Empty Web Project, I type in the URL (for
Location), it tells me "There is already a project created on the Web" --
which makes sense.
3) When I try New > Project > New Project In Existing Folder, I give it a
project name, then tell it the URL, then it tells me "Cannot create the
project. There is already a project with the name '/myproject.vbproj' on the
Web 'http://myproject.com'."
4) So, I tried copying the project files from the server to my local
machine, and then tried opening the project, or pointing the prompt from
method #1 (above) to the copied project file, but it then tells me "Unable
to open Web project '/'. The file path '<path to project file>' does not
correspond to the URL 'http://Localhost:'. The two need to map to the same
server location. HTTP Error 404: Object Not Found".
So I'm stumped. What the heck am I doing wrong, and why am I not finding
any info on this?
Please relieve me of my frustration -- I would be very much appreciative!
Thanks in advance. Tag: Who can tell me how to monitor printer by C# Tag: 75397
Enumerating a Distribution Group With > 1000 Members
I have run into an issue in which I can not fully enumerate the members of a
universal distribution group if the member ship is greater than a 1000
members. I can't find any blogs or help on this particular issue. Has anyone
run into a similar issue and how was it solved. Tag: Who can tell me how to monitor printer by C# Tag: 75396
Controlling MDIChild forms
Hi
I kind of a new programmer. I started a few wees ago with Visual Basic .NET and I'm trying to develop a simple (I think) application with an MDIForm and an MDIChild. Thus, I open the Child form and it works fine but, when I close, using the close button (X) on the upper-right corner of its window, I can´t mange to catch this event on the MDI Parent form, so I can redefine the MDI Form main menu again (show & hide some options)
Can someone tell me a way so that the MDI Parent form knows when its child form has been closed (with the close button on the upper-right)
Thank
Paulo Tag: Who can tell me how to monitor printer by C# Tag: 75394
Loosing reference to Thread
I need to have a thread run as long as it needs to, and not stop until it is cancelled by either closing the application or manually be stopped. It is simply pinging a machine to see what the connection speed is. The ping code is not the problem, as I have used it to get the speeds before, and it is solid
What happens is that after the thread has been running awhile, it just stops. I cannot stop it, but when I restart the thread, it is fine. I don't mind restarting the thread, but I want it to do it automatically. Is there some code that I can put in to detect if the thread has gone awry?
I have a button on the form that simply starts and stops the thread. If I leave the thread running too long, the code stops to work. When that happens, I stop the thread, and I get the 'Thread cannot be stopped' message box (see code below). Then I can restart the thread
I used the code samples that the MSDN has to make it work. Here is the code I have now
Public CancelThread As New System.Threading.ManualResetEvent(False
Public ThreadisCanceled As New System.Threading.ManualResetEvent(False
Private Sub SomeLongTask(
' Run code until CancelThread is set
While Not CancelThread.WaitOne(0, False)
' Do some kind of task here
System.Threading.Thread.Sleep(CSng(txtPingDelay.Text) * 1000) 'txtpingdelay = .
ThreadPing(
End Whil
If CancelThread.WaitOne(0, False) The
'Acknowledge that the ManualResetEvent CancelThread is set
ThreadisCanceled.Set(
End I
End Su
Public Sub StartTask(
' Starts a new thread
Dim th As New System.Threading.Thread(AddressOf SomeLongTask
CancelThread.Reset(
ThreadisCanceled.Reset(
th.Start(
End Su
Public Sub CancelTask(
' Stops any threads started by the StartTask procedure
' Notice that this thread both receives and sends
' synchronization events to coordiante the threads.
CancelThread.Set() ' Set CancelThread to ask the thread to stop
If ThreadisCanceled.WaitOne(4000, False) The
' Wait up to 4 seconds for the thread to
' acknowledge that it has stopped
Els
MsgBox("The thread could not be stopped."
End I
End Su
Private Sub ThreadPing(
Dim Sum As Int32 =
Dim myPinger As IDOTPing.Ping = New IDOTPing.Pin
Dim ret As Int3
If txtHost.Text.Length < 1 The
ret = myPinger.PingHost("localhost"
Els
ret = myPinger.PingHost(txtHost.Text
End I
PingAverage.Enqueue(ret
If PingAverage.Count > PingCount Then PingAverage.Dequeue(
Dim myEnum As IEnumerator = PingAverage.GetEnumerato
While myEnum.MoveNex
Sum = Sum + CLng(myEnum.Current
Console.WriteLine(myEnum.Current
End Whil
lblResult.Text = "Connection Speed: " & ret.ToString & " MS
Sum = Sum / PingAverage.Coun
Label2.Text = "Average for last " & PingAverage.Count & " pings: " & Sum & " MS
If Sum > pgPing.Maximum The
pgPing.Value = pgPing.Maximu
ElseIf Sum < 0 The
pgPing.Value =
Els
pgPing.Value = pgPing.Maximum - Su
End I
End Su
I hope someone can help me out. I have not had a lot of luck lately getting any help from this newsgroup. Kind of disappointing when you need the help
Brad Simon Tag: Who can tell me how to monitor printer by C# Tag: 75393
EventLog Source
I used the EventLog class to create an Event Source under the Application
log. That was a snap. In order to register custom event categories, it
appears that you need to know the guiid of the event source. Is that
correct? If so what is an easy way to determine the guid of the event
source? Please advise. Thanks for your help.
Best Regards,
Paul J. Lay Tag: Who can tell me how to monitor printer by C# Tag: 75389
Resource File Related
Hi,
I have .NET 2003 installed on windows 2003 server.
I have a resource file named as myresource.resource. I wanted to convert it
into a dll file. How can I do it?
Thanks for the help in advance.
--
Thanks & Regards,
Atul Shukla Tag: Who can tell me how to monitor printer by C# Tag: 75384
Passing active SessionID to a HttpWebRequest
Hello there....
I try to call a aspx file within an running asxp file. The key thing
is that I need to pass the active ASP.NET_SessionID to this new aspx
file via HttpWebRequest.GetResponse Method. Then I want to read the
whole thing with a stream object.
The weird thing happen at Line 9, after the timeout (1sec) is over.
ASP.NET throws an timeout exeption. Even when I set the timeout to 5
min, ASP is waiting always until a timeout expires
If I implement a Try/Catch at line 9, after the timeout my debugger
jumps to the new aspx file where I set a breakpoint. Also it uses the
same session ID :)
But the "objResponse" in line 9 is set to NOTHING and all the
following code fail because of that.
What do I have to do that the GetResponse Method works properly.
Thanks
Michael
********************My Code********************
1 Dim objResponse As HttpWebResponse
2 Dim objRequest As HttpWebRequest
3 Dim sr As StreamReader
4 Dim result As String
'**1 Create the Request object******************
5 objRequest = System.Net.HttpWebRequest.Create("http://localhost/aidsgame/test_result.aspx")
'***2 Add the container with the active sessionID***
6 objRequest.CookieContainer = New System.Net.CookieContainer(50)
7 objRequest.CookieContainer.Add(New
System.Uri("http://localhost/aidsgame"), New
System.Net.Cookie("ASP.NET_SessionId",
Request.Cookies("ASP.NET_SessionId").Value))
8 objRequest.Timeout = 1000
9 objResponse = objRequest.GetResponse() <---throws timeout
exeption
10 sr = New StreamReader(objResponse.GetResponseStream())
11 result = sr.ReadToEnd()
' Close and clean up the StreamReader
sr.Close()
******************************************** Tag: Who can tell me how to monitor printer by C# Tag: 75378
MDAC/ Dot.net clash
Hi,
I am having trouble getting an oledb provider to work in a dot.net page.
I get the message :
"The .Net Data OLE DB Provider(System.Data.OleDb) requires Microsoft Data
Access Components(MDAC) version 2.6 or later"
Running the component checker tells me i have MDAC 2.7 refresh installed but
a detailed analysis shows a few dll's and registry keys that refer to 2.5. I
guess I have a 2.5/2.7 hybrid that dot.net doesn't like.
I have tried reinstalling MDAC 2.7 but it still has the same discrepancies.
Should I try and install 2.5 then 2.7?
Please let me know if there is a more appropriate group to ask this on.
Cheers
--
http://www.flashgorman.com Tag: Who can tell me how to monitor printer by C# Tag: 75372
Event Log Setting
Hi
How to set the event log's overwrite property from vb.net
i.e, when v r writting errors in the event log continously, at one point of time the maximum size for that event log will be reached and if v try to write in to the event log it will throw an error message such as "event log is full"
but if set the overwrite property for that eventlog it will overwrite automatically without any error message
i want to set this property thrw vb.net codin
thnks and best regard
Jothi Mages Tag: Who can tell me how to monitor printer by C# Tag: 75367