|
code
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Refresh a formHi
I'm working on a fairly simple app comprising of 4 forms. On the 1st form it shows some stats from 2 txt file it links too (how many lines etc). On Form 2 it allows you to add info to one of the txt files. I open Form 2 when wanting to add another record using Form2.ShowDialog() When I've added the link and clicked save I close form2 with Close(). The the focus is back on form 1 Is there anything I can do to automatically refresh form1 so that the stats update once I close form 2? Thanks Gerry From what I've read, clipboard formats are supposed to coincide with dragdrop
formats. I can enumerate clipboard formats and find two that have been registered. But the two I found registered do not work with dragdrop. To find what works with dragdrop I must test everything from -32768 to 32767 and use what's found. Enumerating clipboard formats returns long values which must be converted to integers ranging from -32768 to 32767. Using the converted values works with clipboard.getformat(x). They do not however work with data.getformat(x), with data supplied by the OLEDragDrop event. I'm trying to drag attachments from GroupWise 6.5 into an Access 97 application. Because Access 97 does not have that functionality I must use an ActiveX. I'm able to discover the dragdrop formats by iterating when the application loads and use what's found. I was able to figure out what's in the byte arrays returned using the two formats, and the application works. But I'd like to find a better way to discover the dragdrop formats instead of iterating through all possibilities. The application is still in Access 97 because no project has been approved for new development and only what the users have installed can be used. Thanks dgm wrote:
> From what I've read, clipboard formats are supposed to coincide with dragdrop I've never ran into that correlation before, but that certainly doesn't mean it > formats. isn't so. > I can enumerate clipboard formats and find two that have been Clipboard formats, and lots of other things, exist in a string table with indices > registered. But the two I found registered do not work with dragdrop. To find > what works with dragdrop I must test everything from -32768 to 32767 and use > what's found. between &hC000& and &hFFFF&. If you loop that range, using GetClipboardFormatName, you'll see lots of interesting stuff. http://vb.mvps.org/articles/qa200203.asp > Enumerating clipboard formats returns long values which must be Unfortunately, the rest of this I really know nothing about. Just wanted to inject > converted to integers ranging from -32768 to 32767. Using the converted > values works with clipboard.getformat(x). They do not however work with > data.getformat(x), with data supplied by the OLEDragDrop event. the range I was familiar with. Good luck...
Show quote
Hide quote
"gerryR" <gerryr@noSPAM.com> wrote in message [Hope I got the direction right... <g>]news:eC0Wih80JHA.5556@TK2MSFTNGP03.phx.gbl... > Hi > > I'm working on a fairly simple app comprising of 4 forms. > > On the 1st form it shows some stats from 2 txt file it links too (how many > lines etc). > > On Form 2 it allows you to add info to one of the txt files. > > I open Form 2 when wanting to add another record using Form2.ShowDialog() > When I've added the link and clicked save I close form2 with Close(). The > the focus is back on form 1 > > Is there anything I can do to automatically refresh form1 so that the stats > update once I close form 2? > In Form2 provide a Event to send back the information In Form1 declare your Form2 reference using Private WithEvents frmTwo As Form2 Add the Event to Form1 In Form2 when ever you want to update Form1 raise the event -ralph "Karl E. Peterson" <k***@exmvps.org> wrote in message Indeed. BadApplicationNotificationClassWindow has me thinking unhappy news:%23dYql$B1JHA.3988@TK2MSFTNGP05.phx.gbl... | dgm wrote: | > From what I've read, clipboard formats are supposed to coincide with dragdrop | > formats. | | Clipboard formats, and lots of other things, exist in a string table with indices | between &hC000& and &hFFFF&. If you loop that range, using GetClipboardFormatName, | you'll see lots of interesting stuff. things. -- 2025 If you do not believe in time travel, your beliefs are about to be tempered. http://www.facebook.com/group.php?gid=43606237254
Show quote
Hide quote
"Karl E. Peterson" wrote: Thanks Karl. I can get a byte array from the OLEDragDrop data object, for a > dgm wrote: > > From what I've read, clipboard formats are supposed to coincide with dragdrop > > formats. > > I've never ran into that correlation before, but that certainly doesn't mean it > isn't so. > > > I can enumerate clipboard formats and find two that have been > > registered. But the two I found registered do not work with dragdrop. To find > > what works with dragdrop I must test everything from -32768 to 32767 and use > > what's found. > > Clipboard formats, and lots of other things, exist in a string table with indices > between &hC000& and &hFFFF&. If you loop that range, using GetClipboardFormatName, > you'll see lots of interesting stuff. > > http://vb.mvps.org/articles/qa200203.asp > > > Enumerating clipboard formats returns long values which must be > > converted to integers ranging from -32768 to 32767. Using the converted > > values works with clipboard.getformat(x). They do not however work with > > data.getformat(x), with data supplied by the OLEDragDrop event. > > Unfortunately, the rest of this I really know nothing about. Just wanted to inject > the range I was familiar with. GroupWise attachment, if I happen to know what format value to use. This is not published anywhere. Documentation at the Novell site doesn't mention it. I can't find anything through internet searches. There are two possible values that return different information, both of which I need. I can find the values by looping through data.GetFormat or data.GetData with all possible integer values. When I find them I can then use them and they work. Unforunately, each time the machine boots these values change. When the application loads I could start a background process to do the testing and find the values, but that won't work because someone must drag an email attachment and drop into the application at least one time to get a data object. Of course, once I have looped and discovered the values one time I can continue using them, so the first drag and drop will always have a big delay. Attachments can be dragged from GroupWise and dropped into Windows Explorer, or an open folder, with no problem. How does Windows know how to handle the drop event? The GetData method does not return a file but a formatted packet. What process does GroupWise go through to register this functionality? Surely there's a way to look this up. Also, there should be an API available providing the same functionality as Explorer, when an attachment is dropped into an open folder window. I'm surprized it's so difficult to find documentation or examples for this. Novell went a long way to facilitate VB, providing many DLLs and coding examples. dgm wrote:
> What process does GroupWise go through to register this functionality? Ugh. Well, I worked with Edanmo once, to accept OLEDragDrops from Outlook and OE. > Surely there's a way to look this up. Also, there should be an API available > providing the same functionality as Explorer, when an attachment is dropped > into an open folder window. > > I'm surprized it's so difficult to find documentation or examples for this. > Novell went a long way to facilitate VB, providing many DLLs and coding > examples. Or, more accurately, he provided a method for it, for which I have virtually no recollection how "we" did it. I /think/ there's an example on his web page, though. Have you looked there? I'd have to guess that GroupWise would be, at least surficially, similar?
Show quote
Hide quote
"Karl E. Peterson" wrote: I have two solutions going. I wrote a list of string values found with > dgm wrote: > > What process does GroupWise go through to register this functionality? > > Surely there's a way to look this up. Also, there should be an API available > > providing the same functionality as Explorer, when an attachment is dropped > > into an open folder window. > > > > I'm surprized it's so difficult to find documentation or examples for this. > > Novell went a long way to facilitate VB, providing many DLLs and coding > > examples. > > Ugh. Well, I worked with Edanmo once, to accept OLEDragDrops from Outlook and OE. > Or, more accurately, he provided a method for it, for which I have virtually no > recollection how "we" did it. I /think/ there's an example on his web page, though. > Have you looked there? I'd have to guess that GroupWise would be, at least > surficially, similar? GetClipboardFormatName going from 0 to 65535. Values were only returned above &hc000. Converting those to integers in the range -32768 to 32767, which must be used with data.GetFormat and data.GetData, I found text strings associated with values that were found to work. It takes almost no time to scan value string pairs in the range and find the two spellings I need. Plugging those into data.GetFormat and data.GetData works perfectly. However, scanning for the strings must be done after the file is dropped otherwise both will not be there. Once scanned, the values can be reused over and over. Thank you for saying I can use GetClipboardFormatName to read through that string space. The second solution might be better. Edanmo has a hack that converts the data object provided by the OLEDragDrop method, into an IDataObject object. From what I've read I should be able to make that work. Unfortunately I can't find what reference (dll, library, etc) to add to the project that has the IDataObject interface. Do you know what that is? Thanks again. dgm wrote:
> there. Once scanned, the values can be reused over and over. Thank you for Cool.> saying I can use GetClipboardFormatName to read through that string space. > The second solution might be better. Edanmo has a hack that converts the That's in his olelib.tlb> data object provided by the OLEDragDrop method, into an IDataObject object. > From what I've read I should be able to make that work. Unfortunately I can't > find what reference (dll, library, etc) to add to the project that has the > IDataObject interface. Do you know what that is? Thanks again. Here are two other ways to implement communication:
In Form1 create one or more properties for the information you would like updated. In Form2 create a reference to Form1, and then when you want to update Form1 simply call that property. or... If there is a specific control on Form1 you would like updated, then create a reference to that control in Form1. Set the reference before calling Form2. Then in Form2 chew on Form1's control. You can also chew on specific controls in Form1 from Form2 vie a Form1 reference (using the controls collection,etc). This latter scheme, while efficient is generally frowned upon as it is a flagrant violation of encapsulation and more tightly binds the two forms. -ralph
Show quote
Hide quote
"Ralph" <nt_consultin***@yahoo.com> wrote in Or......in Form1, can't you declare the Sub that refreshes the Form1 data news:uheacz80JHA.3700@TK2MSFTNGP06.phx.gbl: > Here are two other ways to implement communication: > > In Form1 create one or more properties for the information you would > like updated. > In Form2 create a reference to Form1, and then when you want to update > Form1 simply call that property. > > or... > > If there is a specific control on Form1 you would like updated, then > create a reference to that control in Form1. > Set the reference before calling Form2. > Then in Form2 chew on Form1's control. > > You can also chew on specific controls in Form1 from Form2 vie a Form1 > reference (using the controls collection,etc). > > This latter scheme, while efficient is generally frowned upon as it is > a flagrant violation of encapsulation and more tightly binds the two > forms. > > -ralph as Public, and then in the Form2 unload event, just call Form1.sub ?
Show quote
Hide quote
"DanS" <t.h.i.s.n.t.h.a.t@r.o.a.d.r.u.n.n.e.r.c.o.m> wrote in message Yes. Which is more or less what I assumed would be performed by setting anews:Xns9C0A6938D9E21thisnthatroadrunnern@85.214.105.209... > "Ralph" <nt_consultin***@yahoo.com> wrote in > news:uheacz80JHA.3700@TK2MSFTNGP06.phx.gbl: > > > Here are two other ways to implement communication: > > > > In Form1 create one or more properties for the information you would > > like updated. > > In Form2 create a reference to Form1, and then when you want to update > > Form1 simply call that property. > > > > or... > > > > If there is a specific control on Form1 you would like updated, then > > create a reference to that control in Form1. > > Set the reference before calling Form2. > > Then in Form2 chew on Form1's control. > > > > You can also chew on specific controls in Form1 from Form2 vie a Form1 > > reference (using the controls collection,etc). > > > > This latter scheme, while efficient is generally frowned upon as it is > > a flagrant violation of encapsulation and more tightly binds the two > > forms. > > > > -ralph > > Or......in Form1, can't you declare the Sub that refreshes the Form1 data > as Public, and then in the Form2 unload event, just call Form1.sub ? Property. ie, the Property would manage what ever updating needed to be done. If you already have a Sub that does the updating then making it Public would be a simple fix. Publishing an Interface with Methods and/or Properties is fine. But my comfort level goes down with your comment "... *the* Sub that refreshes the Form1 data ...". (The emphasis is mine.) If this Sub is used within the context of performing Form1 tasks it places the extra burden on the developer (and latter maintainers) to be aware *the* Sub might be called "out of context". I like to keep the two separated. But that's drawing a fine line and certainly nothing to go to the mat over. :-) -ralph Ralph wrote:
Show quoteHide quote > And if the data shown in form1 refresh changes they need to know this> "DanS" <t.h.i.s.n.t.h.a.t@r.o.a.d.r.u.n.n.e.r.c.o.m> wrote in message > news:Xns9C0A6938D9E21thisnthatroadrunnern@85.214.105.209... > > "Ralph" <nt_consultin***@yahoo.com> wrote in > > news:uheacz80JHA.3700@TK2MSFTNGP06.phx.gbl: > > > > > Here are two other ways to implement communication: > > > > > > In Form1 create one or more properties for the information you would > > > like updated. > > > In Form2 create a reference to Form1, and then when you want to update > > > Form1 simply call that property. > > > > > > or... > > > > > > If there is a specific control on Form1 you would like updated, then > > > create a reference to that control in Form1. > > > Set the reference before calling Form2. > > > Then in Form2 chew on Form1's control. > > > > > > You can also chew on specific controls in Form1 from Form2 vie a Form1 > > > reference (using the controls collection,etc). > > > > > > This latter scheme, while efficient is generally frowned upon as it is > > > a flagrant violation of encapsulation and more tightly binds the two > > > forms. > > > > > > -ralph > > > > Or......in Form1, can't you declare the Sub that refreshes the Form1 data > > as Public, and then in the Form2 unload event, just call Form1.sub ? > > Yes. Which is more or less what I assumed would be performed by setting a > Property. ie, the Property would manage what ever updating needed to be > done. > > If you already have a Sub that does the updating then making it Public would > be a simple fix. > > Publishing an Interface with Methods and/or Properties is fine. But my > comfort level goes down with your comment "... *the* Sub that refreshes the > Form1 data ...". (The emphasis is mine.) > > If this Sub is used within the context of performing Form1 tasks it places > the extra burden on the developer (and latter maintainers) to be aware *the* > Sub might be called "out of context". I like to keep the two separated. But > that's drawing a fine line and certainly nothing to go to the mat over. :-) > > -ralph for the form2 routine. I would put the sub in a module and have one place to maintain the code.
Show quote
Hide quote
"gerryR" <gerryr@noSPAM.com> wrote in message Dang!news:eC0Wih80JHA.5556@TK2MSFTNGP03.phx.gbl... > Hi > > I'm working on a fairly simple app comprising of 4 forms. > > On the 1st form it shows some stats from 2 txt file it links too (how many > lines etc). > > On Form 2 it allows you to add info to one of the txt files. > > I open Form 2 when wanting to add another record using Form2.ShowDialog() > When I've added the link and clicked save I close form2 with Close(). The > the focus is back on form 1 > > Is there anything I can do to automatically refresh form1 so that the stats > update once I close form 2? > I completely skipped right over ".ShowDialog()". You're using VB.Net, correct? While my suggestions will work in the general, for specific code you need to post to a dotNet group. Perhaps microsoft.public.dotnet.languages.vb -ralph Sorry, my mistake, posted in the wrong group!
Thanks. Gerry Show quoteHide quote "Ralph" <nt_consultin***@yahoo.com> wrote in message news:uvLOBY90JHA.4416@TK2MSFTNGP05.phx.gbl... > > "gerryR" <gerryr@noSPAM.com> wrote in message > news:eC0Wih80JHA.5556@TK2MSFTNGP03.phx.gbl... >> Hi >> >> I'm working on a fairly simple app comprising of 4 forms. >> >> On the 1st form it shows some stats from 2 txt file it links too (how >> many >> lines etc). >> >> On Form 2 it allows you to add info to one of the txt files. >> >> I open Form 2 when wanting to add another record using Form2.ShowDialog() >> When I've added the link and clicked save I close form2 with Close(). >> The >> the focus is back on form 1 >> >> Is there anything I can do to automatically refresh form1 so that the > stats >> update once I close form 2? >> > > Dang! > > I completely skipped right over ".ShowDialog()". > > You're using VB.Net, correct? > > While my suggestions will work in the general, for specific code you need > to > post to a dotNet group. Perhaps > microsoft.public.dotnet.languages.vb > > -ralph > > > Since you didn't re-post, you may not have noticed that you didn't get the
full range of options. If you build that second form using the Dialog template (instead of a standard form) then you can get a return value from .ShowDialog that indicates the dialog result. Use that value to determine how the form needs to be updated. Show quoteHide quote "gerryR" <gerryr@noSPAM.com> wrote in message news:ejVPQU%230JHA.3780@TK2MSFTNGP04.phx.gbl... > Sorry, my mistake, posted in the wrong group! > > Thanks. > > Gerry > |
|||||||||||||||||||||||