Click here to Skip to main content
15,897,273 members
Home / Discussions / Visual Basic
   

Visual Basic

 
AnswerRe: Key Handling Pin
Salman Sheikh30-Oct-07 23:35
Salman Sheikh30-Oct-07 23:35 
QuestionData Binding Pin
ejaz_pk30-Oct-07 22:12
ejaz_pk30-Oct-07 22:12 
AnswerRe: Data Binding Pin
Dave Kreskowiak31-Oct-07 5:21
mveDave Kreskowiak31-Oct-07 5:21 
GeneralRe: Data Binding Pin
ejaz_pk31-Oct-07 21:08
ejaz_pk31-Oct-07 21:08 
GeneralRe: Data Binding Pin
John_Adams1-Nov-07 1:16
John_Adams1-Nov-07 1:16 
GeneralRe: Data Binding Pin
ejaz_pk1-Nov-07 2:05
ejaz_pk1-Nov-07 2:05 
QuestionHow to get newest file through VB Pin
Support12330-Oct-07 20:23
Support12330-Oct-07 20:23 
AnswerRe: How to get newest file through VB Pin
C1AllenS30-Oct-07 23:32
C1AllenS30-Oct-07 23:32 
Hello,

You can try this code. However, this is specific to the type of file name you have mentioned. To
test this code, put up a ListBox and a button control on the form. On button click event, paste
the following code.

Dim ofd As New FolderBrowserDialog
Dim result As DialogResult

result = ofd.ShowDialog()

If result = Windows.Forms.DialogResult.OK Then

Dim di As New IO.DirectoryInfo(ofd.SelectedPath)
Dim diar1 As IO.FileInfo() = di.GetFiles()
Dim dra As IO.FileInfo

ListBox1.Items.Clear()

For Each dra In diar1
ListBox1.Items.Add(dra)
Next

End If

Dim filearray() As String
Dim greater As Integer = 0
Dim index As Integer
Dim i As Integer

If ListBox1.Items.Count > 0 Then
ReDim filearray(ListBox1.Items.Count - 1)
End If


For i = 0 To ListBox1.Items.Count - 1

Dim s As String = ListBox1.Items(i).ToString
Dim substr As String = s.Substring(s.LastIndexOf(".") + 1)

If substr.StartsWith("R0") Then
filearray(i) = substr.Substring(2)
End If

Next

For i = 0 To filearray.Length - 1

If IsNumeric(filearray(i)) Then

If filearray(i) > greater Then

greater = filearray(i)
index = i

End If

End If
Next

If greater = 0 Then

MsgBox("No File Found")

Else

MsgBox(ListBox1.Items(i - 1).ToString & " is the latest file")

End If

I hope this helps.

Regards,

Allen Smith

Software Engineer
ComponentOne LLC
www.componentone.com
GeneralRe: How to get newest file through VB Pin
Support12331-Oct-07 1:39
Support12331-Oct-07 1:39 
AnswerRe: How to get newest file through VB Pin
Aftab Sindhi31-Oct-07 7:35
Aftab Sindhi31-Oct-07 7:35 
QuestionAuto generate Uniqueidentifier / GUID in Select statement Pin
Aftab Sindhi30-Oct-07 20:01
Aftab Sindhi30-Oct-07 20:01 
AnswerRe: Auto generate Uniqueidentifier / GUID in Select statement Pin
fazeepk30-Oct-07 23:04
fazeepk30-Oct-07 23:04 
AnswerRe: Auto generate Uniqueidentifier / GUID in Select statement Pin
Dave Kreskowiak31-Oct-07 5:14
mveDave Kreskowiak31-Oct-07 5:14 
GeneralRe: Auto generate Uniqueidentifier / GUID in Select statement Pin
Aftab Sindhi31-Oct-07 7:21
Aftab Sindhi31-Oct-07 7:21 
GeneralRe: Auto generate Uniqueidentifier / GUID in Select statement Pin
Dave Kreskowiak31-Oct-07 9:42
mveDave Kreskowiak31-Oct-07 9:42 
Questionlist in report Pin
di3.ny2830-Oct-07 16:09
di3.ny2830-Oct-07 16:09 
AnswerRe: list in report Pin
svanwass31-Oct-07 5:32
svanwass31-Oct-07 5:32 
AnswerRe: list in report Pin
Dave Kreskowiak31-Oct-07 5:51
mveDave Kreskowiak31-Oct-07 5:51 
GeneralRe: list in report Pin
di3.ny2831-Oct-07 16:29
di3.ny2831-Oct-07 16:29 
Questionhelp programming button click event Pin
SilentCodingOne30-Oct-07 10:30
SilentCodingOne30-Oct-07 10:30 
AnswerRe: help programming button click event Pin
Christian Graus30-Oct-07 11:26
protectorChristian Graus30-Oct-07 11:26 
QuestionHow can I define table of an existed Excel file? Pin
ATC30-Oct-07 10:08
ATC30-Oct-07 10:08 
AnswerRe: How can I define table of an existed Excel file? Pin
pmarfleet30-Oct-07 12:45
pmarfleet30-Oct-07 12:45 
GeneralRe: How can I define table of an existed Excel file? Pin
ATC31-Oct-07 3:43
ATC31-Oct-07 3:43 
GeneralRe: How can I define table of an existed Excel file? Pin
pmarfleet31-Oct-07 3:48
pmarfleet31-Oct-07 3:48 

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.