SEARCH YOUR SOLUTION HERE  

PART II : VB.NET Why doesn't FINALLY execute

Oops! Forgot a line of code!!!!! Sorry. This code example should display my problem properly. Why does the finally clause in the Test method (below) NOT execute in my "foo" example, but DOES execute in my "bar" example 'Test-Finally does ...

Posted On: Saturday 10th of November 2012 05:39:48 AM Total Views:  328
View Complete with Replies




Related Messages:

selecting from database in particular column   (290 Views)
how can i view to selected item from the database i have a two txtbox txtMonth and txtYear how can i view the selected month and year from the database my code is sql="select * from inventory where invmonth=val(txtMonth.text)and invYear=val(invyear.text)" pls help im not good in programming sorry for the wrong code
select part of string   (185 Views)
Is it possible to find a certain part in a string I need the last part of the string which is after the last backslash in the string. The string can contain more than one backslah but i never ...
coding to make access field part of table in VB   (280 Views)
Hopefully somebody knows something about this, cause i can't figure it out. I'm going to try to be as plain and simple. I have an address coming in through USB...but only when a sensor is triggered. The VB program loops ...
extract part of string   (254 Views)
G'day , Using VB6, I want the best way to extract the filename "\20040102.txt" from this string "C:\TEMP\SHARES\20040102.txt". The InStr function returns a Variant (Long) specifying the position of the first occurrence of one string within another. But that's from ...
part 2 of my question   (214 Views)
sample Date Payee Description BTR SAW ABC ##/##/## XXXXX XXXXXXXXXXX XXX XXX XXX BTR , SAW and ABC is data from Table also...
How many folders can be created in a particular folder on a computer in the internet?   (379 Views)
I want to create about 25000 folders through script on a server in the internet, and name it from 1 to 25000. Is there any problem in doing so Will be system be slow Or is there anylimitation to the number of folders that can be created
Probl?me de d?part avec REAL Basic   (369 Views)
Peut-tre en mettant ce message en franais aurai-je une rponse Bonjour, Je dveloppe des logiciels pour PC, l'aide de Visual Basic. J'ai actuellement de la demande pour les mmes logiciels en Mac. On m'a conseill REAL Basic. J'ai ...
Extracting a particular value from sql2000 database & then updatin   (391 Views)
Private Sub Command1_Click() Dim conn1 As New ADODB.Connection Dim cmd1 As New ADODB.Command Dim rs1 As New ADODB.Recordset Dim amnt As Double Dim d_value As Double Dim accessconnect As String Dim accnt_no As String Dim stSQL As String accessconnect = " Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=master;Data Source=POOJA-D4FD585E2\SQL2000" conn1.ConnectionString = accessconnect conn1.Open accnt_no = Val(Text1.Text) Text2.Text = amnt If Len(Text1.Text) > 0 And Len(Text2.Text) > 0 Then cmd1.ActiveConnection = conn1 cmd1.CommandText = " select balance from account where account_number= ' " & accnt_no & " ' " Set rs1 = cmd1.Execute dValue = rs1("balance") stSQL = " update account set balance = balance + ' " & amnt & " ' where account_number = ' " & accnt_no & " ' " conn1.Execute stSQL conn1.Close MsgBox (" AMOUNT DEPOSITED SUCCESSFULLY ") Else MsgBox ("Enter some value") End If End Sub Private Sub Text1_KeyPress(KeyAscii As Integer) If Not ((KeyAscii >= 48 And KeyAscii = 65 And KeyAscii = 48 And KeyAscii
Access of third party object   (219 Views)
I'm using QuickTestProfessional, version 11, to test a proprietary software product written predominately in VB6. One of the objects is a Developer Express product. The QTP object spy identifies it as "XpressTreeList 1.2 by Developer Express". In more 'typical' ActiveX objects I can do something similar to .celldata(row,column) to access the text in a specific cell for data comparison or population but I can't find a way to do it with this thing. Any hints
Extracting a particular value from sql2000 database & then updatin   (206 Views)
Private Sub Command1_Click() Dim conn1 As New ADODB.Connection Dim cmd1 As New ADODB.Command Dim rs1 As New ADODB.Recordset Dim amnt As Double Dim d_value As Double Dim accessconnect As String Dim accnt_no As String Dim stSQL As String accessconnect = " Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=master;Data Source=POOJA-D4FD585E2\SQL2000" conn1.ConnectionString = accessconnect conn1.Open accnt_no = Val(Text1.Text) Text2.Text = amnt If Len(Text1.Text) > 0 And Len(Text2.Text) > 0 Then cmd1.ActiveConnection = conn1 cmd1.CommandText = " select balance from account where account_number= ' " & accnt_no & " ' " Set rs1 = cmd1.Execute dValue = rs1("balance") stSQL = " update account set balance = balance + ' " & amnt & " ' where account_number = ' " & accnt_no & " ' " conn1.Execute stSQL conn1.Close MsgBox (" AMOUNT DEPOSITED SUCCESSFULLY ") Else MsgBox ("Enter some value") End If End Sub Private Sub Text1_KeyPress(KeyAscii As Integer) If Not ((KeyAscii >= 48 And KeyAscii = 65 And KeyAscii = 48 And KeyAscii
How do I extract the bracketed part(s) of a string in vb.net   (480 Views)
I am trying to extract the bracketed region of a string into another string. For example (abc) - (xyz) How would I extract the 'abc' and 'xyz' into two separate strings This is what I have tried to do so far: If (operation.Contains("(")) Then Dim first = operation.Split("(") Dim firsteb = operation.Split(")") But I then got confused because I could not work out how to avoid it from going to the first and last brackets in the above example
VB6.0: Searching and reporting a particular record from database   (277 Views)
This Code segment enable you to connect to database, search and and report a particular record from database. Private Sub Cmdfind_click() Dim con as ADODB.Connection Dim rs as ADODB.RecordSet Set con = New ADODB.Connection Set rs = New ADODB.RecordSet con.Open "Connection String" con.CursorLocation = AdUserClient rs.Open "SELECT *FROM tablenameToSearchfrom WHERE FieldnameToSearchfrom= ' " &text1.text(thetxtboxTosearchwith)& " ' ", con, OpenDynamic, AdOptimistic if rs.EOF = False and rs.BOF = False Then labelname.caption = rs!fieldname in database eg. rs!name labelsex.caption = rs!sex labelMatNo.caption= rs!matno Else Msgbox "Record not found", vbCritical + vbOkOnly, "Error" End If End Sub 'To get connection string, goto component insert ADO data Control, place it on the form, the right click, select properties. Follow procedure till test connection, then copy the connection string and paste.
Help with code to find part of text   (270 Views)
I am developing a prog to keep track of all my movies stored in various folders, external drives and dvd's I have manged to include code to extract the information from the movie like resolution, aspect ratio and other info. I have now added cmd button to plat the movie from the prog in Media Player and GOM player based on the older and movie name stored in a text box. I now need to specify not to open the player when the text field is empty or not like a valid directory. for instance if the text box = "" or not like ":\" (D:\Movies\Thrillers\Edge of Darkness.avi) I have tried QuoteIf Location.Text = "" Or Location.Text not like "%:\%") Then msgbox "No location allocated to this Movie" _ & vbCrLf & vbCrLf & "Please allocate correct location." Exit Sub
Pricipal Interest part of Loan Calculator PMT method not computing cor   (221 Views)
Option Strict Off Option Explicit On Public Class frmMain 'declaring the module-level variables Private mdblDownPaymentTotal, mdblClosingCostTotal, mdblCashtoCloseTotal, mdblPrincipalInterestTotal, mdblPropertytaxesTotal, _ mdblInsuranceTotal, mdblMonthlyPaymentTotal, mdblperiod As Double Private mdblPurchasePrice, mdblInterestRate As Double Private Sub btnCalculate_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnCalculate.Click 'accept the purchase price input mdblPurchasePrice = System.Convert.ToDouble(txtPurchasePrice.Text) txtPurchasePrice.Text = mdblPurchasePrice.ToString("c") 'accept the Interest rate input, send to mdblinterestrate as #.## while display full number mdblInterestRate = System.Convert.ToDouble(txtInterestRate.Text / 100) txtInterestRate.Text = mdblInterestRate * 100.ToString("##") 'determines the downpayment mdblDownPaymentTotal = (mdblPurchasePrice * 0.2) lblDownPaymentTotal.Text = mdblDownPaymentTotal.ToString("c") ''determines the closing cost mdblClosingCostTotal = (mdblPurchasePrice * 0.025) lblClosingCostTotal.Text = mdblClosingCostTotal.ToString("c") ' determines cash to close mdblCashtoCloseTotal = (mdblClosingCostTotal + mdblDownPaymentTotal) lblCashtoCloseTotal.Text = mdblCashtoCloseTotal.ToString("c") 'determine the principal and interest mdblperiod = 360 'mdblPrincipalInterestTotal = Financial.Pmt(0.07, 360, 1000, 0) mdblPrincipalInterestTotal = Financial.Pmt(mdblInterestRate, mdblperiod, mdblPurchasePrice, 0) mdblPrincipalInterestTotal = System.Math.Abs(mdblPrincipalInterestTotal) lblPrincipalInterestTotal.Text = mdblPrincipalInterestTotal.ToString("c") 'determine property taxes mdblPropertytaxesTotal = ((mdblPurchasePrice * 0.025) / 12) lblPropertyTaxesTotal.Text = mdblPropertytaxesTotal.ToString("c") 'determine insurance mdblInsuranceTotal = ((mdblPurchasePrice * 0.008) / 12) lblInsuranceTotal.Text = mdblInsuranceTotal.ToString("c") 'determine monthly payment mdblMonthlyPaymentTotal = mdblPrincipalInterestTotal + mdblPropertytaxesTotal + mdblInsuranceTotal lblMonthlyPaymentTotal.Text = mdblMonthlyPaymentTotal.ToString("c") End Sub Private Sub btnExit_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnExit.Click 'Close the Application Me.Close() End Sub Private Sub btnClear_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnClear.Click 'Clears the labels and input boxes and puts focus back on purchase price box txtPurchasePrice.Focus() txtPurchasePrice.Text = "" txtInterestRate.Text = "" lblDownPaymentTotal.Text = "" lblClosingCostTotal.Text = "" lblCashtoCloseTotal.Text = "" lblPrincipalInterestTotal.Text = "" lblPropertyTaxesTotal.Text = "" lblInsuranceTotal.Text = "" lblMonthlyPaymentTotal.Text = "" End Sub End Class Ok, the problem that I'm having is this: When I enter $1000 for PurchasePrice and 7% for Interest rate the PrincipalInterest returns $70.00 instead of the correct answer which is $466.67 Am I missing something but I thought the PMT function was supposed to take care of all the computations. I've tried both formats: Literal: PMT(.07, 360, 1000, 0) and Variable mdblPrincipalInterestTotal = Financial.Pmt(mdblInterestRate, mdblperiod, mdblPurchasePrice, 0) and neither one is returning the correct value. I'm using VB .NET 2005.
Program only function partially on other PC   (367 Views)
i checked the schedule log file, it shows exit code (1), it seem return some error when running the job. i tested the program by manual run the .exe or manual run .job sometimes the program do fully run with extracting data from both database and create stockIn.csv, but most of the time, it by pass the 2nd database.
pausing script while other parts finish   (246 Views)
I've looked at Wait()... But that seems to just be a pre-defined amount of time to wait Since changing some code, it's become necessary to have my code wait until an external .bat file finishes processing. Sometimes this can be a matter of seconds, but sometimes it can take minutes. So, obviously...the wait() method wouldn't be the way to go as I'd have no idea how long it would take to profile the disc with the MD5 check. This is a snippet of my existing code (my full code is around 14 pages, I think)--this shows the sequence of events. I have it prompt the user before clicking OK to make sure they entered everything correctly. If the user hits OK (to continue), it then will run the .bat file, which, as I mentioned, can run very quickly or very slowly depending on what's on the disc. The problem arises in that it wants to import the data from the CSV .txt file before the .bat file is finished writing the contents to the text file, so only some of the data gets entered. I need to force the rest of the code to wait until the .bat file is done. Suggestions [edit: for some reason, it keeps screwing up my code...deleting parts of it & submitting the you entered: "&vb script: Crap...it's still doing the annoying stuff...even outside the code tags. I'm adding semicolons to the start of each line to hopefully fool it. Obviously, the semicolons should not be there (I know) ;BeforeScriptRun: ; lastPrompt = MsgBox("You entered: " & vb script: BeforeScriptRun: lastPrompt = MsgBox("You entered: " & vb script: 'THIS CODE IS USED TO IMPORT THE DATA FROM THE CSV .TXT FILE WRITTEN BY FILELIST.EXE: If sFilename False Then Sheets("Temp").Select '
How select a particular row from database(ms access)   (294 Views)
hello, I making a software in visual basic6 using database microsoft access. In a form codding i want to select a perticular row by the using syntax rs.open"select * from table1", cn, adOpenKeyset, adLockOptimistic i m trying a lot of but not able to do this.... my database table1 as follws- ID option status value description 1 custom_category on 8 General Knowledge 2 que_time limited 1 3 negetive_marking on 0.5 4 scorecard_title Quiz System Scorecard Sharma group, 2011 version1.0 i m trying follows- rs.Open "select first 3 * from table1", cn, adOpenKeyset, adLockOptimistic rs.Open "select first * from table1 where field=3", cn, adOpenKeyset, adLockOptimistic for example i want to select directly 3rd row.than what i do
How to search for a particular word in a text file   (162 Views)
pls help me
Function that searches part of a string   (231 Views)
Guys I need a function or method that i could use to search for part of a string from a data base. For instance a statement that does the same as the SQL like statement. i.e. LIKE %AN%. Considering a Database that has a Name field with a record "Mthulisi", it should find a result if somone entered only "Mth" or jus "uli" Thank you
separting numbers   (153 Views)
So, I'm back. This question may show my ignorance, but I have to ask. How can I separate numbers for instance, if I had 123456789 and I wanted to perform calculations on just the 4 or 9 or whatever. How can I separate the numbers