|
Hi, adding a finalizer for the purpose of logging would disrupt the normal operation of the
memory management too much (objects with finalizer are handled differently, their disposal
is more expensive). So what I do occasionally is keep a list of "important" objects
using weak references, then periodically check what's Alive in the list.
Luc Pattyn [Forum Guidelines] [My Articles]
this months tips:
- before you ask a question here, search CodeProject, then Google
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get
- use PRE tags to preserve formatting when showing multi-line code snippets
|
|
|
|
|
Hmm... that actually sounds like that might be a better approach anyway. If my pool of objects contains weak references to the objects in question, then any time it discovers that an object in the pool has been deleted it could log an event and do a cleanup. The object itself would have a tight reference to the pool, but that shouldn't be an issue. Thanks for the suggestion.
|
|
|
|
|
-1- Is there any way to find out if data is available from a stream other than by trying to read it and getting a timeout exception? The stream will most likely be the basestream of a socket or serial port.
-2- If not, is there any way to stop the timeout exceptions from filling up the immediate window?
-3- What is the best way to set up a buffer stream for simultaneous non-seek reading and writing? When I go to output data to a stream, I'd like to at that time read the data from the stream and store it into a log file and into a buffer stream so that the it can be read at leisure. I just coded a rather clunky class to do that, but that's probably the wrong approach.
-4- If I want to make incoming data available to multiple handlers, some of which will want events when it comes in and some of which would be happier with input streams, what's the right approach?
|
|
|
|
|
I dont understand much about what you are trying to do, but have used a StreamReader to input from files. I use the .Peek command to tell if there is data before reading, as follows ..
Dim sr as New System.IO.StreamReader(txtFileName)
While sr.Peek <> -1
txtRecord = sr.ReadLine
End While
Sorry if this is irrelevant. I am a relative newbie
|
|
|
|
|
I'll have to see if Peek does what I'm looking for.
To better explain #3, I'd like a stream which starts out empty. If I write some number of bytes into it, I want to be able to read them back, in the same order, without doing a seek. So, for example:
Stuff "HEY THERE" in queue
Ask to read 6 bytes--get "HEY TH"
Stuff " MR. SMITH!" in queue
Ask to read 6 bytes--get "ERE MR"
Ask to read 6 bytes--get ". SMIT"
Ask to read 6 bytes--get "H!"
A memorystream doesn't seem to be quite what I'm after, since it would require seeking between the read and write operations. Further, from what I can tell, data in a memorystream will remain around forever even after it's been read.
As for #4, there will be a few types of data mixed in with a serial input stream and I'd like to be able to have the same data get passed through to different handlers (some of which may serve to log what's going on, and others of which may just look for particular items of interest). I'm still in the process of sketching out an application design, since I don't really know what's practical and what isn't.
|
|
|
|
|
Ive been trying to save a text file i opened up into a data grid.
Have searched all over this site and the net and have not found anything that helps.
|
|
|
|
|
One way would be to iterate through the rows and columns and to write each cell to the file using a streamwriter.
|
|
|
|
|
Hello,
Is there a way to detect the value of a property has been reapplied?
There is an event that fires for the 'enabled' property of all controls called 'EnabledChanged". This fires as expected when I changed the enabled property to true or false. Is there anyway to get it to fire regardless of the value being applied? Meaning if enabled=true - if I set it to true again then fire the event.
The reason is our users do not like the readability of the controls when they are disabled. I have been playing with "paint event overrides" and other techniques but not all controls lend themselves to this technique or the drawing is inconsistent.
Open to any ideas...
Thanks, Nathan
|
|
|
|
|
I think I need more information... what are you trying to do to the control at this point? And is this change required programmatically or at user request?
|
|
|
|
|
Hello thank you for your time.
I have a standard checkbox.
i do an addhandler on the checkbox's EnabledChanged event
programatically if the checkbox is disabled, the event fires.
I reenable the checkbox but then block the behavior of the checking by keeping the current value. This has the effect of not allowing the user to change the value and also keeps the forecolor black instead of fading the control.
My problem is if programatically I renable the control. Well I just renabled it for the blocking so when the line checkbox1.enabled=true is executed, the event EnabledChanged does not fire because the value is already true.
I need away to either still fire that event or trigger something else (my own event or whatever). Is that possible? is there a way to put in a hook or something?
|
|
|
|
|
OK, you want to keep the color of the control the same regardless of whether it is enabled or not. So why not leave it enabled all of the time and just use your own variable to determine whether or not clicking it does anything. Perhaps I'm missing something still.
Another thought.. can you specify the color of the unenabled control to be the same as that of the enabled control?
Or put two controls on top of each other and hide one or the other of them?
Hope this helps... not sure I really know yet what you are doing.
|
|
|
|
|
Sorry I did leave out "minimal impact". I am not trying to change existing applications. Each one of our forms inherits from a base form. My intention was to insert calls to my new class into this base form and then any existing application would not need one line of code altered...
you are allowed to change the background color of a disabled control but not the foreground color. that's my problem...
a little costly and slow to be creating a 2nd set of controls of a readonly mode of an application so I would rule that possibility out...
|
|
|
|
|
Well I thought about it a bit but I'm afraid I'm out of ideas!
|
|
|
|
|
I have a general question about how to work on subsets of datasets
I have a dataset that has data. I want to operate on only part of that dataset. So I create a dataview and filter the datatable into it. Then I create a datagridview from the dataview. Then I perform my operations on the datagridview.
This works, but I guess it seems kind of strange -- datagridviews seem to have an entirely different purpose. Does it make sense to do data analysis on a datagridview, or is there a better approach for me?
Thanks!
|
|
|
|
|
I am confused...I am trying to learn how to send a query to a oracle database (i am connected to it) I am just doing a test to retrieve a piece of data from this database and displaying this info on a label... Its not working Im having a hard time because Oracle needs a password to be sent to access the data. Does anyone know the format for doing this? Any help would be appreciated.
Thanks
Erica
|
|
|
|
|
Can u tell in detail how are you connecting to the DB and what is the connection object u are using...
The basic idea is
We define the connection object
We define the connection string....with the DB password
Open the connection
Then use the connection object whenever you have to access any data
Good luck
|
|
|
|
|
Hi All! I'm looking for a way to convert xml data to Tiff format in VB6. Previously I'm using a III'rd party component to generate PDF file. But the problem is that, it is taking too much time to generate the PDF Files. What I'm looking for is a way to generate Tiff file or any other common format out of the XML in VB6 preferably through code or some free component.
Thanks in advance
Don't Quit
|
|
|
|
|
The way of VB6 - get components to do the work. GDI+ will write a tiff, if you want to create your XML in a bitmap format ( and I can't imagine why ), then just draw the string on a bitmap and save it. VB.NET has tiff support built in, VB6 sucks, and probably does not, but the XML part isn't your problem, just the saving in different image formats is. Surely there's tons of components that will help VB6 save jpg/tiff/etc ?
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
hi,
how can hide some textbox some time and this moment show another textbox ,after the time finish show again first textbox in form
|
|
|
|
|
You can use the Timer Control for this purpose set its interval property then use visible property of the textboxes to hide or show them on screen. I am assuming Textboxes are already on your form and some of them with their visible property set to false. If you want to add Textboxed dynamically then you have to make an object of it and after seeting its properties add it in the control collection of your form.
AliAmjad(MCP)
First make it Run THEN make it Run Fast!
|
|
|
|
|
I've got an axwebbrowser object embedded on a standard windows form within a VB.Net (vs2003) application. Everything works fine until it tries to link to a pdf file. I get script errors and a blank screen. The strange thing is that if I point it to a pdf file on my hard disk eg. c:\example.pdf it works fine and the pdf displays ok. It just seems to be pdf files from the intenet that it has a problem with.
Anyone had a similar problem ?
Cheers.
|
|
|
|
|
hi all,
i have developed an application in vb.net on my pc which have 800/600 secreen resolution. on whice i developed various user interfaces fit to my screen.
but when i install my application on another pc it give me very diffrent screen display say it compressed to half in size than on my pc.
kindly help me with providing approriate sollution so i can enjopy auto screen setting facility .
thanks
rmshah
Sr. Developer
|
|
|
|
|
Seriously learn to Google.
http://www.freevbcode.com/ShowCode.asp?ID=5915
http://www.thescripts.com/forum/thread381482.html
|
|
|
|
|
Hi To all ,
I didnt find help for this so i am posting inthis forum .
Now , i want to enter text when i click on grey area whether it is on any row or particular colum dynamically like entering text into textbox for datagridview .I dont know whether this feature supports to datagridview .
After running the form(design Mode for my application ),Actually i am creating an instance of datagridview and placing at any point. Then he clicks a Row Header Cell or ColumHeader cell Which are in GREY color and he writes Text (Empno ) at that instance like entering text into textbox .I dont want to give the user to enter text in cells only he can enter text for header (Both row and column ). This is all in design mode .
(In run Mode for my application )If we open that particular Form again , He cannot change the text of Column and row Headers but he can enter text in cells .This is the way i have to design the datagridview .
(For saving and retrieving) , i want to save all this data which is in Datagridview in an XML file and i have to retrieve the same .
<br />
Emp Det|Jan| Feb| March |Apr |May ............<br />
<br />
ENo |<br />
<br />
Ename |<br />
<br />
Age |<br />
<br />
Salary |
I amnot connecting to any type of datasource .I dont know how to do this task .
Help Required ,
Regards,
Sriram .
|
|
|
|
|
I am using Adodb recordset to get the count of the total number of rows reterieved from a query?
In vb6 we can get this easily with
myrcd.recordcount
but if I use the above statement in vb.net 2003 it return -1.
Can we get count from reader without putting this in a loop to count every single record?
Thanks In advance
Ejaz
|
|
|
|