|
If ( Dir("D:\data.txt") = "" ) Then
MsgBox "Not Found"
End If
|
|
|
|
|
This code work for me. Thank you.
|
|
|
|
|
On Error Resume Next
Open "D:\data.txt" For Input As #1
If Err.Num > 0 Then
' Some kind of error occured opening the file...
Exit Sub
End If
' Continue on with processing the file...
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
Hey,
I am working on a program that will detect the keys that someone hits and having certain functions be called for those certain keys. I have been having trouble with the "enter" button on both Alphabetical and Numerical sides of the keyboard.
This is the code that I'm using:
<br />
If e.KeyChar >= ChrW(48) And e.KeyChar <= ChrW(57) Then<br />
MessageBox.Show(("Form.KeyPress: '" + _<br />
e.KeyChar.ToString() + "' pressed."))<br />
End If<br />
Select Case e.KeyChar<br />
Case "6" '6 (Right) key pressed<br />
Function1()<br />
Case e.Enter '8 (Enter) key pressed<br />
Function2()<br />
Case ChrW(49), ChrW(52), ChrW(55)<br />
MessageBox.Show(("Form.KeyPress: '" + _<br />
e.KeyChar.ToString() + "' consumed."))<br />
e.Handled = True<br />
End Select<br />
The "e.enter" is how the help file showed to do it, but it didn't work. Any ideas on what I'm doing wrong?
Thank you!
|
|
|
|
|
I'm pritty sure your in the KeyPress Event and you'll need to be in the KeyDown Event.
Select Case e.KeyCode<br />
Case Keys.Right<br />
Function1()<br />
Case Keys.Enter<br />
Function2()<br />
Case Else<br />
e.Handled = False<br />
End Select
And so one....
Hope this helps.
|
|
|
|
|
Sorry, but this raises errors.
Thanks anyway though!
|
|
|
|
|
I'm confused on how this would raise errors? If you don't mind explaining, so I don't make the same mistakes again.
|
|
|
|
|
These errors are raised:
KeyCode' is not a member of System.EventArgs
Handled is not a member of System.EventArgs
|
|
|
|
|
AreJay wrote: your in the KeyPress Event and you'll need to be in the KeyDown Event
Private Sub _KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles MyBase.KeyDown
I've used the code before and tried it again today and it still works.
|
|
|
|
|
My mistake, it works.
Thank you!
|
|
|
|
|
guys another question here... how can i call the video with extension name of .wmv? what i want here is that, when i input a phrase or a word in the textbox, the video that corresponds it will show. and also, i want the videos to store in a database. how can i store the video in the database? its for thesis guys - thanks
|
|
|
|
|
Ok, you asked: < font color="aaaaaa:>what i want here is that, when i input a phrase or a word in the textbox, the video that corresponds it will show.
Are you asking to have a video come up for the path/filename of the video that you type in the textbox?
Please be more clear and I might be able to help.
|
|
|
|
|
most probably yah. when i input word or phrase in the text box, the corresponding video of that word or phrase will show.
|
|
|
|
|
Well, I don't know how to play the video, but you can look here for the code on how to. But here is an example on how to call the video.
<br />
If PhraseBox.Text = PhraseVarible Then<br />
'(Play Video Function)<br />
End If<br />
Sorry I couldn't be musch help.
|
|
|
|
|
well thanks very much!!! it will help a lot
|
|
|
|
|
Hey,
I am designing an app that will download the newest version of my software off my website. But, I want to have a progressbar that will monitor the progress of the download. I have found millions of tutorials but they have all been for VB6, and I'm using VB2005. Does anyone know how I could do this?
Thank you!
|
|
|
|
|
I've been using the OneClick feature within VS 2005 and it's easy and simple to use. I've haven't found a way to customize the downloading splash screens, yet! This will allow you to write your app and publish it to your site and set the application to check for update before it runs. This will make updates a snap.
|
|
|
|
|
Thanks, but that's not the question. I want to know how to get the progress of a download using a Progress Bar.
|
|
|
|
|
The only way you're going to get the progress of a download is if you write the code that is doing the actual download. Without that, you'll only be able to show the 0 and 100% marks since there isn't a component in the ToolBox that does download stuff and gives you progress updates.
Other than that, it's simple math.
Dim Percent As Integer = (BytesTransfered / TotalBytesInFile) * 100
ProgressBar1.Value = Percent
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
Sorry about that. I was preping code to post.
Just Snippets.[^]
I have test applicaiton if needed.
|
|
|
|
|
hi, i want to know how to check wether the internet connection is online or offline?? can someone give me some tips or code on how to make this happen??
and for the second question .. how can i check if the URL is valid or not (because i am creating my own internet explorer). the user puts the URL such as: "xsas" and i want to check if this is a valid URL. if its not than i make my own page to make the user see this ERROR page!
i am using vb.net! thanks to anyone who can help
Adrian De Battista: .Net Programmer, Java Programmer and Web Designer.
|
|
|
|
|
ADY007 wrote: hi, i want to know how to check wether the internet connection is online or offline?? can someone give me some tips or code on how to make this happen??
The closest you can get is calling InternetGetConnectedState[^].
ADY007 wrote: how can i check if the URL is valid or not
You have to try it. If there is no "http://" in from of the name, put it there, then try it again. There is no other way to tell if it's valid until you try it and it fails.
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
thanks alot!! but if for example .. if the user writes http://www.sxanxlj.com .. and this url doesn't exists .. how can i put my error message not the 404 Error message of the windows explorer :/ ??
Adrian De Battista: .Net Programmer, Java Programmer and Web Designer.
|
|
|
|
|
To display your own 404 Error Message, use this:
<br />
If Url.Exists = False Then<br />
WebPage.Url = "C:\Program Files\My Program\404_Page.html"<br />
End If<br />
|
|
|
|
|
but how to check if the URL is true or false. if the URL does not exists within the internet than i want to show my own webpage error.
Adrian De Battista: .Net Programmer, Java Programmer and Web Designer.
|
|
|
|