Click here to Skip to main content
15,891,184 members
Home / Discussions / Visual Basic
   

Visual Basic

 
GeneralRe: Making some columns of datagrids uneditable Pin
hsprasain6-Jul-07 5:51
hsprasain6-Jul-07 5:51 
GeneralRe: Making some columns of datagrids uneditable Pin
Johan Hakkesteegt8-Jul-07 19:56
Johan Hakkesteegt8-Jul-07 19:56 
GeneralRe: Making some columns of datagrids uneditable Pin
hsprasain9-Jul-07 18:07
hsprasain9-Jul-07 18:07 
GeneralRe: Making some columns of datagrids uneditable Pin
Johan Hakkesteegt10-Jul-07 0:12
Johan Hakkesteegt10-Jul-07 0:12 
GeneralRe: Making some columns of datagrids uneditable Pin
hsprasain10-Jul-07 5:29
hsprasain10-Jul-07 5:29 
GeneralRe: Making some columns of datagrids uneditable Pin
Johan Hakkesteegt10-Jul-07 20:25
Johan Hakkesteegt10-Jul-07 20:25 
GeneralRe: Making some columns of datagrids uneditable Pin
hsprasain12-Jul-07 17:54
hsprasain12-Jul-07 17:54 
QuestionView and Review my looping code Pin
steve_rm5-Jul-07 7:27
steve_rm5-Jul-07 7:27 
Hello,

[VS 2005]

I have developed some code that uses a nested for loop. This code works the way it is supposed to. However, for maintaining this code I think i have not developed it in a efficient manor.

The way that the code works is that I have a database table and I am looping through the records finding the matching incidentID that have been delivered, so an e-mail can be sent.

As I am new to programming I am looking for a better way to do the same job.
I am sure there is a better technique for doing this, using some advance features of visual studio.

I am not looking for anyone to write me any code, just to review and give me an idea of another better technique.

Private Sub IncidentPartsArrivedEmail()<br />
        Dim incidentID As Integer = 0<br />
        Dim parts As List(Of String)<br />
        Dim sentIncident As New List(Of Integer)<br />
        Dim sendEmail As Boolean = False<br />
        Dim orderID As Integer = CInt(Me.cboOrders.Text)<br />
<br />
        Try<br />
            'Loop through finding all the incidents that are ready to be sent.<br />
            For Each outerRow As dsAddComponetAndEquipment.OrderDetailsRow In Me.DsAddComponetAndEquipment.OrderDetails<br />
                'check to ensure that all the orders are for the same order.<br />
                If (orderID = outerRow.OrderID) Then<br />
                    If (outerRow.Status = "Delivered") Then<br />
                        incidentID = outerRow.IncidentID<br />
                        'Ensure that the incident is not going to be repeated again.<br />
                        If Not (sentIncident.Contains(incidentID)) Then<br />
                            parts = New List(Of String)<br />
                            'Add the incident to the array to check later that this incident has already been done.<br />
                            sentIncident.Add(incidentID)<br />
                            For Each innerRow As dsAddComponetAndEquipment.OrderDetailsRow In Me.DsAddComponetAndEquipment.OrderDetails<br />
                                'check to ensure that all the orders are for the same order<br />
                                If (orderID = innerRow.OrderID) Then<br />
                                    'Only the incidents with the same incidentID <br />
                                    If (innerRow.IncidentID = incidentID) Then<br />
                                        If (innerRow.Status = "Delivered" AndAlso innerRow.EmailStatus = "Waiting") Then<br />
                                            parts.Add(String.Format("{0} - {1}", innerRow.Manufacturer, innerRow.Model))<br />
                                            sendEmail = True 'Everything ok so send the email<br />
                                        Else<br />
                                            sendEmail = False 'Not all parts have been delivered <br />
                                            Exit For<br />
                                        End If<br />
                                    End If<br />
                                End If<br />
                            Next innerRow<br />
                            If (sendEmail) Then<br />
                                Me.SendPartsEmail(Me.EngineersEmail(incidentID), parts, Me.CurrentUsersEmail())<br />
                      Me.TA_OrderDetails_dsCodeRed1.UpdateEmailSent(incidentID, orderID)<br />
                            End If<br />
                            sendEmail = False 'Set the flag back to false again to start the new incident<br />
                        End If<br />
                    End If<br />
                End If<br />
            Next outerRow<br />
        Catch ex As Exception<br />
            MsgBox(ex.Message)<br />
        End Try<br />
    End Sub

AnswerRe: View and Review my looping code Pin
Christian Graus5-Jul-07 7:33
protectorChristian Graus5-Jul-07 7:33 
AnswerRe: View and Review my looping code Pin
kubben5-Jul-07 7:33
kubben5-Jul-07 7:33 
QuestionVisual Basic to Access Pin
Ronak0855-Jul-07 6:49
Ronak0855-Jul-07 6:49 
AnswerRe: Visual Basic to Access Pin
Christian Graus5-Jul-07 7:19
protectorChristian Graus5-Jul-07 7:19 
GeneralRe: Visual Basic to Access Pin
Ronak0856-Jul-07 1:21
Ronak0856-Jul-07 1:21 
AnswerRe: Visual Basic to Access Pin
jonathan155-Jul-07 7:52
jonathan155-Jul-07 7:52 
GeneralRe: Visual Basic to Access Pin
Ronak0856-Jul-07 1:33
Ronak0856-Jul-07 1:33 
AnswerRe: Visual Basic to Access Pin
haggenx5-Jul-07 10:51
haggenx5-Jul-07 10:51 
QuestionUndo not working after Worksheet_Change Sub Routine in Excel Pin
reegan415-Jul-07 6:41
reegan415-Jul-07 6:41 
QuestionTopMost isnt working for me Pin
uk_nbb5-Jul-07 5:59
uk_nbb5-Jul-07 5:59 
AnswerRe: TopMost isnt working for me Pin
Christian Graus5-Jul-07 6:21
protectorChristian Graus5-Jul-07 6:21 
GeneralRe: TopMost isnt working for me Pin
uk_nbb5-Jul-07 6:36
uk_nbb5-Jul-07 6:36 
GeneralRe: TopMost isnt working for me Pin
Dave Kreskowiak5-Jul-07 15:45
mveDave Kreskowiak5-Jul-07 15:45 
AnswerRe: TopMost isnt working for me Pin
cutequencher5-Jul-07 6:22
cutequencher5-Jul-07 6:22 
AnswerRe: TopMost isnt working for me Pin
Luc Pattyn5-Jul-07 6:25
sitebuilderLuc Pattyn5-Jul-07 6:25 
GeneralRe: TopMost isnt working for me Pin
uk_nbb5-Jul-07 6:56
uk_nbb5-Jul-07 6:56 
Questiontextbox that accepts numbers only. urgent! Pin
cutequencher5-Jul-07 5:58
cutequencher5-Jul-07 5:58 

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.