?
Solved

Help on Vb.net

Posted on 2006-05-26
3
Medium Priority
?
164 Views
Last Modified: 2010-04-23
Is there an easier way to program this code?  This is just a portion of a larger code but this is what I'm concerned with.

count = 1
     For Each objfileinfo1 In objDir.GetFiles()

            For Each lookuprow In ShippingPath1.ShipPath 'This is a dataset
                If lookuprow.Item(0) = (shipfield + count) Then
                    'MsgBox(lookuprow.Item(1))
                    output = lookuprow.Item(1)
                    'Debug.WriteLine(output)

                End If

            Next
            count += 1
            File.Delete(output)
            Debug.WriteLine("This will be deleted", output)
            File.Move(objfileinfo1.FullName, output)
            Debug.WriteLine("File move", objfileinfo1.FullName)
            Debug.WriteLine(output, " of the move")

        Next
        MsgBox("Done Please double check your work!", MsgBoxStyle.Critical)

Just want to move next in the dataset without going thru a for do loop.
0
Comment
Question by:plenahan
  • 2
3 Comments
 
LVL 8

Accepted Solution

by:
harris_c earned 150 total points
ID: 16773879
Ummm.  Are you concerned with speed?

Dim myArray as new ArrayList

myArray.AddRange (ShippingPath1.ShipPath)

'sort it
myArray.Sort

'look for first occurence
'is it .Find?  Do not have VS installd here ^_^
Dim startOffset as Long = myArray.Find (shipfield + count)  

For ctr as long = startOffset to myArray.Length - 1
    if myArray(ctr) <> shipfield + count Then Exit For
    output = lookuprow.Item(1)
Next ctr                                                          
...
0
 

Author Comment

by:plenahan
ID: 16943869
I'll check this out and let you know. Sorry that's it's taken so long for me to reply. :)

plenahan
0
 
LVL 8

Expert Comment

by:harris_c
ID: 16956946
No problem.

If you can further explain what this code does, I might be able to give you a better code.


hec",)
0

Featured Post

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Well, all of us have seen the multiple EXCEL.EXE's in task manager that won't die even if you call the .close, .dispose methods. Try this method to kill any excels in memory. You can copy the kill function to create a check function and replace the …
It’s quite interesting for me as I worked with Excel using vb.net for some time. Here are some topics which I know want to share with others whom this might help. First of all if you are working with Excel then you need to Download the Following …
This video shows how to quickly and easily deploy an email signature for all users in Office 365 and prevent it from being added to replies and forwards. (the resulting signature is applied on the server level in Exchange Online) The email signat…
Whether it be Exchange Server Crash Issues, Dirty Shutdown Errors or Failed to mount error, Stellar Phoenix Mailbox Exchange Recovery has always got your back. With the help of its easy to understand user interface and 3 simple steps recovery proced…
Suggested Courses

839 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question