|
RichardBerry wrote: 1) How does a try catch block function? Could you relate it in any way to the following:
If (exception occurs while doing something) then
Goto Catch
else
Contine executing
Endif
Well, have a you look at a Try...Catch with multiple catches and a Finaly block:
Try
... do something that might fail
Catch IOException ex
... handle the specific exception
Catch Exception ex
... handle all other .NET exceptions
Catch
... handle any other exception
Finally
... always runs
End Try
If any exception is raised in the Try block, execution immediately goes to the first Catch block where the type of the exception matches. An IOException would be handled by the Catch IOException block, but an ArgumentNullException would be handled by the Catch Exception block (as ArgumentNullException inherits from Exception ). If you are calling an external library it might throw non-.NET exceptions, they would go to the Catch block.
The Finally block is used to make sure that anything used in the Try block is closed and disposed properly. The Finally block always runs, regardless if there was an exception or not.
RichardBerry wrote: 2) What is good practice with respect to the amount of code inside a Try .. Catch Block. Is it bad to have a lot of code (why?) and is is bad to call another procedure from withing a Try Catch Block
There are two uses for Try...Catch blocks; wide and narrow. A wide block can be used to handle any exceptions from an entire application, or from a section of an application. A narrow block should be used to handle the specific exceptions that you anticipate might occur, and they should surround as little code as possible.
You can't write code to specifically handle any exception that possibly can occur, so use narrow blocks to catch the ones that you anticipate, and wide block to catch anything unexpected.
---
b { font-weight: normal; }
|
|
|
|
|
|
Hi All
Please healp me
I want to creat a automatic or in button click new folder at run time
i have using VB 6.0
Thank you!!!!!!!!
|
|
|
|
|
Hi
Suppose u wanna create folder namely wasim in c:\ directory paster this code in click event
Private Sub Command1_Click()<br />
MkDir ("c:\wasim")<br />
End Sub
Hope answer to the question
bye
pitchu
|
|
|
|
|
Hi
Cant get diffrence between chr()and chr$()in VB6
Similar is case with other flavours like
left and left$, etc
hope to get some reply soon
bye
pitchu
|
|
|
|
|
That's because there is no difference! The $ functions are identical to the non-$ versions. The $ are preserved for backwards compatibility to previous versions of VB and older BASIC language standards.
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
Dave,
My understanding of the $ sign is telling VB that you know that want a string returned. If you leave the $ sign off, VB has to evaluate what datatype it needs to convert it to when placing it in the variable(or whatever) that will hold the value. If your wrong and the variable is not type of string VB will convert it appropriately for you(if possible) but if your right it doesn't have to do an implicit conversion.
Nathan
|
|
|
|
|
Not quite. Chr returns a string, period. There is no evaluation of the return value or implicit conversions by the function There is no difference between Chr and Chr$ . The dollar sign is just a hold over form the old days of BASIC.
Wanna see? Chr docs[^]...Left docs[^]
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
Thnks Dave
I do have studied BBC BASIC Language and was somewhat sure that it might be used for compatibility
Once more Thnks
bye
pitchu
|
|
|
|
|
After converting VS2003 created sample to VS2005.we try to debug the application It gives the debugger error.
For example download this sample and try to run
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnexcl2k2/html/odc_xlrtdvbnet.asp
This application open's an Excel.In Excel formula bar paste the following formula
=RTD("Stock.Quote", , "MSFT", "Open")
=RTD("Stock.Quote", , "MSFT", "Last")
formula will return some random value in Excel.For this sample I was able to debug and run in VS2003 but in VS2005 Iam getting debugger error.
Thanks,
Prakash
|
|
|
|
|
Hello
I have a combo box with a list of clients. I need to do search on the the PK to get the details of the client. This worked fine, however the customer wants the combo box to be in sorted order. So i set the property for the combo box to sorted. Now that I have done that the client names are in order but do not corrspond to the value member. In the database the clientID is indentity incremented integer.
<br />
Me.cboClients.DataSource = ds1.Tables(0).DefaultView<br />
<br />
Me.cboClients.DisplayMember = "Name"<br />
Me.cboClients.ValueMember = "ClientID"<br />
in the selectionchangedcommitted event i have this
<br />
client = Me.cboClients.SelectedValue()<br />
'calls procedures to search for client's details<br />
Is there an easy way to get a PK value form a client that is selected from the combo box. I can't search for the client name, as some clients have the same name. Not unique.
Many thanks in advance,
Steve
|
|
|
|
|
I don't remember ever having this problem, but the worksaround is easy enough.
If the customer wants the combobox sorted, just have the SQL sort the data when it's retrieved from the database. Then you can bind your ComboBox to a pre-sorted list and not worry about the ComboBox doing it.
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
Thanks for your help.
This is the solution
SELECT * FROM Clients
ORDER BY Name ASC
|
|
|
|
|
Dear All,
I am new to this COM usage in VB6. I created a COM object and it was given me a dll file and also installed to the computer so I can get the dll in References in VB6.
I typed the example code given in the MatLab and also a sample code Building COM Components Using MATLAB - Part I by A Riazi, But It giving me an error message called "Automation Error. The specified module could not be found".
Please help me to go throught this.
Thaks All
Prageeth
Dhanushka P
Prageeth
|
|
|
|
|
What kind of dll is it? Win32? .Net?
Have u reged the file?
Try following: Close your developmentsuite und reg the dll. then u check it at u're references and try it again.
|
|
|
|
|
I try to change a treenode text value! How I can do as well as window: Press rightmouse button, select "Rename" and OK!
Tell me! I'm a beginner in VB.NET!
Thanks!
THT
|
|
|
|
|
select a node.. store this in a variable.. and renames it with mynode.Text = "test"
|
|
|
|
|
Simple question;
Where is the selection rectangle? How do i select multiple controls while designing a web page using VB.NET 2005?
Do i have to hold control and click every single control on my form?
|
|
|
|
|
That's what I usually do.
|
|
|
|
|
Hi,
How can i draw a string on a picturebox and let the user define the location of the text? Cuz im trying to make a program to create covers for cd's but if the user can't define the location of the text the program is pretty useless Any ideas, anyone?
--Zaegra--
|
|
|
|
|
You need to ditch the picturebox, it's just for newbies to show pictures with. Draw your bitmap in the paint event of your form. Then, you can draw a string on top of it, where-ever you like.
|
|
|
|
|
I have a small application that I've wrote to track company assets and I have a few employees that have troubles seeing the screen. We've increased the DPI setting: to 120dpi from 96dpi. My anchors and docking attributes are set and I'm still having a deformed application. Has anyone run into this problem or have any suggestions on a resolution.
Thanks.
|
|
|
|
|
How do you mean "deformed"? Do you have a screenshot?
|
|
|
|
|
I have a few users that need extra large fonts and they goto 120 DPI to see the screen and I'm getting this on there PC's prtscn[^]
|
|
|
|
|
I have created a program in Excel that makes a set of tournament brackets for head to head competition. I've created and recorded the necissary Macros to get the functionality that I wish to implement. However when I try to create the Form for the user to select the options for the brackets, I continue to receive errors related to the frames on the form, but it doesn't allow me to remove them. What I would like to do is transfer this project to VB.Net and only use Excel as the bracket visual/print out. In my dealings with VB6, I remember being able to draw lines and shapes on the Forms as well as being able to print the Forms. However, I've been unable to find this utility in VB.Net. If I can find this function, I would consider ditching Excel all together. I am using VS'03 for my .Net development. Any suggestions?
|
|
|
|