I have datagridview that displays a list of entries pulled from a database. This part works.
The datagridview has 'ScrollBars' set to 'Both'.
The setup is as follows...
TabControlMain has 2 pages, TabControlMain.page1 has a tabcontrol of which its first page contains the DGV in question.
TabControlMain.page2 also has a tabcontrol.
When the entries load (added via 'ReportProgress' event of background worker) then scroll bars appear as desired.
However, If the entries are loaded when TabControlMain.page2 is displayed and the user selects TabControlMain.page1, then the scroll bars are disabled, even thou the content is larger than the display area. If the user click a button to reload the list, then they appear again.
Basically, if the datagridview is populated while it is not visible then the problem occurs.
Also to note, that the DGV is part of a userControl.
Has anybody come across this issue before?
So far I have had no luck, my best idea was to try to update the DGV whenever the page is reselected. But I have tried .Refresh, .Update, .Invalidate...
...Just tried setting 'ScrollBars' to 'None' and then back to 'Both' when the DGV is reselected and the scrollbars are enabled again. This is what I want but is not the ideal solution. Can anybody offer a better alternative? Or reason why it happens in the first place?
Life goes very fast. Tomorrow, today is already yesterday.
I want to create a simple GUI designer for users. The designer should be very simple and user can select some components such as text boxes , labels and others from tool window and than they can place this components on windows form during run time.
Please give me or name of such articles or which topic should I search in google..
You could always create a windows application using VS(assuming you use it).
Place whatever components you require on the form.
Then have a look at the YourForm.designer.cs files.
This will give you all the necessary info on creating the various controls.
Next investigate Drawing,DragDrop using the mouse.
Finally you will need to save this info (control type,position etc) in some type of file XML etc.
After all this you should have yourself a pretty fine GUI Editor.
How to enable the C# windows service application write access to some folder and eventLogs
I created the simple service and in OnStart method written file write creation operation. It fails however.
Either adding eventLog.WriteEntry component without try/catch blocks in the OnStart method generates exception to Windows Applications Log as System.Security.SecurityException in System.Diagnostics.EventLog.WriteEntry()
1. To have full access to all paths you want, just create a new user, give him all rights he should have and assign him to your service.
2. In my opinion your problem with the EventLog, has an other cause. Because normally LocalSystem has the
rights to access the EventLog and if you look at your installed services on your computer you will find many services working under LocalSystem and can write to EventLog.
So can you please provide your code you use to write to eventlog?
There are many ways to interact with your service.
1. Build a tiny TCP/IP server in your service and let your clients interact with this service.
To get started with this take a look at the .NET classes TcpListener, TcpClient and Socket.
2. Use interop-functions to interact with your service.
To get started with this, learn how to use one event in more then one application (CreateEvent, SetEvent, ResetEvent, CloseHandle) and how to map a shared memory block (CreateFileMapping, OpenFileMapping, MapViewOfFile, UnmapViewOfFile).
Anyone else run into this issue? I'm using a third-party system via an RCW-wrapped COM interface in a console app... When I try to clean up during a reconnect (It's a network interface to their servers), I'm running the following simple line on each component, in reverse order of instantiation:
if ([component] != null)
Simple, right? Well, the trouble is that it's locking up solid at this point. It doesn't return or throw an exception. I've tried with the old-style ReleaseComObject (Which only decrements once), but it does the same thing.
I think it has something to do with the context, as this is a console application with 3-4 background threads (Will be turning it into a windows service), and this is running on a thread that was instantiated within the COM library.
Any ideas on how to make this thing return, or at least crash so I can handle and recover?