Click here to Skip to main content
15,881,715 members
Home / Discussions / Visual Basic
   

Visual Basic

 
AnswerRe: Changing the label text property with code. Pin
Clark Kent12328-Feb-12 9:33
professionalClark Kent12328-Feb-12 9:33 
QuestionHow to check the Status of Printer directly connected to COM port Pin
singhsunil1325-Feb-12 0:08
singhsunil1325-Feb-12 0:08 
AnswerRe: How to check the Status of Printer directly connected to COM port Pin
Dave Kreskowiak25-Feb-12 6:16
mveDave Kreskowiak25-Feb-12 6:16 
GeneralRe: How to check the Status of Printer directly connected to COM port Pin
singhsunil1325-Feb-12 20:51
singhsunil1325-Feb-12 20:51 
AnswerRe: How to check the Status of Printer directly connected to COM port Pin
Luc Pattyn26-Feb-12 3:00
sitebuilderLuc Pattyn26-Feb-12 3:00 
Questionhow to close a form instantly Pin
alejx23-Feb-12 16:35
alejx23-Feb-12 16:35 
AnswerRe: how to close a form instantly Pin
Luc Pattyn23-Feb-12 17:18
sitebuilderLuc Pattyn23-Feb-12 17:18 
QuestionSuggestion for try...Catch block Pin
alejx23-Feb-12 10:23
alejx23-Feb-12 10:23 
Hello !
I have an application in VB.net 2010 / Entity Framework with database in SQL server 2008R2. The application works , but doesn't handle the situation when connection with server is lost during a transaction.For example if i press a button that select some records from database but before the sql server for example become innaccesible on network , the application crash. I want to handle this situation to keep running the application and display only error messages.I start to modify my code and adding Try...Catch blocks.But sometime i don't know where is better to put try... Catch and what to do with the form where the exception occur.For example :
---------------------
Private sub ......
Instruction 1
Instruction 2
...
instruction 5 ( Read from database)
Instruction 6
----
instruction 8 ( Write to database
------
-----
End sub

So is better to start try on the beginning of sub and End try to the end of sub ?The problem is that instruction 1,2,3,4 do something on the form and if instruction 5 has exception and is not executed the form may have wrong data and the instruction 8 if is executed correctly ( for example if the connection with server is ok on this instruction) may have other errors because instruction 5 is not executed.So can you suggest that is better to close the form if an exception (lost sql server connection) occur ?

Can you give me a suggestion?

yhank you.

modified 23-Feb-12 16:55pm.

AnswerRe: Suggestion for try...Catch block Pin
Luc Pattyn23-Feb-12 17:30
sitebuilderLuc Pattyn23-Feb-12 17:30 
GeneralRe: Suggestion for try...Catch block Pin
alejx24-Feb-12 1:57
alejx24-Feb-12 1:57 
GeneralRe: Suggestion for try...Catch block Pin
Eddy Vluggen24-Feb-12 9:49
professionalEddy Vluggen24-Feb-12 9:49 
GeneralRe: Suggestion for try...Catch block Pin
alejx25-Feb-12 7:46
alejx25-Feb-12 7:46 
GeneralRe: Suggestion for try...Catch block Pin
Eddy Vluggen25-Feb-12 8:27
professionalEddy Vluggen25-Feb-12 8:27 
GeneralRe: Suggestion for try...Catch block Pin
alejx25-Feb-12 8:34
alejx25-Feb-12 8:34 
GeneralRe: Suggestion for try...Catch block Pin
Eddy Vluggen25-Feb-12 8:41
professionalEddy Vluggen25-Feb-12 8:41 
QuestionRunning Photoshop Action Pin
Pasan14822-Feb-12 5:24
Pasan14822-Feb-12 5:24 
AnswerRe: Running Photoshop Action Pin
Simon_Whale22-Feb-12 6:06
Simon_Whale22-Feb-12 6:06 
GeneralRe: Running Photoshop Action Pin
Pasan14822-Feb-12 6:37
Pasan14822-Feb-12 6:37 
AnswerRe: Running Photoshop Action Pin
Eddy Vluggen23-Feb-12 8:46
professionalEddy Vluggen23-Feb-12 8:46 
GeneralRe: Running Photoshop Action Pin
Agecanonix23-Feb-12 10:51
Agecanonix23-Feb-12 10:51 
GeneralRe: Running Photoshop Action Pin
Dave Kreskowiak23-Feb-12 12:22
mveDave Kreskowiak23-Feb-12 12:22 
GeneralRe: Running Photoshop Action Pin
Pasan14824-Feb-12 4:36
Pasan14824-Feb-12 4:36 
Questionpassing value from popup to column gridview Pin
C#Coudou20-Feb-12 22:49
C#Coudou20-Feb-12 22:49 
QuestionLoad Connection String from a File Pin
Midnight Ahri20-Feb-12 16:14
Midnight Ahri20-Feb-12 16:14 
AnswerRe: Load Connection String from a File Pin
Luc Pattyn20-Feb-12 16:26
sitebuilderLuc Pattyn20-Feb-12 16:26 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.