|
Directory.GetFiles(c:\temp");
then iterate through and delete files that match.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Dim fol As String() = System.IO.Directory.GetFiles("c:\temp")
Dim a As Integer = 0
For a = 0 To (folder.Length - 1)
If folder(a).Contains("abc") Then
System.IO.File.Delete(folder(a))
End If
Next
|
|
|
|
|
|
I'm working on a program for work, I need to monitor a set of data across a few SQL tables and distribute changes/updates in real time to multiple clients. There's a 3rd party program that's directly controlling the tables, my program will strictly monitor (only select statements). The program needs to refresh in 1 second intervals and there will be up to 80 clients running simutaneously. With these clients, there are actually only about 8 groups (10 clients receive the same data), so I'm looking for ideas on the best way to distribute these results to each "group" that will minimize network traffic and database server load. The query results won't be very large (strictly integers, about 8 columns, 6 rows), the thing I'm worried about is that it will be refreshing once per second. I'm by no means a vb.net expert, but not a complete novice either, so if you can point me in the right direction(s) it would be much appreciated. Thanks.
|
|
|
|
|
Hi,
I want a window to come up that has a few fields once the user chooses to shut down the computer.
It seemed fairly straigt forward to add:
Dim dataForm As DataEntryForm<br />
dataForm = New DataEntryForm()<br />
dataForm.Visible = True<br />
dataForm.Show()<br />
into the onStop() or onShutdown() methods of a service but this did not work.
How to do this? or is there a better way?
TIA,
Brian
|
|
|
|
|
Without the 4 lines above, the service starts and stops normally, but when added to the onStop() method, the service will have a problem stopping.
There is the following properties:
System.ServiceProcess.ServiceType.InteractiveProcess as well as Win32ShareProcess etc. I think I want it as InteractiveProcess because that should mean service can interact with desktop.
So how to set this property?
pls help^^
|
|
|
|
|
|
There is a forum for suggestions for the site.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Dear Friends
I have created report files in Crystal Report 8.5 was opened and saved in Crystal 9.2 format it doesn't work anymore from VB6 application which uses Crystal Control. What is the easiest way to make VB6 app with Crystal Control be compatible with Crystal 9.2 format?
else please can some one give me the sample code to use Crystal Report 9.2 .rpt files in the vb6 app.
Your quick repsonse will be highly appreciated.
Thank you
Patel Murtuza
|
|
|
|
|
Hi There,
I downloaded a code from net. I analysed the code.
http://www.only4gurus.com/v3/download.asp?resource=3281[^]
The file is ScopingOverloadingOverriding.zip
But it doesn't works the way I thought. I believe it should give a error when Employees Salary as every employee sal should be in a particular range, like for full time employee the range should be between 30000 & 50000. But it doesn't happens. Can anyone please tell me that am I correct will it show error. If not then what is the effect of line
if value<30000 and value >50000 then
throw new argumentoutofrangeexception ("Salary", Full Time salary should be between 30000 and 500000")
How should one diagnose the code that is given in a class file. Usually F10 mode is used but it skips code given in class file and directly returns answer to the actual code. I want to check each line of the class file.
Please Help.
Thanking you and waiting for some kind replies.
amit
|
|
|
|
|
Use "or" instead of "and".
There is no value that can be lower than 30000 and higher than 50000 at the same time.
If you want to step into the code that is called, use F11.
---
b { font-weight: normal; }
|
|
|
|
|
Hi! I'm quite new here and I was hoping if anybody could help me or kind enough to give a source code for viewing crystal reports in visual basic 6...
|
|
|
|
|
|
Hi there,
i want to know if there is any way to analize the body of an received mail in vb6. This is of an add-in for outlook.
Thanks
|
|
|
|
|
|
Well,the problem is that i don´t know how to catch the mail body.
What i want to do is to catch the mail body to search for an <tag> and then compare with the URL.
It´s a kind of anti-Phishing.
Thanks
|
|
|
|
|
|
Thanks,it help´s for a part of the problem. And how can i search the <tag> in the body of the mail and then compare with the URL?
|
|
|
|
|
It looks like the e-mail's body is returned as a String. You can call IndexOf() to search for a substring. In this case the URL.
So, how about something like this?
Dim myUrl As String = "www.yahoo.com"
If (oMsg.Body.IndexOf(myUrl) >= 0) Then
' URL found in body.
Else
' URL not found in body.
End If
|
|
|
|
|
But in that case we put the URL Dim myUrl As String = "www.yahoo.com".
What i want is to catch the URL that is in the body of the mail and then compare with the <tag>
|
|
|
|
|
Okay. That would be a more efficient way of handling it.
(I was hoping I could get away with something simple. )
You should use Regular Expression to identify all of the URLs in the e-mail. Perhaps an expression like this.
^(((h|H?)(t|T?)(t|T?)(p|P?)(s|S?))\://)?(www.|[a-zA-Z0-9].)[a-zA-Z0-9\-\.]+\.[a-zA-Z]*$
Here's the article I took the above string from. It contains more details. There are plenty of other articles like this on this website.
http://www.codeproject.com/csharp/regex2.asp[^]
I hope this helps!
|
|
|
|
|
Thanks for your msg´s
I tried to use that expression like this:
Public Sub ProcessInbox()
Dim oOutlook As Outlook.Application
Dim oNs As Outlook.NameSpace
Dim oFldr As Outlook.MAPIFolder
Dim oAttachments As Outlook.Attachments
Dim oAttachment As Outlook.Attachment
Dim iMsgCount As Integer
Dim myUrl As String = (^(((h|H?)(t|T?)(t|T?)(p|P?)(s|S?))\://)?(www.|[a-zA-Z0-9].)[a-zA-Z0-9\-\.]+\.[a-zA-Z]*$)
Dim oMessage As Outlook.MailItem
Dim iCtr As Long, iAttachCnt As Long
Dim sFileNames As String
Dim aFileNames() As String
'get reference to inbox
Set oOutlook = New Outlook.Application
Set oNs = oOutlook.GetNamespace("MAPI")
Set oFldr = oNs.GetDefaultFolder(olFolderInbox)
Debug.Print "Total Items: "; oFldr.Items.Count
Debug.Print "Total Unread items = " & oFldr.UnReadItemCount
For Each oMessage In oFldr.Items
With oMessage
'basic info about message
Debug.Print .To
Debug.Print .CC
Debug.Print .Subject
Debug.Print .Body
If oMessage.Body.IndexOf(myUrl >= 0) Then
MsgBox "URL encontrado="
' URL found in body.
Else
' URL not found in body
End If
If .UnRead Then
Debug.Print "Message has not been read"
Else
Debug.Print "Message has been read"
End If
iMsgCount = iMsgCount + 1
'save message as text file
.SaveAs "C:\message" & iMsgCount & ".txt", olTXT
.Body
'reference and save all attachments
With oMessage.Attachments
iAttachCnt = .Count
If iAttachCnt > 0 Then
For iCtr = 1 To iAttachCnt
.Item(iCtr).SaveAsFile "C:\" & .Item(iCtr).FileName
Next iCtr
End If
End With
End With
DoEvents
Next oMessage
Set oAttachment = Nothing
Set oAttachments = Nothing
Set oMessage = Nothing
Set oFldr = Nothing
Set oNs = Nothing
Set oOutlook = Nothing
End Sub
1st- I don´t know if i can use like this:
Dim myUrl As String = (^(((h|H?)(t|T?)(t|T?)(p|P?)(s|S?))\://)?(www.|[a-zA-Z0-9].)[a-zA-Z0-9\-\.]+\.[a-zA-Z]*$)
Probabli not because give´s me an error (Expected: end of statement)
Thank´s
|
|
|
|
|
First, you need to put double quotes around that string I gave you.
Second, you can't use that string like that. You need to feed it into a System.Text.RegularExpressions.Regex object, which handles the string matching for you. Regular expressions is not a small topic, so I suggest you read some articles on it.
Try looking at this article. The code is in C#, but the code is small and can easily be converted to VB.NET. In particular, look at the part where it talks about extracting the URL's authority. You'll probably want that part to match against your tags.
http://www.cambiaresearch.com/cambia3/snippets/csharp/regex/uri_regex.aspx[^]
|
|
|
|
|
Thanks a lot!!!
|
|
|
|
|
Hi there,
I still can´t search a string in the body of the mail.
Can you help me please???
Imports System.Reflection
Module Module1
Sub Main()
' Create Outlook application.
Dim oApp As Outlook.Application = New Outlook.Application()
' Get Mapi NameSpace.
Dim oNS As Outlook.NameSpace = oApp.GetNamespace("mapi")
oNS.Logon("YourValidProfile", Missing.Value, False, True) ' TODO:
' Get Messages collection of Inbox.
Dim oInbox As Outlook.MAPIFolder = oNS.GetDefaultFolder(Outlook.OlDefaultFolders.olFolderInbox)
Dim oItems As Outlook.Items = oInbox.Items
Console.WriteLine("Total : " & oItems.Count)
' Get unread e-mail messages.
oItems = oItems.Restrict("[Unread] = true")
Console.WriteLine("Total Unread : " & oItems.Count)
' Loop each unread message.
Dim oMsg As Outlook.MailItem
Dim i As Integer
Dim DTE As Object
Dim procura As String
DTE = Microsoft.VisualBasic.Interaction.CreateObject("VisualStudio.DTE.8.0")
For i = 1 To oItems.Count
oMsg = oItems.Item(i)
Console.WriteLine(i)
Console.WriteLine(oMsg.SenderName)
Console.WriteLine(oMsg.Subject)
Console.WriteLine(oMsg.ReceivedTime)
Console.WriteLine(oMsg.Body)
Console.WriteLine("---------------------------")
If Trim(oMsg.Body) = "seis" Then
MsgBox("msg found")
End If
Next
' Log off.
oNS.Logoff()
' Clean up.
oApp = Nothing
oNS = Nothing
oItems = Nothing
oMsg = Nothing
End Sub
End Module
remember that i want to find an URL (it´s still a string)
Thanks
|
|
|
|