|
PIEBALDconsult wrote: Munis-q wrote:
keep them connected all the time
I wouldn't do it that way.
Perhaps, along with the data sent at system startup, send the IP address so the server can connect when it wants.
Yes I'm sending the IP address of client on startup as well,that means i should put a listener on client as well ? or keep client connected (1200-1600 connections with server) ?
|
|
|
|
|
Munis-q wrote: put a listener on client as well ?
Sure, why not? I'd probably have a Windows Service that ...
Wait a minute. A Windows Service with a custom action (or whatever it's called) that means "please send everything now". It should be fairly easy to do.
|
|
|
|
|
Windows service ? i don't anything about them! can you link me up with some tutorial or some webpage ?
thanks again!
|
|
|
|
|
It's a pretty big topic because there are a number of ways to implement the details.
I seem to recall that Visual Studio has a template. Plus there are some articles here.
There is a minor gotcha in how to implement a custom action.
|
|
|
|
|
Hi there! I want to dynamically initialize a jagged array. Keep getting a NullException.. Help
Byte[] scriptImage = null;
Byte[][] allScriptImage = null;
scriptImage = MyTools.ScanImage();
allScriptImage[e.RowIndex] = new Byte[scriptImage.Length);
allScriptImage[e.RowIndex] = scriptImage;
The last three lines are run on RowLeave event of a datagridview.
Thanks in advance!
Steven
modified on Monday, October 26, 2009 12:53 PM
|
|
|
|
|
Steve51771 wrote: allScriptImage[e.RowIndex] = new Byte[scriptImage.Length);
allScriptImage[e.RowIndex] = scriptImage;
You have declared allScriptImage as having two dimensions but you have not reserved any space for it. I'm also not sure what you expect the above two lines to do since you assign a buffer to the entry and then immediately replace it.
|
|
|
|
|
Do you ever create an instance of allScriptImage? 'Cos you don't in the fragment, and that would cause a Null exception on
allScriptImage[e.RowIndex] = new Byte[scriptImage.Length];
If you do, which line is giving the exception?
No trees were harmed in the sending of this message; however, a significant number of electrons were slightly inconvenienced.
This message is made of fully recyclable Zeros and Ones
|
|
|
|
|
OriginalGriff wrote: allScriptImage[e.RowIndex] = new Byte[scriptImage.Length];
This line is giving me the exception.. I am trying to dynamically assign the sizes on the fly.
Basically, I have a ScanImage() method that returns a Byte[].. I want to enter that Byte[] into a Byte[][]... There will be a variable total number of Bytes[], each size will vary as well.
Thanks,
Steve
|
|
|
|
|
Hi,
while Mark gave you the right answer to your question, you might also consider using a list, in particular a List<Byte[]> , as in:
List<byte[]> list=new List<byte[]>;
list.Add(new byte[]);
...
Luc Pattyn
I only read code that is properly indented, and rendered in a non-proportional font; hint: use PRE tags in forum messages
|
|
|
|
|
Mark would be right if I didnt need to assign the sizes DYNAMICALLY..
Thank you for your help.. A gen. List will do the job..
btw: it's
List<Byte[]> allScriptImages = new List<Byte[]>();
Thanks again.
|
|
|
|
|
Steve51771 wrote: Mark would be right if...
Perhaps you are incorrect in asking to do what is not possible.
only two letters away from being an asset
|
|
|
|
|
Then I suppose that should have been the initial answer.. No matter... Thanks for your help...
|
|
|
|
|
Steve51771 wrote: Keep getting a NullException
Byte[][] allScriptImage = null;
Gee, I don't understand why you'd be getting a NullException here.
You have to initialize it somehow, like
Byte[][] allScriptImage = new Byte[4][];
only two letters away from being an asset
|
|
|
|
|
The key is DYNAMIC assignment...
But thanks anyway
|
|
|
|
|
C# WinForms .Net 3.5
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.
|
|
|
|
|
Hi,
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..
Thanks.
|
|
|
|
|
Take a look at this[^] article. It doesn't contain the answer to your problem itself but if you scroll to the bottom the links listed there do. They will at least give you some terms to search for.
Other useful terms:
Design Surface
Hosting Controls at run time
Good luck!
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
|
|
|
|
|
muhammadumairomee wrote: The designer should be very simple and user
As a general rule, the simpler it is for users the harder it is for you to program.
This is a massive topic, and with the risk of sounding harsh; If you need to ask how to start this, you do not yet have the knowledge to complete it.
|
|
|
|
|
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.
Best of luck
Regards
Mick Curley
|
|
|
|
|
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()
Чесноков
|
|
|
|
|
What (user)account does your service use?
LocalSystem?
|
|
|
|
|
LocalService.
I found out that changing it LocalSystem, NetworkSystem created the file in windows\system32 directory.
Thus, creating file by providing the name, does not create it in the directory of the servise exe.
After I provided full path to the service dir with LocalService the file has been created.
However eventLog still does not work.
Чесноков
|
|
|
|
|
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?
Greets Covean
|
|
|
|
|
Yes, after I changed to LocalSystem and the event logging worked.
BTW do you know how to interact with the service?
1) When I execute custom command using ServiceController from external app it throw exception that the service can not be manipulated.
2) Is there any way to retrieve the data from the service, e.g. return codes from command execution?
Чесноков
|
|
|
|
|
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).
3. Use named pipes.
|
|
|
|