NewInTown
July 16th, 2003, 06:26 AM
hie, i have tried using your coding for displaying web messages(msgbox). i have succeded in applying the codes, but failed when i tried to call the function in my loop. why does this occur? can't the coding be used in the loop too? below is my coding:
Private Sub btnOK_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnOK.Click
If fso.FolderExists(strMyPath) Then
fso.GetFolder(strMyPath)
For Each sFl In fso.GetFolder(strMyPath).Files
If sFl.Name Like "MR_WW*.xls" Then
strtmp = fso.GetFileName(sFl.Name)
intlngth = Len(strtmp) - 5
strName = Microsoft.VisualBasic.Left(strtmp, intlngth)
Else
Say("The file you are looking for is not available.")
End If
Next
Response.Redirect("../Final_MR/excel/" & strName & WWnum & ".xls")
Else
Say("The folder you are looking for is not available.")
End If
End Sub
Private Sub Say(ByVal Message As String)
' Format string properly
Message = Message.Replace("'", "\'")
Message = Message.Replace(Convert.ToChar(10), "\n")
Message = Message.Replace(Convert.ToChar(13), "")
' Display as JavaScript alert
ltlAlert.Text = "alert('" & Message & "')"
End Sub
Thanx!
Private Sub btnOK_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnOK.Click
If fso.FolderExists(strMyPath) Then
fso.GetFolder(strMyPath)
For Each sFl In fso.GetFolder(strMyPath).Files
If sFl.Name Like "MR_WW*.xls" Then
strtmp = fso.GetFileName(sFl.Name)
intlngth = Len(strtmp) - 5
strName = Microsoft.VisualBasic.Left(strtmp, intlngth)
Else
Say("The file you are looking for is not available.")
End If
Next
Response.Redirect("../Final_MR/excel/" & strName & WWnum & ".xls")
Else
Say("The folder you are looking for is not available.")
End If
End Sub
Private Sub Say(ByVal Message As String)
' Format string properly
Message = Message.Replace("'", "\'")
Message = Message.Replace(Convert.ToChar(10), "\n")
Message = Message.Replace(Convert.ToChar(13), "")
' Display as JavaScript alert
ltlAlert.Text = "alert('" & Message & "')"
End Sub
Thanx!