|
And then:
1. g = Me.CreateGraphics() is an expensive operation; why is it inside nested loops?
2. Graphics is one of those classes that offer a Dispose method; so if you create (or order creation) of an instance, you should dispose of it too.
Taken together, create once, dispose once.
Luc Pattyn [My Articles] Nil Volentibus Arduum
Fed up by FireFox memory leaks I switched to Opera and now CP doesn't perform its paste magic, so links will not be offered. Sorry.
|
|
|
|
|
|
Because you care about the environment, and don't want big, expensive objects lingering around, possibly holding unmanaged resources, huge memory blocks, system resources, whatever. If you created it and it has a Dispose, call it when done with it.
More[^]
Luc Pattyn [My Articles] Nil Volentibus Arduum
Fed up by FireFox memory leaks I switched to Opera and now CP doesn't perform its paste magic, so links will not be offered. Sorry.
|
|
|
|
|
In VBA for excel I can lift a table from a website using the QueryTables.Add method.
Here is what I use within an existing excel page...
With ActiveSheet.QueryTables.Add(Connection:= _
"URL;http://www.Website.com/Subdir", Destination:=Range("$A$1"))
.Name = "TableName"
.FieldNames = True
.RowNumbers = False
.FillAdjacentFormulas = False
.PreserveFormatting = True
.RefreshOnFileOpen = False
.BackgroundQuery = True
.RefreshStyle = xlInsertDeleteCells
.SavePassword = False
.SaveData = True
.AdjustColumnWidth = True
.RefreshPeriod = 0
.WebSelectionType = xlAllTables
.WebFormatting = xlWebFormattingNone
.WebPreFormattedTextToColumns = True
.WebConsecutiveDelimitersAsOne = True
.WebSingleBlockTextImport = False
.WebDisableDateRecognition = False
.WebDisableRedirections = False
.Refresh BackgroundQuery:=False
End With
As you can see, this polls the website and then looks for the table on that website that I need to connect to.
However, I would like to do the same thing within a VB.Net application.
What method would I need, and are there any pointers you good people could help me out with?
------------------------------------
I will never again mention that I was the poster of the One Millionth Lounge Post, nor that it was complete drivel. Dalek Dave
CCC Link[ ^]
Trolls[ ^]
|
|
|
|
|
You can use the MSHTML library. The web page is a html document - so you can use a CreateDocumentFromURL and then read the returned document as a html tree.
HTH
|
|
|
|
|
Thanks, I knew there had to be a way!
------------------------------------
I will never again mention that I was the poster of the One Millionth Lounge Post, nor that it was complete drivel. Dalek Dave
CCC Link[ ^]
Trolls[ ^]
|
|
|
|
|
I have a database with two tables Customers an loans. Customer table contain customer details like id, name, address etc. Loans table contain details of loans taken by customers like loan id, customer id, loan amount. I want to generate a report showing all customers and their loan amount regardless whether customers took loans or not. I tried to do this but it shows only customers who took loans. But i want to show all customers. How can i do this
|
|
|
|
|
That depends on the SQL query you used to get the data. Let's see it. Chances are, you're probably not using a LEFT OUTER JOIN to get all the records on the Customer side of the join.
BTW, this has nothing to do with VB.NET...
|
|
|
|
|
Dear all,
Please help to create pdf viewer in VB (only viewer - disable Save, SaveAs, Print options)
thanks
Jackson..
|
|
|
|
|
Please don't repost your question.
|
|
|
|
|
how to del. my repeated question
|
|
|
|
|
There should be a delete option in your post.
|
|
|
|
|
Not if there's a reaction to it - we wouldn't want orphaned reactions.
Bastard Programmer from Hell
|
|
|
|
|
Dear all,
Please help to create pdf viewer in VB (only viewer - disable Save, SaveAs, Print options)
thanks
Jackson..
|
|
|
|
|
|
thanks. but that codings is allow to SaveAs the file to another location..
actually wat i want na... that pdf viewer is not give access to do saveAs, Print, etc .......only to view the pdf file..
thanks..
|
|
|
|
|
..that means that there's a physical file, doesn't it. What's to stop me from opening that file using Acrobat?
Bastard Programmer from Hell
|
|
|
|
|
Adobe reader is give the permission to SaveAs & print.. but i need to view the pdf file without the option SAVEAS & Print...
|
|
|
|
|
So? I'll simply download CutePDF to print the file.
If the file is on the computer of the user, then the user becomes the owner of that file. You can't prevent the owner from manipulating his/her files.
Bastard Programmer from Hell
|
|
|
|
|
I'm converting an old VB6 application to VB2010 and I've run across a situation I can't seem to figure out from the books I have and web posts so your help will be appreciated.
The problem is iterating through a recordset assigning values to 20+ fields and then doing an update batch.
So far all I've been able to figure out is to use an OleDBCommand class and ExecuteNonQuery method and create individual UPDATE SQL commands for each of the 20+ fields I'm dealing with. I'm hoping there is a simpler way similar to the old ADO UpdateBatch.
Here's sort of what my old VB6 code looks like:
Set Conn = New ADODB.Connection
Conn.Open strDSNName
Set rs = New ADODB.Recordset
gstrSQL = "SELECT * from Judges;"
Set rs.ActiveConnection = Conn
rs.CursorLocation = adUseClient
rs.CursorType = adOpenStatic
rs.LockType = adLockBatchOptimistic
rs.Open strSQL
Conn.Close
Set Conn = Nothing
rs.MoveFirst
Do Until rs.EOF
rs.Fields("Response3").Value = rs.Fields("Response2").Value
rs.Fields("AssignedCat3").Value = rs.Fields("AssignedCat2").Value
...
20 more lines setting field3 to field2
...
rs.MoveNext
Loop
Set Conn = New ADODB.Connection
Conn.Open strDSNName
rs.ActiveConnection = Conn
rs.UpdateBatch
rs.close
set rs = nothing
conn.close
set conn.close
Thanks
|
|
|
|
|
MSDN[^] has a page on the topic.
Bastard Programmer from Hell
|
|
|
|
|
Thank you for taking the time to point me in this direction. I have been looking at the dataadapter. Unfortunately (for me), having never seen a VB snippet that applies to my situation I'm sort of lost, especially since I have never used "Parameters" in an update statement. It is sometimes difficult for me to understand a concept without a real life example.
Thanks (still hoping for a code sample from someone that sort of addesses my VB6 snip)
|
|
|
|
|
Member 8605177 wrote: still hoping for a code sample
Also on MSDN, using a DataTable [^]
Bastard Programmer from Hell
|
|
|
|
|
since I've never users parameters i have a question - assume my table consists of 20 fields. does that mean I need to define 20 parameters, one for each field?
|
|
|
|
|
Yup.
Bastard Programmer from Hell
|
|
|
|