|
Hi,
Can anyone let me know how can I restrict special character like ', " to be entered by the user in the text box?
Thank you,
Regards,
Deepa
|
|
|
|
|
You could handle the TextChanged event, look for the special characters and strip them out.
|
|
|
|
|
Hi
You could try handling the Textbox.TextChanged Event and check the last character for the characters you want to ignore and remove it if it's illegal.
Kevin
|
|
|
|
|
You can also handle the textbox's KeyDown and KeyPress events to check for, and block, illegal characters. There is an example in the KeyDown[^] docs.
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
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.....
|
|
|
|