Click here to Skip to main content
16,005,037 members
Home / Discussions / Visual Basic
   

Visual Basic

 
AnswerRe: Calculate total hours between two times.............. Pin
The ANZAC19-Mar-07 22:49
The ANZAC19-Mar-07 22:49 
GeneralRe: Calculate total hours between two times.............. Pin
Member 387988119-Mar-07 22:55
Member 387988119-Mar-07 22:55 
AnswerRe: Calculate total hours between two times.............. [modified] Pin
TwoFaced20-Mar-07 7:12
TwoFaced20-Mar-07 7:12 
Questionchange string back to byte Pin
angelagke19-Mar-07 18:36
angelagke19-Mar-07 18:36 
AnswerRe: change string back to byte Pin
Dave Kreskowiak20-Mar-07 4:35
mveDave Kreskowiak20-Mar-07 4:35 
AnswerRe: change string back to byte Pin
Kschuler20-Mar-07 8:00
Kschuler20-Mar-07 8:00 
AnswerRe: change string back to byte Pin
emiaj14-Apr-07 7:45
emiaj14-Apr-07 7:45 
QuestionReturn a value when an exeception happens Pin
steve_rm19-Mar-07 18:29
steve_rm19-Mar-07 18:29 
Hello,

I have some code below. It searches records for the same manufacturer and model. If it finds a record that has the same manufacturer and model it will return true. Else it will return false.

However, if there is a problem and the function will need to return something. What would would I return. As I have to check the boolean if it is true or false , and do something. However, if there is an exception, I don't what to do anything with the true or false. Maybe roll back operation could not be completed, like in transactions.


<br />
'Check to see if the manufacturer and model name is the same. <br />
Private Function CompareManufacturer_Model() As Boolean<br />
        Dim find As String = String.Empty<br />
        Dim index As Integer = 0<br />
<br />
        Try<br />
            find = String.Format("Manufacturer = {0} AND Model = {1}", Me.txtManufacturer.Text, Me.txtModel.Text)<br />
            Me.bsEquipment.Filter = find<br />
            If (Me.bsEquipment.Count > 0) Then<br />
                'There is a manufacturer and model that is the same so increment the quantity<br />
                Return True<br />
            Else<br />
                'Manufacturer and model don't exist so add a new one.<br />
                Return False<br />
            End If<br />
        Catch ex As Exception<br />
            MessageBox.Show(ex.Message)<br />
            'What would i return here<br />
        End Try<br />
    End Function<br />


Many thanks,

Steve
AnswerRe: Return a value when an exeception happens Pin
Christian Graus19-Mar-07 19:04
protectorChristian Graus19-Mar-07 19:04 
AnswerRe: Return a value when an exeception happens Pin
Tirthadip19-Mar-07 19:15
Tirthadip19-Mar-07 19:15 
GeneralRe: Return a value when an exeception happens Pin
Dave Kreskowiak20-Mar-07 4:32
mveDave Kreskowiak20-Mar-07 4:32 
AnswerRe: Return a value when an exeception happens Pin
Johan Hakkesteegt21-Mar-07 4:26
Johan Hakkesteegt21-Mar-07 4:26 
QuestionMake usercontrol that doesn't steal focus Pin
TwoFaced19-Mar-07 14:06
TwoFaced19-Mar-07 14:06 
AnswerRe: Make usercontrol that doesn't steal focus Pin
Christian Graus19-Mar-07 16:19
protectorChristian Graus19-Mar-07 16:19 
GeneralRe: Make usercontrol that doesn't steal focus Pin
TwoFaced19-Mar-07 19:11
TwoFaced19-Mar-07 19:11 
QuestionMouse scroll wheel and MSHFlexGrid Pin
Barry True19-Mar-07 10:20
Barry True19-Mar-07 10:20 
AnswerRe: Mouse scroll wheel and MSHFlexGrid Pin
Dave Kreskowiak19-Mar-07 10:36
mveDave Kreskowiak19-Mar-07 10:36 
GeneralRe: Mouse scroll wheel and MSHFlexGrid Pin
Barry True27-Apr-07 8:29
Barry True27-Apr-07 8:29 
QuestionWhich .DLL is used to delete IE7 cache? Pin
gacman19-Mar-07 9:35
gacman19-Mar-07 9:35 
Questiondataset.acceptchange method.. [modified] Pin
manni_n19-Mar-07 7:59
manni_n19-Mar-07 7:59 
AnswerRe: dataset.acceptchange method.. Pin
Dave Kreskowiak19-Mar-07 8:51
mveDave Kreskowiak19-Mar-07 8:51 
GeneralRe: dataset.acceptchange method.. Pin
manni_n19-Mar-07 9:04
manni_n19-Mar-07 9:04 
GeneralRe: dataset.acceptchange method.. Pin
Dave Kreskowiak19-Mar-07 9:27
mveDave Kreskowiak19-Mar-07 9:27 
GeneralRe: dataset.acceptchange method.. Pin
manni_n19-Mar-07 10:07
manni_n19-Mar-07 10:07 
GeneralRe: dataset.acceptchange method.. Pin
Dave Kreskowiak19-Mar-07 10:41
mveDave Kreskowiak19-Mar-07 10:41 

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.