|
Most likely, yes.
Add an invisible button to your form and before calling myForm.Controls.Clear() or Remove() or RemoveAt() set the active control to this button: myForm.ActiveControl=invisButton .
I think this also is relevant when you're removing controls from panels on this form.
You can also try .NET Framework 1.0 ServicePack 2 or .NET 1.1.
mav
|
|
|
|
|
Hi,
anybody knows how to convert .pwi to image?
is there any component available?
thanks
|
|
|
|
|
|
Pocket Word files
|
|
|
|
|
khchan wrote:
Pocket Word files
Ahh, sorry, the best I can think of it to use a digital camera
top secret xacc-ide 0.0.1
|
|
|
|
|
Greetings CP!
Well - it appears I've been presented with a roadblock and cant seem to find the problem.
Heres the situatio.
Ive created an app that has to scann 16000+ servers - for now - all that has to be done is connect and send and receive once asynchronously.
I am able to get the entire process down - the problem that occurs is that at random times the app just halts.
It just stops connecting to the servers - no exceptions thrown - no nada. Its not a threading problem - unless its a bug in the threadpooling for asychronous socket communications.
To draw out some broad strokes about the current scenario
Classes
MainForm applications main form
ConnectionState stores connection information
- buffer
- socket
- server hostname
- start time / end time / elapsed time
ConnectionManager this object is used in the main form (connection
state is not accessed directly)
- i start the process with a method called
CheckServers() which is passed to a ThreadStart object
in the main form for a Thread object named worker
- the worker thread is started and is set to a
background thread from the main form
MessageEventHandler a delegate used to pass the messages from the buffer
to controls on the main form
I know this is a somewhat complicated issue to deal with over these forums.. but - i have traced every aspect of my code - 2-3 days spent in the debugger watching everything and still no luck.
Any suggestions?
Danny!
|
|
|
|
|
Are you setting off alarms at your ISP?
They may not like you accessing so many machines. It could be taken as a worm or a vulnerability test in preparation for a new virus etc.
|
|
|
|
|
Hrmmm you know what - i didnt think about that..
Maybe I should put a delay between requests - like a random delay to see if that stops the problem..
Good idea!
Anymore suggestions?
Danny!
|
|
|
|
|
Some how I dont think the .NET threadpool is gonna cut that
Some other suggestions:
- socket buffersizes and timeouts, by default they will wait for ever...
- Linger options
- Socket options (god knows what they all do....)
top secret xacc-ide 0.0.1
|
|
|
|
|
leppie wrote:
Some how I dont think the .NET threadpool is gonna cut that
Well instead of using thread pools manually im using them by means of asynchronous communication. to my understand - when communicating asynchronously with sockets (i.e. BeginConnect EndConnect etc etc ) these mechanisms use threadpooling in the background.
Now it all depends on how you use these mechanism. For example - my first attempts maxed out the thread pools and i was only able to do 25 connections and blah - it got stuck there. I was able to by pass this with creating only 1 object that would do the main communication. Originally i had created an object which handled the entire connection including buffer / socket as well as the async parts. but for some nutty reason - this method did not prove to work - possible because garbage colleciton - although it was manually called - would not collect the lingering objects which were ready for collection..
leppie wrote:
- socket buffersizes and timeouts, by default they will wait for ever...
when it comes to this - during asynchronous communications the appropriate exceptions are thrown informing you of these.
leppie wrote:
- Linger options
- Socket options (god knows what they all do....)
well alas you have me at this one. right now im not using any socket options - since it seems to be working quite well without them..
ending comments...
i took the first suggestion and implemented a random wait interval between each connection to each server. this proved to work perfectly - since that post the application has gone through 4000 servers and its still going - which is by far - further than its gone before. i simply put in a random interval between 1 and 30 seconds. although its a trade off for now - in time - the production system wont have these restrictions (i.e. flood control or worm detection whatever they call it )
Again thanks all for the advice and comments.
Also - any more suggestions?
p.s. a word on asynchronous sockets...
ive test various methods of socket communication - async, sycn, manual thread pooling, custom threading... everything.. ive been able to achieve equal results if not better with the manual threading in comparison to asyhc mechanisms - but it was far trickier to achieve.
has anyone implemented a server app - web server? ftp server? irc serveR? anything with async sockets in c#? just curious about your results..
Danny!
|
|
|
|
|
welp! it appears i spoke to soon - the app stopped working yet again - now its either my isp that keeps blocking or something else - i have resorted to fiddling with the socket options..
lets see if this works out..
Danny!
|
|
|
|
|
Danny Rodriguez wrote:
now its either my isp that keeps blocking or something else
Get a port sniffer/packet capture prog and see what happens! I suggest NGSniff + winpcap (only thing that didnt BSOD me).
I have a funny feeling something is wrong in the Sockets in .NET, other problems, but if there's one, there bound to be more!
I will look into those options and see what I can suggest. You definately want to turn lingering off.
Have you tried another threadpool implemeatation perhaps?
top secret xacc-ide 0.0.1
|
|
|
|
|
Okay.. the ordeal continues..
I am still receiving the same problem..
Ive set sockets timeout via the SetSocketOptions but it appears to do nothing with asynchronous sockets.
so then i moved onto another solution - which was to create a new thread which would wiat for a certain time period to elapse.. once it does it would manually kill the socket. unfornately this did nothing..
also - i contact the isp and the are not doing anything so that idea is out the door..
any suggestions..
the basic problem is setting a timeout on a socket which is being use in async communications..
any suggestion. im starting to get disperate
Danny!
|
|
|
|
|
I need a treeview/listview type control that will allow me to use a
progressbar or another object in one of the columns. The layout I need will
look like below:
-----------------------------------------
User | File | Progress |
-----------------------------------------
user1 | file1.txt | ||||||| 2% |||||||||||
does anybody know of a control/component that will do this or how to go
about making/modifying one?
Thanks,
Aaron
|
|
|
|
|
Bompus wrote:
does anybody know of a control/component that will do this or how to go
about making/modifying one?
I'm sure I have seen an article on this right here on CP a while back (could be wrong!)
top secret xacc-ide 0.0.1
|
|
|
|
|
there's a couple of owner drawn listviews right here on codeproject.com - glacial listview is probably what you need, or carlos' articles
|
|
|
|
|
The primary key for table Attachment is AttachmentID. I wanted the file path to be unique,meaning if you have entered the repeated filepath,the system will pop up a error msg,and the file path record will be denied.
Here is the stored procedure with C#:
CREATE PROCEDURE FilePath
{
@AttachmentPath Varchar(50)
}
AS
Select AttachmentPath from Attachment where AttachmentPath=@AttachmentPath
IF @@ROWCOUNT = 0
BEGIN
INSERT INTO ATTACHMENT VALUES(@AttachmentPath)
END
RETURN @@ROWCOUNT
GO
It still can't work,why?Please help me!
Thank you!
|
|
|
|
|
Make sure you have your AttachmentID column in Attachment Table set as Identity(autonumber)
CREATE TABLE [dbo].[Attachment] (
[AttachmentID] [int] IDENTITY (1, 1) NOT NULL ,
[AttachmentPath] [varchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL
) ON [PRIMARY]
GO
ALTER TABLE [dbo].[Attachment] ADD
CONSTRAINT [PK_Attachment] PRIMARY KEY CLUSTERED
(
[AttachmentID]
) ON [PRIMARY]
GO
Change Stored Procedure as
CREATE PROCEDURE FilePath
@AttachmentPath Varchar(50)
AS
Declare @count int
Select @count = count(*) from Attachment where AttachmentPath = @AttachmentPath
if @count =0
BEGIN
INSERT INTO ATTACHMENT(AttachmentPath) VALUES(@AttachmentPath)
END
GO
Note: An easiest way would be to have AttachementPath column set as Unique. Then, stored procedure would automatic generate an error in case of duplicate data
Sanjay Sansanwal
www.sansanwal.com
|
|
|
|
|
Hello,
I'm building an application were I need to fill a large dataset before using it to display a crystal report. I has been taking up to 30 sec. to retrieve all the data from the server and I need a way to assure the user that the application has not froze up during this time. I cannot get a progress bar to work in this case and have also tried to display a form with an animated gif, but the gif does not animate during the data retrieval. I would like to be able to show the user a true progress if possible, any suggestions?
-Scott
|
|
|
|
|
You can'y unlress you writ your own code to fill the dataset a set number of records at a time, kind like paging in 10 records at a time until you get all, say 1,000 records into your dataset.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
I'm trying to do a custom draw on listview items, when a listview is in large icon mode. I've found lots of samples, one here on codeproject, but none seem to be geared towards the icon mode. The problem I'm getting is i'm not getting given an 835 (CUSTOMDRAW) message in the WndProc function, which the listview sends to itself (reflected message), I only get an 870 in it, which is a NOTIFY message.
I basically want to right my own listview that customises the large icon view of a listview, so for example, I could do a photo gallery with descriptive text underneath each item.
If anyone can point me in the right direction, that'd be much appreciated. I've hit a bit of a brick wall with it.
|
|
|
|
|
smallguy78 wrote:
The problem I'm getting is i'm not getting given an 835 (CUSTOMDRAW) message in the WndProc function, which the listview sends to itself (reflected message), I only get an 870 in it, which is a NOTIFY message.
Why you doing that? Just set the OwnerDraw property to true, and use the MeasuerItem and DrawItem overrides.....
top secret xacc-ide 0.0.1
|
|
|
|
|
Listview doesn't have MeasureItem and DrawItem, which is why I need to use p/invoke to do it.
There's a few examples out there, like I said, none of which work with large icon view.
|
|
|
|
|
|
With the help of ListViewEx's implementation, I've got it working. The NOTIFY message is being called ok, and the -12 (CDDS_ITEMPREPAINT) is also being called. It's all painting okay, so if anyone ever needs to do this, send me an email and I can help out (I'm doing large icons listview though, remember)
My only problem is the rectangle I'm getting back doesn't contain any width information (the Right property is the same as the Left, x same as y). I can work around this as I'm doing a custom draw, but it's a tad annoying.
|
|
|
|