|
thank for your answer. but I need Datagridview control not Datagrid control.
|
|
|
|
|
I want to put a button in Outlook that saves the users selected emails into a directory. Can anyone point me in the right direction.
|
|
|
|
|
I stole this snippet from a C# forum and converted it into VB. It's a routine for searching files recursively. When i test it however, I get the "Access to the path 'C:\System Volume Information' is denied." error. I've tried the old VB6: On Error Resume Next. Doesn't work thou. Any way to get around it?
Private Sub DirSearch(ByVal sDir As String)
Dim arrLst As New ArrayList
Dim _dir As String
Dim _file As String
Try
For Each _dir In Directory.GetDirectories(sDir)
For Each _file In Directory.GetFiles(_dir, txtFile.Text)
arrLst.Add(_file)
Next
DirSearch(_dir)
Next
Catch ex As Exception
Debug.Print(ex.Message)
End Try
End Sub
Thanks
|
|
|
|
|
Add some try/catch block to your code and handle the exception.
--------------------------------------------------------
My portfolio & development blog
Q:What does the derived class in C# tell to it's parent?
A:All your base are belong to us!
|
|
|
|
|
Well, that's because you don't have enough permission to access that directory. You can just ignore that by moving the Try Block inside the loop, like this :
Private Sub DirSearch(ByVal sDir As String)
Dim arrLst As New ArrayList
Dim _dir As String
Dim _file As String
For Each _dir In Directory.GetDirectories(sDir)
Try
For Each _file In Directory.GetFiles(_dir, txtFile.Text)
Try
arrLst.Add(_file)
Catch ex as IOException
Continue
End Catch
Next
DirSearch(_dir)
Catch ex as IOException
Continue
End Try
Next
End Sub
That should fix it. The Continue statements continue the loop into the next iteration, so that exception should be ignored..
Yuvi Panda T
15 year old Microsoft Student Partner
Blogs at : http://yuvipanda.blogspot.com
|
|
|
|
|
hello everybody.
a simple unsolvable question:
is it possible to emulate a click on the windows taskbar "disconnect" button,so to obtain the corresponding dialog box(e.g. the one in windows xp has got the "Change user" and "Log Off" buttons)?
I ask this because i have gave up hope to find a relative API,like SHShutDownDialog to show the shutdown dialog box..
Can someone please help?
many thanks in advance..
|
|
|
|
|
or at least how to obtain the Logoff button handle to use with "findwindowex" API...
i searched for it with spy++,but no result(at best i found the "All programs" button in Start menu taskbar,but not the Shutdown nore the Logoff one)
help
|
|
|
|
|
no idea?
please please please....
|
|
|
|
|
Is this what you want? taken from Microsoft's Win32 Programmers Reference
--------
The ExitWindows function logs off the current user. All applications must agree to terminate before the user logs off. If any application returns FALSE when it processes the WM_QUERYENDSESSION message, the user is not logged off. If your application handles the WM_QUERYENDSESSION message, you can allow the user to cancel the log-off operation, even if another application or Windows originated the end-session request.
The following example logs off the current user, unless the user clicks the No button in the message box displayed when the application receives the WM_QUERYENDSESSION message.
// Log off the current user.
ExitWindows(0, 0);
----------------
and taken from the APIViewer2004 application (www.apiviewer.de)
Declare Function ExitWindows Lib "user32.dll" ( _
ByVal dwReserved As Int32, _
ByVal uReturnCode As Int32) As Int32
modified 1-Aug-19 21:02pm.
|
|
|
|
|
first of all thanks for your answer...
but sorry,no,it's not what i want.i knew ExitWindows or ExitWindowsEx API function,but i didn't and still don't want to actually logoff the computer,i just want to show the coloured dialog box Windows Xp shows to the user when s/he clicks on the Logoff button on the start menu taskbar.
I hope to make it clearer in this example:ExitWindows also shuts the computer down.So,if i had wanted to do so,i would have used the above-mentioned function:but to show the shutdown dialog box i would instead have used the SHShutdownDialog function(try it in the example i have written below).So,i was searching for a similar api,or whatsoever goals the same result with the logoff dialog box.
example in vb6:
<br />
Private Declare Function SHShutDownDialog Lib "shell32" Alias "#60" (ByVal YourGuess As Long) As Long<br />
Private Sub Form_Load()<br />
'KPD-Team 1999<br />
'URL: http:
'E-Mail: KPDTeam@Allapi.net<br />
SHShutDownDialog 0<br />
End Sub<br />
-- modified at 4:54 Tuesday 9th May, 2006
|
|
|
|
|
i have finally found this completely-undocumented API function:
Public Declare Function SHLogoffDialog Lib "shell32.dll" Alias "#54" (ByVal hWnd As Integer) As Integer
(of course the integer type is intended for .net,otherwise you should use the long one)
well done!
byeeeeeeee
|
|
|
|
|
Apologies for sending you incorrect data. I mis-understood your requirements. Sorry about that.
Undocumented - many are and Microsoft should consider publishing them and I hear the reasons for not using these as they are unsupported and Microsoft are at liberty to change/remove without regard - I have seen many postings about using undocumented code.
modified 1-Aug-19 21:02pm.
|
|
|
|
|
abbottra don't worry!no problem..
in fact.but they're so useful functions....anyway i didn't know they're free to change them...even if i use them only for a home application,i will bear in mind.
thanks again
|
|
|
|
|
I have a textbox having text in "dd/MM/yyyy" format (eg. 16/05/2006)
How i assing this text to a Date Object?
I am using Date object = format(textbox1.text, "dd/MM/yyyy")
this cause error
|
|
|
|
|
What kind of error? Just saying 'this cause error' does not really help.
PC
|
|
|
|
|
The Format method is used to create a string, not parse it.
Use the DateTime.ParseExact method.
---
b { font-weight: normal; }
|
|
|
|
|
how can i use microsoft flexgrid in vb.net
|
|
|
|
|
|
Hi there,
I have a question concerning the datagridview in vb.net 2005.
Is it possible to change the text-alignment of a certain column in the datagridview? If so, how do I do this?
Thanks!!!
G72360
|
|
|
|
|
|
I have written a program to View a Specific webpage with an option to refresh this site.
Picture of Program Layout
Is there any possible way to Extract the Number Online( ? out of 12 ) to an integer into the program? The page is written in php and is not my own. The variable I am trying to get is under the "Online" Column{1,12 Cell} in Row 2{2,12 Cell}.
Purpose being..
If Online > 1 Then
Scream bloody murder
End If
This program has NotifyIcon incorporated, so having this hidden and still checking for players would be the ideal goal.
Thank you in advance for any and all help. I appreciate your time in helping me with this matter.
TehCheeze
-- modified at 6:56 Sunday 7th May, 2006
P.S. -- The html for the WebSite is as follows
<br />
<table width="100%" border=1><br />
<tr><br />
<th>Name</th><br />
<th>Dedicated</th><br />
<th>Password</th><br />
<th>CMaps</th><br />
<th>Time online</th><br />
<th>Map</th><br />
<th>Game Type</th><br />
<th>Teams</th><br />
<br />
<th>Respawn</th><br />
<th>Lives</th><br />
<th>Target</th><br />
<th>Online</th><br />
</tr><br />
<tr><br />
<td><a href="cm://86.137.187.125:41230">Saturn</a></td><br />
<td>Yes</td><br />
<td>No</td><br />
<td>No</td><br />
<br />
<td>61135</td><br />
<td>Temple Dar</td><br />
<td>CTF</td><br />
<td>Yes</td><br />
<td>Normal</td><br />
<td>0</td><br />
<td>100</td><br />
<td>0 / 12</td><br />
</tr><br />
<br />
</table><br />
<p>Note: Temporary page, list function only not worked on layout/visual design yet.</p><br />
<br />
|
|
|
|
|
I have done some "data scraping" myself in the past extracting data from website pages. The problem you will run up against is when the positioning of the data youre interested in moves, especially of the person who owns the site changes their page. These days pages that are being generated use scripts to build up the page dynamically and this means that in order to extract your information with as little maintenance as possible, you will need to parse the page and present the data in a format which your own code can understand.
My own code which was developed in vbScript parsed the page looking for various tags such as href's titles meta data etc and the function (shown below) worked reasonably well, so you should be able to convert this into your VB application quite easily.
When scraping a page of unknown content, you have to be aware of pitfalls such as the tag you are looking for being embedded inside javascript as the autor may well write something like document.write("<tr><td class='myClass'>Saturn</td>.....");
Which really excaberates the problem. Trying to write a parser which covers all eventualities is extrememly hard. HTML 1.0 is one thing, but now with XHTML and XML the problem just grows. This is why browsers are always continuously being updated.
Having said that the function below might be spawn off some thoughts. It was called from a loop which keeps calling the GetTag and passing the updated pointer into the page back again. Not also that the Get Function can be recursive if a certain condition arises. You would probably need to do a similar thing when looking for a table tag as table can be embedded inside tables and of course a table has many rows and columns.
This is not an easy answer to your problem. There is most probably an easier way so simply locate the table tag and then count the number of columns you have located and simply extract the data inside the column for your program. But for maintenance free code which caters for the page authors making changes, then the parser method will have much more lengevity and can always be re-used in other projects.
Remember that this code is a little dirty and was used as a concept prover. But I hope it helps you with your problem. (Trying to get the formatting right in this post is a real pain when its a mixture of tabs and spaces!)
<pre>
call GetHTMLPage(strTemp) ' Grab the page into strHTML
iPos = 1
do while (iPos > 0)
iPos = GetTag ("href", strHTML, iPos, nNode, true)
loop
</pre>
<pre>
Function GetTag(strTag, str, iStartPos, thisNode, bStandardTag)
Dim i, pos, iStartScriptPos, iEndScriptPos
if objProps.DebugInfo then Response.Write "GetTag : " & strTag & "," & iStartPos & "<br>"
' Look for the tag in the stream
pos = Instr(iStartPos,str, strTag, vbTextCompare)
if bStandardTag then
pos = Instr(iStartPos,str, "<" & strTag & ">", vbTextCompare)
else
pos = Instr(iStartPos,str, strTag, vbTextCompare)
end if
' Check to see if one has been found
if pos >= iStartPos then
' Walk backwards to discover if we are inside a <script> tag
for i = pos to 1 step - 8 ' 8 is the length of '<script>'
iStartScriptPos = Instr(i, str, "<script" , vbTextCompare)
' Check to see if we were inside a script
if iStartScriptPos > 0 and iStartScriptPos < pos then
if objProps.DebugInfo then Response.Write "<span style=""color:green""><script>" & iStartScriptPos & "</span><br>"
exit for ' If we were then we need to examine closer so exit now
end if ' Otherwise
next ' keep looking backwards
' Check to see if we did actually find a '<script>' and if so look for the corresponding '</script>'
' This assumes that the page actually has a terminating tag
if iStartScriptPos > 0 then
iEndScriptPos = Instr(iStartScriptPos, str,"</script>", vbTextCompare)
end if
' Now that we have some positions of both the '<script>' and '</script>
' we can cehck to see if our tag was actually inside them
' If so then we can set the bInScript Flag
if ( iEndScriptPos > iStartScriptPos) and _
( iStartScriptPos > 0 ) and _
( pos < iEndScriptPos) and _
( pos >= iStartScriptPos) then
' We need to ignore anything in JS Comment Lines
if objProps.DebugInfo then
Response.Write "<span style=""color:blue"">" & _
objUtils.HTMLEnc(mid( str, iStartScriptPos, (iEndScriptPos-iStartScriptPos + len("</script>")) )) & _
"</span><br>"
end if
Dim arrScript, iComment, idx, strC, iLen, iResult, iTag
' We are inside <script> ... </script> and hrefs could be inside comments such as // so
' we need to check. Best way so far is to split the scetion into an array of lines
' and keep looking
arrScript = split( mid(str,iStartScriptPos,iEndScriptPos - iStartScriptPos), vbNewLine )
for idx = 0 to UBound(arrScript)
strC = arrScript(idx) ' Place line onto temp buffer
iLen = len(strC) ' cache the length
iComment = Instr(strC,"//") ' Start of comment
if iComment <= 0 then iComment = iLen
iTag = Instr(strC, strTag, vbTextCompare) ' Start of tag on this line
iResult = 1
'Response.Write "Line(" & idx & ") " & strTag & "-" & iTag & " " & objUtils.HTMLEnc(strC) & "<br>"
' Recurse along this line looking for tags
do while (iTag > 0 and iTag < iComment and iResult >0)
iResult = GetTag(strTag, strC, iResult, thisNode, bStandardTag)
loop
next ' So onto the next line
pos = iEndScriptPos
else
' We have located a tag so start getting some stuff
' walk backwards and locate the start of tag e.g. '<'
' but as in bbc.co.uk there is 'news_console_link.href= ... so check for a period also
if not bStandardTag then
Dim iSanityCheck : iSanityCheck = pos
do while mid(str,pos,1) <> "<" and pos > 1
'Response.Write "Scanning backwards: ( " & pos & ") " & mid(str,pos,1) & "<br>"
pos = pos -1
loop
pos = pos + 1 ' We dont want to include the '<' though
' build up a string with the tag details
Dim strTemp : strTemp = ""
do while (mid(str,pos,1) <> ">" and pos < len(str))
'Response.Write "Scanning: forwards: ( " & pos & ") " & mid(str,pos,1) & "<br>"
strTemp = strTemp & mid(str, pos, 1)
pos = pos + 1
loop
pos = pos + 1
if pos < iSanityCheck then
pos = iSanityCheck + len(strTag)
if objProps.DebugInfo then Response.Write "<span style=""color:red"">Exit GetTag SanityCheck : </span> " & pos & "<br>"
GetTag = pos
Exit Function
end if
else
' Simply look for the closing tag as eveyrthing else inside is all thats called for
strTemp = ""
pos = pos + len(strTag) + 2
do while (mid(str,pos,1) <> "<" and pos <= len(str))
strTemp = strTemp & mid(str, pos, 1)
pos = pos + 1
loop
do while (mid(str,pos,1) <> ">" and pos <= len(str))
pos = pos + 1
loop
pos = pos + 1
end if
' We now have a temporary string with the required tag data
' So we now need to either add this tag into the child list if its an href
' or simply stuff the information into this nodes information
call ApplyInfo(strTag, strTemp, thisNode)
'pos = pos + len(strTemp)
end if
end if
if objProps.DebugInfo then Response.Write "<span style=""color:green"">Exit GetTag returns: </span> " & pos & "<br>"
GetTag = pos
End Function
</pre>
|
|
|
|
|
Hi all,
i have SQL script that i will execute it in class and i have to add this SQL file to the class ,but i need no one else see this file ,so i make the copy option to be"Do not copy" , but i use this file to read from it ,so when i use the created dll in another solution , it can't find that file
what exactly shall i do?
your answers will be appreciated
Thank you
|
|
|
|
|
I think your SQL file is inside the Project so when you use the dll in the project . you find it but when you try to use the same DLL from another project it does not give you path. So two solutions.
1. encrypt the file and let it be with copy on the system. and decrypt it when required.
2. make a function in the class and it will hold the query in string array and will return it back to you when you call it or directly run it when you pass some required parameters.
Rizwan Bashir
|
|
|
|
|
thank you Rizwan ,
can u guide me how to do the encryption? so that when file exist in the customer's machine can't be opened!!!
|
|
|
|
|