|
niceguyeddie wrote:
Inconsistent accessibility: parameter type '..EnumType' is less accessible than method '..myMethod'
Your enum is private, but your method is public and you are using the EnumType on the parameter list.
Yes, even I am blogging now!
|
|
|
|
|
Hi,
I create an ImageList with some BMP file and create a PictureBox.
I would like to know how can I do for selecting an image from my list and put it on the Picturebox.
Best Regrads
youssef
|
|
|
|
|
pictureBox1.Image = imageList1.Images[3];
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Sustained Engineering
Microsoft
[My Articles] [My Blog]
|
|
|
|
|
|
I have a Application that has to connect via ras to other devices. For this I have imported some RasAPI32-functions (RasDial, RasHangup). When an error occured while connecting, a call of the rasdial function results in the error code 756 - Dial already in progress).
When i stop my application and restart it, i can connect again.
How can I 'reset' a connection that is blocked in this way?
Thanks
Roland
Wenn Du diesen Satz irgendwo liest, ignoriere ihn.
|
|
|
|
|
Roland Bär wrote:
How can I 'reset' a connection that is blocked in this way?
IIRC, you need to call RasHangup even when RasDial fails. But I may be wrong, I didn't work with RAS in the past few years.
Yes, even I am blogging now!
|
|
|
|
|
Thanks Daniel, your help saved me a lot of trouble!
Roland
Wenn Du diesen Satz irgendwo liest, ignoriere ihn.
|
|
|
|
|
Hello,
I have a windows service that updates the database. I installed it on the machine with SQL Server installed, it worked perfectly. But when I installed it on a client machine, the service does not start, and ends up with JIT compiltation error :
Could not start Data Update service on the Local Computer. The service did not return an error. This could be internal Windows error or internal Service error.
I have changed the connection string accordingly. But it always breaks on
this.sqlConn.Open();
Can anyone tell me what am I missing?
regards,
Zishan
|
|
|
|
|
Zishan wrote:
I installed it on the machine with SQL Server installed, it worked perfectly. But when I installed it on a client machine, the service does not start, and ends up with JIT compiltation error
Are the MDAC correctly installed on the target machine (see also .NET Framework 1.1 Redistributable Prerequisites[^])?
Best regards
Dennis
|
|
|
|
|
Anonymous wrote:
Can anyone tell me what am I missing?
Do you have an error message and/or the stack trace? (on the catch, try calling ToString() on the exception to get this information).
Yes, even I am blogging now!
|
|
|
|
|
Windows services run with the current app directory set to %SYSTEM32%, which can cause problems if you are reading your connection string from an external config file. To see if that is the case, try copying your config file to the %SYSTEM32% directory.
my blog
|
|
|
|
|
Yes, I have MDAC 2.8 installed on machines. I do not have a stack trace and I have hard coded the connection string in the program.
Its a very strange problem, because when I make it a Windows Application rather than a Windows Service, it works perfect.
My database server is running WinXp with SP2 and SQL Server 2000 with SP3, and my client machine is running Windows 2000 with SP3.
Same is the problem with the file access. I am trying to access a text file on a client machine with UNC address. The Windows Service is not starting. When I copy the same code on a Windows Appliaction, it is working fine. The Service does not have any problem with text file on the local drive.
Regards,
Zishan
|
|
|
|
|
Zishan wrote:
Same is the problem with the file access. I am trying to access a text file on a client machine with UNC address. The Windows Service is not starting. When I copy the same code on a Windows Appliaction, it is working fine. The Service does not have any problem with text file on the local drive.
I agree with Daniel that you should modify your program so it saves a stack trace in case of an unhandled exception and if I were system administrator and had to use your service I would expect it to write everything relevant into the Windows logs.
Without a stack trace however I can just give you my next best guess. And because you say that the service can access local files but can't access remote files with UNC paths then I'd say you're getting some kind of access denied exception. Remember that when you execute your code as a normal exe (and don't use run as) it runs with your permissions. As developer I assume you might have administrative privileges on your local machine and maybe even on the servers. Your service however runs with the permissions of the account you set in the service configuration. That's by default LOCAL_MACHINE\SYSTEM. Of course any local system account has no privileges on any remote machine. Even if it indeed is an domain account you setup for your service it might not have enough permissions to access the data you want to use. So check out your service configuration and see if that's the problem.
Best regards
Dennis
P.S. Why are you posting as Anonymous? Don't you have an account or are you just not logged in. Well, it's not like it really bothers me, but I'm curious to whom I'm writing.
|
|
|
|
|
Yes, that was an Access Denied error. I changed the service configuration to NT AUTHORITY/NetworkService and that started. Thanks for your help
Zishan
PS : I had an account here but I was too lazy to log in.
|
|
|
|
|
Hello all,
I am working on a program that displays descision trees in a panel control. The links between the nodes are drawn straight on to the panel whereas the nodes are custom controls.
Trying to print the contents of the panel I have used GetImage, unfortunately this only gives me the links and not the nodes. I suspect having studied further I should have drawn the whole lot to a graphics path... any way I can bodge it without rewriting all the graphics code? I wish to keep the custom controls as they allow me to process mouse events easily.
Rob
|
|
|
|
|
What you could do is create an Image object (as a member of your form class), give that to the PictureBox's Image property, then do all your drawing operations onto the Image itself instead of the picturebox (you can get a Graphics handle just as easily from the Image, so your code should need only minor modifications)
--
Help me! I'm turning into a grapefruit!
Phoenix Paint - back from DPaint's ashes!
|
|
|
|
|
That would be a complete waste of memory and CPU cycles. The OnPaint virtual function and the event if fires - Paint - exist so that you can draw onto any control. Drawing into an images then assigning that images to a PictureBox is inefficient and requires much more memory than drawing on the control's surface itself. That can be done with a simple Panel as the poster is currently doing.
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Sustained Engineering
Microsoft
[My Articles] [My Blog]
|
|
|
|
|
You can write any window to a DC using Windows API as it's being shown on the screen. You first need to call CreateDC("DISPLAY", null, null, null) and then use SendMessage to send a WM_PRINT to the window.
Alternatively, you'll need to rewrite your code and draw everything on the Panel's OnPaint.
Yes, even I am blogging now!
|
|
|
|
|
Extending on what Daniel said, you should rewrite your OnPaint to paint the entire surface (nodes and lines) but in a modular manner that you can pass a Graphics object (and perhaps the clip bounds) to paint on, but don't paint directly in OnPaint . This allows you to pass the Graphics for a PrintDocument (or even an HDC for some other device using Graphics.FromHdc ) and use the same drawing routines.
The common solution follows:
private void Paint(Graphics g, Rectangle bounds)
{
}
protected override void OnPaint(PaintEventArgs e)
{
base.OnPaint(e);
Paint(e.Graphics, Bounds);
}
private void printDocument1_PrintPage(object sender, PrintPageEventArgs e)
{
Paint(e.Graphics, e.PageBounds);
} Handling your mouse events isn't too hard if you design a nice abstract system of nodes where the Panel may translate mouse events to the nodes, but the nodes actually contain the code to move themselves. Polymorphism is a very powerful tool.
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Sustained Engineering
Microsoft
[My Articles] [My Blog]
|
|
|
|
|
I want to do something when all the threads have been excuted,but I don't know how to detect this event.Can you tell me?
|
|
|
|
|
One very simple solution would be to create an array of bools that all the threads and your main process can see - each thread knows it's number (set by the main process when the thread starts) and when each thread finishes it sets it's relevant entry in the array to true.
Then the main process just needs to sporadically check the array, to see if they've all finished (and find out which thread it's waiting for)
--
Help me! I'm turning into a grapefruit!
Phoenix Paint - back from DPaint's ashes!
|
|
|
|
|
Common solutions are:
1. Array of bools or a bool property on each thread controlling object (only if you need to know which threads are still running).
2. Static counter that gets incremented when each thread finishes.
3. Thread.Join each thread.
4. Use a synchronization object, e.g., an ManualResetEvent (my favorite).
Whatever solution you chose, don't forget to put robust exception handling, or your program will wait forever in case of an exception.
Yes, even I am blogging now!
|
|
|
|
|
Hi! I want to make NB shared folders scanner on C#.
How should I do this? Using netapi32.dll or perhaps, you could propose better choise??
PS: I'm sorry 4 my English$)
|
|
|
|
|
Start by enumerating the servers and workstations on the network using the NetServerEnum API exported by netapi32.dll. For each machine, enumerate its shares using the NetShareEnum API.
An example of using NetServerEnum can be found here[^].
See the Platform SDK for both NetServerEnum and NetShareEnum documentation at http://msdn.microsoft.com/library[^].
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Sustained Engineering
Microsoft
[My Articles] [My Blog]
|
|
|
|
|
How i can fire(run) an event on a DataGrid cell?
|
|
|
|