|
Hi,
I want to use the class System.io and wonder where I put this class in my code. I put the imports system.io at the assemblyinfo.vb but no success in a form when I try and get some info e.g. my.computer.name or my.application.assemblyinfo.companyname.
The squickally line appears below my.
What simple thing am I doing wrong?
|
|
|
|
|
directred wrote: I want to use the class System.io
That is a namespace, not a class.
directred wrote: I put the imports system.io at the assemblyinfo.vb
Don't. It won't do anything for you there.
directred wrote: What simple thing am I doing wrong?
Put the Imports System.IO at the top of each file that needs to use classes in that namespace. Alternatively, you can use the fully qualified name for each class. e.g. System.IO.FileStream
|
|
|
|
|
Example:
Imports System.IO
Public Class FileSystem
Function FileExists(Byval sFile as String) as Boolean
If File.Exists(sFile) Then
Return True
Else
Return False
End If
End Function
End Class
SMC
|
|
|
|
|
You might prefer to reply to the original poster rather than me. It wasn't me that was looking for help.
|
|
|
|
|
I'm writing an app at the moment that is supposed to compare a folder at intervals and check to see if any new files have been writen. I feel like i'm going the long way round about doing this at the moment, there must be an easier way. So far i've got:
Check files in folder
Create an array of the filepaths
timer()
- check folder again
- create another array with contents in
- compare with original
The problem i'm having is when i want to display the jpg files in a pic box, i can't find out which one is the newest file. Ok i could create a file object for each of the paths in the array, but it seems like there's a really easy answer to this and i figured someone on here would know. All i need really in the end is a list (not bothered what type) of new files that have been created in a particular folder, and then from this list i want to be able to see which one is the newest and open it up in a pic box
Any ideas of how i can do this easier than i've done it would be greatly appreciated, as i'm starting to bang my head on the desk
|
|
|
|
|
Look into a 'filesystemwatcher' you can configure it to fire and even when a new file is created or an file updated or a file deleted, etc. Does all the work for you.
|
|
|
|
|
yeah i was just looking into that, found an article here thanks
|
|
|
|
|
This is what i've got so far
I've included the Filesystemwatcher as a control in design view. I'm not really gonna be changing the settings for it in runtime.
The properties are:
EnableRaisingEvents: True
Filter: *.jpg
GenerateMember: True
IncludeSubdirectories: false
Modifiers: Friend
NotifyFilter: Filename, DirectoryName, LastWrite
Path: c:\temp
so i went into the code view and brought up the mFolderWatch event 'create'
i put a simple msgbox(e.name) in there so i could see how it works, but the event never occurs. I'm copying an existing jpg so maybe that's why, but i've tried creating a jpg from psp and it still doesn't call the event, do i have it set up incorrectly? I think it might have something todo with notifyfilter?
|
|
|
|
|
i changed notifyfilter to just filename, and it seems to work now :S
|
|
|
|
|
I was thinking about how to store the names generated by the filewatcher
does the filewatcher store the filenames for me (that'd be really great!), but i'm guessing it doesn't
Just wondered how other people would go about storing this list. I might have 100 files in a folder that are created.
I was thinking about storing the file list as an array of strings, but then the idea was to load up the latest file in a pic box, so maybe an array of file objects? Does that seem like a backwards way of going forwards? I just wondered if anyone had any ideas of an easier way to store this kind of list of information in vb.net, i've just recently moved from vb6 so you'll have to excuse my dumbness!
|
|
|
|
|
Hi,
I have managed to add WMP to aform in vb.net, however I'm not sure how to get it to play a video of my choosing. What i would like is that when the form opens, the user clicks on play and the video clip thats already on the system begins to play.
how do I do this?
Thanks.
|
|
|
|
|
Have you read the WMP docs ? There's a property, I suspect it's Url, that you set to the path of the file. There's anotehr property called ctl_controls ( from memory ), which has play, stop, etc methods on it.
Christian Graus - C++ MVP
|
|
|
|
|
Hi,
Thanks forthe response, Ive changed the URL to the video i want to play,but it doesnt play it, ive also changed the ctl control properties, but still no result.
where do i get the WMP docs from?
Thanks
Jaidev
|
|
|
|
|
|
Hi
Is there as easy way to display row numbers in a DataGridView Control (i.e. in the Row Header cells on the side of the control) which has a DataTable as it's datasource. Also, if a row is deleted, it should re-number the rows
Tks
Richard
|
|
|
|
|
Hi
How can I get a list of SQL Servers on a network, and the databases on each server
Tks
|
|
|
|
|
May i know wat is the syntax to use to get the current date and current time. Sometime like that:
Date = CurrentDate
time = CurrentTime
it is urgent pls help...
|
|
|
|
|
Use DateTime.Today for just the date, and DateTime.Now for the date and time.
See here for more information.
|
|
|
|
|
And if i just wan the time only? btw wat should i add so tt the format of the date is 20-11-2006 and the time is 17:36?
|
|
|
|
|
For just the time, use DateTime.Now.ToShortTimeString .
And for the date, use DateTime.Now.ToShortDateString .
|
|
|
|
|
date = now or now.date
date = now.timeofday
nothing is impossible.....
|
|
|
|
|
I'm trying to read a wav file apply a filter to it and save that as a new wav file. I've had no problems doing that but when I try to play the new wav file in Windows Media Player (or any other player for that matter) I keep getting this error: C00D1199: Cannot play the file.
I took a look at the the headers for the original file and the new file and they are completely identical so that doesn't seem to be the problem. Also when I look at the files in the "mycomputer" file manager they have the same size (as they should be). Does anybody have any ideas on what could be the problem?
I will post the header file data below just incase that would be of any help.
,82,73,70,70
,210,19,1,0
,87,65,86,69
,102,109,116,32
,18,0,0,0
,1,0,1,0
,68,172,0,0
,136,88,1,0
,2,0,16,0
,0,0,102,97
,99,116,4,0
thanks,
Mike
|
|
|
|
|
You cannot just save a file as a .wav file. You have to convert it.
Have you tried playing your new Wave file in a different media player?
|
|
|
|
|
Yes I tried playing it in another player and got an error with that too.
What do you mean by converting it? I included the header information for it.
thanks you for your help.
|
|
|
|
|
MikeMarq wrote: What do you mean by converting it? I included the header information for it.
You cannot just save files, you must convert them. I'm not sure if this will help, but try looking here.
|
|
|
|