|
Just a couple of questions off the top of my head... Hangs where?? Which line?? Does it hang for a time, then resume?? Does it hang indefinately?? What's the size of the file it's trying to retrieve?? Is there network activity during the hang??
|
|
|
|
|
HI - and thanks for the reply If you want to chat about this - call me at 510 889 1453
I Posted this reply a bit early - and have found a small glitch
I have modified the code a bit - here is the most recent version using a directcast . . . The other version hung on the response statement - forever - and the network is basically empty during the hang
The reply is a 1-4 byte string. ---> Glitch - the directcast returns the entire web page string -
I found the following as an alternate suggestion - it works - but seems to time out on each request (my test file has 2 records, and the total time is about 12 seconds) - but if I un-comment the test1 string I get sub second response to a browser window.
My DevEnv is VisualStudio2008
WebRequestString = "http://ws.geonames.org/gtopo30?lat=" & lineArray(LatPosition) & "&lng=" & lineArray(LonPosition)
'Dim test1 As String = "http://www.geonames.org/gtopo30?lat=33.7669399&lng=-116.4134417"
Dim Request As HttpWebRequest
Dim Response As HttpWebResponse
Dim reader As StreamReader
Dim sbSource As StringBuilder
Try
Request = DirectCast(WebRequest.Create(WebRequestString), HttpWebRequest)
Request.KeepAlive = False
response = DirectCast(Request.GetResponse(), HttpWebResponse)
If Request.HaveResponse = True AndAlso Not (response Is Nothing) Then
' Get the response stream
reader = New StreamReader(response.GetResponseStream())
' Read it into a StringBuilder
sbSource = New StringBuilder(reader.ReadToEnd())
End If
Catch wex As WebException
' This exception will be raised if the server didn't return 200 - OK
' Try to retrieve more information about the network error
If Not wex.Response Is Nothing Then
Dim errorResponse As HttpWebResponse = Nothing
Try
errorResponse = DirectCast(wex.Response, HttpWebResponse)
MsgBox("The server returned '{0}' with the status code {1} ({2 })." & errorResponse.StatusDescription & " , " & errorResponse.StatusCode & " , " & errorResponse.StatusCode)
Finally
If Not errorResponse Is Nothing Then errorResponse.Close()
End Try
End If
Finally
If Not Response Is Nothing Then Response.Close()
End Try
elevationvalue = sbSource.ToString
modified on Wednesday, February 25, 2009 10:31 AM
|
|
|
|
|
|
I'm very sorry. You seem to have confused CodeProject.com with RentACoder.com
|
|
|
|
|
You have got to be one of the most clueless people here, and that is really saying something. First you create an article to ask a question, then you repeat that ie another article and now you are asking for a rentacoder.
Can you find the link for rentacoder or do you need help with that too!
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
How to place the text at cursor position in vb.net textbox
|
|
|
|
|
Look into the TextBox's SelectionStart property.
|
|
|
|
|
|
Hello my name is Jordan
MY problem if how can I save my playlist even If I shutdown the computer?
my sample code is :
'this sub is used to add url type playlist in the playlistbox
Private Sub FileOpener_FileOk(ByVal sender As System.Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles FileOpener.FileOk
'filenames is used because we want to get the path or url address of file choosen
'in order to play the choosen file by th visual player
For Each track As String In FileOpener.FileNames
'add the file choosen to the playlist
PlaylistListUrlBox.Items.Add(track)
Next
'change the value of titleLabel in the file choosen open by safe file names
'safe file name means that it will only get the file name not the path of the file
TitleLabel.Text = FileOpener.SafeFileName
End Sub
The playlist I created is the address or location of the file choosen
Thanks and more power codeproject.com for the help
|
|
|
|
|
Handle the form's Closing event and write the data you need to save to a file from there.
|
|
|
|
|
Hi,
i have a function on in a module.
i also have a button on a sheet.
how do i trigger the function when i hit the "Enter" key on the keyboard.
i tried to record a macro but this doesn't work.
any ideas?
thanks in advance.
Anoop
|
|
|
|
|
The worksheet and workbook objects don't have a KeyDown or KeyPress event, so the only way to tell would be if the sheet is set to recalcuate itself (which it normally does by default) and you handle the Calculate event.
|
|
|
|
|
Hello, My name is Jordan
I am using vb 2008 express edition
if someone could help I am really thankful but if not guess I have to
make my self push to what I can't do
My problem is if
1. How can I make save ms access database by using vb 2008?
2. How can I link a data base file to display by using a file in the database also?
Thanks and more power codeporject.com
|
|
|
|
|
Neither of your questions make any sense. Since Access is entirely file-based, everything you do to it is automatically saved. There is no "saving an Access database by using...".
Also, I think you really need to pickup a beginners book on VB.NET and ADO.NET. "Link a database file to display by using a file..." doesn't make any sense at all.
|
|
|
|
|
Hi!! How to encrypt stored procedure without using with encryption caluse.
I can encrypt with with encryprion clause. But it can be easily decarypted.
|
|
|
|
|
That's where carefully considered and implemented security of the SQL server comes into play. No, you can't create your own encrypting scheme to do this.
|
|
|
|
|
Hi All,
While sending sms message using GSM Modem (in vb.net), I am receiving CMS ERROR: 301 (because of making call).
How to resolve it? and send sms continuously....?
Thanks in advance.
modified on Monday, February 23, 2009 6:22 AM
|
|
|
|
|
|
How to browse folder not file
|
|
|
|
|
Look at the system.io.directory namespace you have everything you need there
For GUI searching there is a control 'FolderBrowserDialog' located in the toolbox under the group 'Dialogs'
|
|
|
|
|
It's giving error at line FolderBrowserDialog.ShowDialog()
|
|
|
|
|
Since my telepathic skills are a bit off today:
What error?
How did you initialize the dialog window?
How did you declare the dialog window?
Did you add the control in designer or in code?
|
|
|
|
|
I used this code for browse folder
Dim theFolderBrowser As New FolderBrowserDialog
theFolderBrowser.Description = "Please locate Directory..."
theFolderBrowser.ShowNewFolderButton = False
theFolderBrowser.RootFolder = Environment.SpecialFolder.Desktop
theFolderBrowser.SelectedPath = My.Computer.FileSystem.SpecialDirectories.ProgramFiles
If theFolderBrowser.ShowDialog = Windows.Forms.DialogResult.OK Then
txtpath.Text = theFolderBrowser.SelectedPath
Else
MessageBox.Show(theFolderBrowser.SelectedPath)
End If
It's give me error at If theFolderBrowser.ShowDialog = Windows.Forms.DialogResult.OK Then
error:Current thread must be set to single thread apartment (STA) mode before OLE calls can be made. Ensure that your Main function has STAThreadAttribute marked on it. This exception is only raised if a debugger is attached to the process.
|
|
|
|
|
Are you using this code in a separate thread than the main (GUI) thread?
If so you can not do this (at least not that I'm aware off), all dialogs and GUI aspects of your program have to be executed by the main thread.
|
|
|
|
|
Thanks for yr continuos replay..
I don't know about separate thread than the main (GUI) thread..
|
|
|
|