|
|
Hi All,
I have written a small program that loops through a number of SQL Server Reporting Services reports using the vb.net WebBrowser object to display on a large flat screen TV.
All works well, on the first loop all data is shown correctly. However the following loops just show the same data, even if the base data has changed. How do I clear the cache on this.
I have tried displosing of the WebBrowser object when it gets to the end of each run, and then creating a new one. I have tried various different commands to clear cache. But the only ways I can refresh the data is to either restart the program, or wait until the page is fully loaded and then cause a page refresh (which looks a bit messy).
I would be grateful if anyone has any ideas on this.
Many thanks.
|
|
|
|
|
Perhaps you'll find this[^] article helpful.
My advice is free, and you may get what you paid for.
|
|
|
|
|
The alternative is that your code has a bug. Not having seen any, we can't tell for sure.
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]
I only read formatted code with indentation, so please use PRE tags for code snippets.
I'm not participating in frackin' Q&A, so if you want my opinion, ask away in a real forum (or on my profile page).
|
|
|
|
|
We had a similar issue, but not with reporting services reports. We tried setting the webpage expiration, telling it to never cache, disposing of the WebBrowser object (it does not dispose by the way, it hangs around attached to the calling process and then complains if you try to use it again), all to no avail.
The only solution was to remove the URL from the cache. If fact we ended up coding that into every call (remove from cache, then navigate), in the one class that everything else calls of course.
Here is the remove from cache code.
Public Shared Sub DeleteFromUrlCache(ByVal url As String)
Dim apiResult As Long = DeleteUrlCacheEntry(url)
If apiResult <> 0 Then
Return
End If
Dim lastError As Integer = Marshal.GetLastWin32Error()
If lastError = ERROR_ACCESS_DENIED Then
Throw New ApplicationException(String.Concat("Access denied: ", url))
End If
End Sub
Public Const ERROR_ACCESS_DENIED As Integer = 5
<DllImport("wininet.dll", SetLastError:=True)> _
Private Shared Function DeleteUrlCacheEntry(ByVal lpszUrlName As String) As Long
End Function
|
|
|
|
|
Thats brilliant, Man from U.N.C.L.E., just what I need. Seems to be a bit of a weekness in the WebBrowser control. But this work around is very good.
Thanks again.
|
|
|
|
|
Avoid inserting a duplicate record using vb.net
|
|
|
|
|
Just query the database to see if the data exists, if it doesn't, call your insert method.
This requires two calls to the server and could prove costly. You should do this in your Stored Procedure on the server.
I don't speak Idiot - please talk slowly and clearly
'This space for rent'
Driven to the arms of Heineken by the wife
|
|
|
|
|
Why don't you set up the database columns to not accept Duplicate values. This would negate 2 calls to the database and would make your inserts faster.
|
|
|
|
|
You are doing it again.
Please do not post the same question again, and again.
If you do not get an answer right away, have patience. People will answer in their own good time, not in yours.
When you do not understand the answer, or if you think that people have not understood your question, and you want to ask your question in other words, use the same post. At the bottom of each answer is a Reply link. Please, please, please, use it.
That way it will be easier for people to understand your problem and help you find a solution.
Creating a new post each time, is unnecessary and irritates a lot of people here.
My advice is free, and you may get what you paid for.
|
|
|
|
|
faisalali_78 wrote: Avoid inserting a duplicate record using vb.net
OK, I will.
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]
I only read formatted code with indentation, so please use PRE tags for code snippets.
I'm not participating in frackin' Q&A, so if you want my opinion, ask away in a real forum (or on my profile page).
|
|
|
|
|
Try also to avoid it using C++, C#, COBOL, PYTHON, VB6, VBA, JAVA, and any other language you can think of / know how to use.
My advice is free, and you may get what you paid for.
|
|
|
|
|
Great idea. Thanks for the tip!
|
|
|
|
|
avoiding duplication, how we can check before inserting data in a table in vb.net
|
|
|
|
|
Erhm... perform a select before you insert?
|
|
|
|
|
Hello,everyone!Need help about adding controls.Now I want to do this:if there is one pannel with some controls such as text box or combo box,when I clicked the button "Add" ,a same pannel wiht same controls would display under the first pannel;then the button "Add" go down below the second pannel.Then I clicked button once again,there will be three same peannel.
What I should do to achieve this ?Please give me some suggestions!Thanks a lot!
modified on Tuesday, May 18, 2010 10:44 PM
|
|
|
|
|
For a WinForm app, there seem to be two very different ways to add controls to a form:
- one is by using the "Visual Designer"
- the other is by adding some code that creates and adds controls at run-time.
However, the designer basically does two things for you:
1. it adds code to some file, which you may not have seen yet; if your form is called Form1, it consists of several files, including Form1.vb; the designer creates and controls Form1.designer.vb (you may have to fiddle some buttons/settings for Studio to show it in the Solution pane, can't remember the details).
2. and then it lets Studio execute such code, and that is how the controls suddenly appear on you form. (No they are not really drag-and-dropped, your drag operation tells the Designer to add and then execute code!)
So the suggestion is clear: do it once with designer, then go and peek inside that auto-generated file.
BTW: do not edit the designer files, just learn from them, and add similar things to your code.
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]
I only read formatted code with indentation, so please use PRE tags for code snippets.
I'm not participating in frackin' Q&A, so if you want my opinion, ask away in a real forum (or on my profile page).
|
|
|
|
|
Maybe it is not so curious, but it is to me at least.
I have a system.timers.timer declared and set up and then the code executes the final line in the routine is ProcessDuplicateMessage.
In the ProcessDuplicateMessage routine I get this error:
System.InvalidOperationException was unhandled by user code
Message="Cross-thread operation not valid: Control 'lblReviewValue' accessed from a thread other than the thread it was created on."
Source="System.Windows.Forms"
StackTrace:
at System.Windows.Forms.Control.get_Handle()
at System.Windows.Forms.Control.set_WindowText(String value)
at System.Windows.Forms.Control.set_Text(String value)
at System.Windows.Forms.Label.set_Text(String value)
at ....FImportMsgProcess.ProcessDuplicateMessage() in C:\....\FImportMsgProcess.vb:line 41
at ....FImportMsgProcess.FormLoadComplete(Object sender, ElapsedEventArgs e) in C:\....\FImportMsgProcess.vb:line 134
at System.Timers.Timer.MyTimerCallback(Object state)
Now obviously this is something to do with the timer, which I assume is running in a different thread, but my question is:
How do I return the process to the thread for the form before calling the next routine.
If I remove the system.timers.timer and add a forms.timer I don't get the problem.
Just curious really since I have cured the immediate problem by using a forms.timer instead and I would like to know for another occasion.
|
|
|
|
|
You're correct about the System.Timers.Timer "firing" your code on a seperate thread. Docs on the Timer class are here[^]
You also cannot access UI controls from any other thread other than the thread that created the control, i.e.: the UI (or startup) thread. A good article on the hows and whys of this can be found here[^].
|
|
|
|
|
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]
I only read formatted code with indentation, so please use PRE tags for code snippets.
I'm not participating in frackin' Q&A, so if you want my opinion, ask away in a real forum (or on my profile page).
|
|
|
|
|
When I find a good article, I run with it.
|
|
|
|
|
I'll try and create some more then...
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]
I only read formatted code with indentation, so please use PRE tags for code snippets.
I'm not participating in frackin' Q&A, so if you want my opinion, ask away in a real forum (or on my profile page).
|
|
|
|
|
Thanks Dave, and of course Luc for the article.
|
|
|
|
|
You're welcome.
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]
I only read formatted code with indentation, so please use PRE tags for code snippets.
I'm not participating in frackin' Q&A, so if you want my opinion, ask away in a real forum (or on my profile page).
|
|
|
|
|
I have just rewritten some shared code to put it into namespaces so that it will be easier to find.
After adding this stuff to namespaces now my code does not work because I am not importing the namespaces on each form.
I know that you can import namespaces for the entire project in properties but I am wondering is this something that will hurt performance.
Even if it will not hurt performance is there another way that I can only import the namespaces into the code files that actually use them because I am not wanting them at project level because while that will make my code work.., it defeats the reason for doing this to begin with which is to narrow the amount of things showing up in intellisense.
I hope that is clear enough if not please just tell me.
Thanks,
Brian
Humble Programmer
|
|
|
|