|
STemaat wrote: >>>OK, what's the big deal? Use the Directory class and it's GetFiles method to get a list of files in the directory and start feeding them to whatever routine you've written to process the files.
Hmm...someone here is a NOOB (namely me)
You never said what part of that you were having a problem with...
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
Really what I was hoping for was a code snippet in both cases. I am having a hard time finding examples I can wrap my mind around/adapt, and neither topic is covered well in the textbook for the class I took last semester.
I think I'm getting my mind warapped around the first one...my thought is to simply "touch" every file that happens to be in the directory, which would fire the changed event of the watcher.
First concept that comes to mind on the second issue is putting the file open into an Until loop.
Am I on the right track?
|
|
|
|
|
STemaat wrote: I think I'm getting my mind warapped around the first one...my thought is to simply "touch" every file that happens to be in the directory, which would fire the changed event of the watcher.
You could do that, but the FileSystemWatcher has been known to miss events now and then when firing alot of them all at once. "Touching" the files involves extra work you don't have to do. Just get the list of files and pass each one to the routine that does the processing. The event handler for the FSW should be doing the same thing.
STemaat wrote: First concept that comes to mind on the second issue is putting the file open into an Until loop.
Yep. All you have to do is put the thread to sleep for a little while, maybe one second, inside the loop if the Open fails. That way you're not bogging down the system.
Dim attempting As Boolean = True
While attempting
Try
' Open the file for exclusive read/write
' close it
' pass the filename to some method to do the actual processing
attempting = False
Catch
Thread.Sleep(1000)
End Try
End While
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
As a follow-up...I fixed the second part of the problem by changing the Watcher trigger to changed, instead of created. That was all I needed in this case
Got the ifrst part handled, too. Thanks for your help!
|
|
|
|
|
hey i would like help some help regarding the playback speed...
i would like to increase or decrease the speed with which an audio file is played..depending on the users choice..it shuould be variable in as low as 5% increment/decrement.
help me i am new
|
|
|
|
|
This depends entirely on the object or API that you're using to play the audio file. If you're using just the Win32 API, you can't change the playback speed. In this case, you'll have to find a 3rd party media player that supports what you want.
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
In Vb, I would have an option or groupbox, with checkbox controls on it. I could set a value for each checkbox and then write the following code...
Select Case optGroupbox1<br />
<br />
Case 1: 'checkbox 1<br />
'statements<br />
Case 2: 'checkbox 2<br />
'statements<br />
End Select
How would I implement the above code in vb.net?
I've tried the following but vb.net does not like Case chkbox1.CheckState = CheckState.Checked call...
Select Case GroupBox1.Controls<br />
<br />
Case chkbox1.CheckState = CheckState.Checked<br />
'statements<br />
End Select
Thanks in advance.
|
|
|
|
|
Rashar wrote: Select Case GroupBox1.Controls
Case chkbox1.CheckState = CheckState.Checked
VB.NET won't work like that. Since you've specified GroupBox1.Controls in the Select statement, you can only specify properties of the Controls collection, not it's contents.
You'll have to enumerate the controls collection to get this to work:
For Each gbc As Control in GroupBox1.Controls
Select Case gbc.Name
Case "chkbox1":
If gbc.CheckState = CheckState.Checked Then
...
End If
End Select
Next
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
while savinf the DTS package with visual basic file and converting it into vb.net file i get troublews how do i convert vb6 file to vb.net?
|
|
|
|
|
Recode it by hand. I have no idea what's your trying to say about DTS, but converting the VB6 code by hand is the best method.
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
I have a programme that I write using VB6 Now I want to Convert it to VB.NET2003
how can I achieve this.Also What is the Different between VB.Net and VB.Net2003.Thanks
Ademola
|
|
|
|
|
Adekolurejo wrote: I have a programme that I write using VB6 Now I want to Convert it to VB.NET2003
how can I achieve this.
Open the VB6 projects .VBP file in Visual Studio and it'll launch the Conversion Wizard. I highly recommend not doing this and just rewriting the project from scratch though. The conversion doesn't do a perfect job of converting code and it will NOT take advantage of any improvements made in the .NET Framework or VB.NET language. It'll generate code that emulates and is functionally equivilent to VB6, but that's about all.
Adekolurejo wrote: What is the Different between VB.Net and VB.Net2003.
VB.NET = VB.NET2003. VB.NET is an identifier that covers the language versions 2002, 2003, 2005, and above.
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
Hi,
I am trying to write a sub-routine in a VBScript to split a file path into 3 bits.
For example I want to split the following path:
"C:\Program Files\MyProg\Studio\win32\bin\filt.exe"
into 3 bits:
1. C:\Program Files
2. \MyProg\Studio\win32\bin
3. \filt.exe
The First part will always be de-limited by 'Program Files' (or the 2nd '\').
The Second part will be delimited from the end of 'Program Files' to the last '\' in the path.
The 3rd Part will be delimited from the last '\' to the end of the path.
The source of the initial file path is stored in an input file, and the split path is to be stored in another text file in the following format:
"C:\Program Files" ** "\MyProg\Studio\win32\bin" ** "\filt.exe"
I hope this is clear, and someone will be able to assist. Any help will be much appreciated.
Thanks
|
|
|
|
|
This is simple string handling.
You can use the FileSystemObject 's GetFilename method to get the last part of the string.
You can use WScript.ExpandEnvironmentStrings to get the path to the Program Files folder (which is NOT always on C:!!). All you need to do is exand the environment variable "ProgramFiles" and it'll usually return C:\Program Files .
After that, it's simple string handling to get the middle part. Hint: What's the length of the strings returned by both of these calls?
Dave Kreskowiak
Microsoft MVP - Visual Basic
-- modified at 14:34 Monday 26th June, 2006
|
|
|
|
|
Thanks Dave
|
|
|
|
|
Hi all,
I'm modifying an application written in VB6. I need to show into a dialog some data that is correctly stored in an Access 2003 database. The texts stored are written in Slovenian and when I use the Adodc::Recordset to retrieve them and show into the dialog they are shown badly.
Anybody knows what I should do or what I'm doing wrong?
Thanks in advance,
Marc Soleda
... she said you are the perfect stranger she said baby let's keep it like this... Dire Straits
|
|
|
|
|
I have some text boxes in a form.On leave event of the textbox control, I am validating the
values by pop uping the message.When I press the ESC or Cancel Button,I need to close
form.When the focus is on textbox control and the textbox is not empty on that time I am
pressing ESC button, that validation message is pop-uping.I need to avoid that pop up
message.
by Nagarajan
|
|
|
|
|
Don't put the code in the OnLeave event. Put it in the TextBox's Validating[^] event and set the TextBox's .CausesValidation property to True. Check the documentation for an example.
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
Hi,
while programming quite robust application in VB.NET 2.0 a minor problem occured when the application is closing it sometimes "forgets" to remove itself from the bottom bar (there are no exceptions thrown, by clicking on it it simply disappears - which is obvious as the application is already closed). I remember that this was a problem in c++ too but it was removed by slight modification of events posted when the application was closing. I am quite surprised this happens here, where these events should be completely managed. The only closing event I am using for application purposes is just 'FormClosing'. Others I expect to manage by themselves.
Can someone tell me how to remove this flaw and properly close the application ? Thank you.
-- modified at 10:28 Monday 26th June, 2006
|
|
|
|
|
It's usually still there because you're forgotten to dispose of (release) either unmanaged resources or managed objects that hold onto unmanaged resources.
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
I have an application which connects to internet.After connecting to the net a new toolbat appears in main window.from the toolbar we activate a child window.I think that application coded in C++.My question is Can we access the child window through our code in vb.net please suggest books/readings
bzasri
|
|
|
|
|
Define "access that child window". If you're talking about just casting that window to a Form object in VB.NET, then no, you can't do that. The only method you have is sending Window messages to each of the controls on that form. It's a very cumbersome process to find the correct window handles for each of the controls you want to "talk" to and sending/retrieving data. There is no "easy" way to do it.
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
Have you done MouseDown/MouseUp Event with form button?
And How i can do it with buttons of toolbar?
Every Replies will be appliciated!
ICQ:258-235-734
MSN:msnadair@hotmail.com
|
|
|
|
|
Toolbar also has events MouseDown and MouseUp.
Toolbar's buttons have event ButtonClick.
I think that's all you need.
Robert
|
|
|
|
|
Sorry.I don't understand you clearly.
TOOLBAR'S buttons click event activates MOUSEDOWN AND MOUSEUP event.Codes in the click event will be excuted after Mouseup event.
But now i want to perform follow steps:
when mouse button is pressed down,i want to excute some codes.when mouse button is releaseed,i want to excute some codes.
ICQ:258-235-734
MSN:msnadair@hotmail.com
|
|
|
|